Change alias name length to be driven by config, increase to 200char

This commit is contained in:
Ean Milligan 2025-07-13 03:09:36 -04:00
parent 4bbdb59f3d
commit fe70166e6a
4 changed files with 7 additions and 7 deletions

View File

@ -10,6 +10,7 @@ export const config = {
// Limits for the bot functions
alias: {
// Roll Alias system
maxNameLength: 200, // Max alias name length allowed in DB
free: {
user: 100, // Allows users to have 100 aliased rolls for free
guild: 1_000, // Allows guilds to have 1000 aliased rolls for free

View File

@ -30,7 +30,7 @@ await dbClient.execute(`
CREATE TABLE aliases (
guildid bigint unsigned NOT NULL,
userid bigint unsigned NOT NULL,
aliasName varchar(100) NOT NULL,
aliasName varchar(200) NOT NULL,
rollStr varchar(4000) NOT NULL,
yVarCnt tinyint unsigned NOT NULL,
premium tinyint(1) NOT NULL,

View File

@ -49,14 +49,15 @@ const handleAddUpdate = async (message: DiscordenoMessage, guildMode: boolean, a
const aliasName = (argSpaces.shift() || '').trim();
argSpaces.shift();
if (aliasName.length > 100) {
if (aliasName.length > config.limits.alias.maxNameLength) {
message
.send({
embeds: [
{
color: failColor,
title: 'Error: Alias Name is too long',
description: `\`${aliasName}\` (\`${aliasName.length}\` characters) is longer than the allowed max length of \`100\` characters. Please choose a shorter alias name.`,
description:
`\`${aliasName}\` (\`${aliasName.length}\` characters) is longer than the allowed max length of \`${config.limits.alias.maxNameLength}\` characters. Please choose a shorter alias name.`,
},
],
})

View File

@ -16,10 +16,8 @@ export const help = (message: DiscordenoMessage, guildMode: boolean) => {
Currently, you may create up to \`${config.limits.alias.free.guild.toLocaleString()}\` per guild and \`${config.limits.alias.free.user.toLocaleString()}\` per user account. This limit may increase or decrease in the future.
Aliases are case-insensitive (\`tEsT\` is stored as \`test\`, but can still be called as \`tEsT\`), and are not allowed to be named any of the following: \`${
ReservedWords.join(
'`, `',
)
Aliases are case-insensitive (\`tEsT\` is stored as \`test\`, but can still be called as \`tEsT\`), have a max allowed length of \`${config.limits.alias.maxNameLength}\`, cannot include any spaces, and are not allowed to be named any of the following: \`${
ReservedWords.join('`, `')
}\``,
},
{