Change alias name length to be driven by config, increase to 200char
This commit is contained in:
		
							parent
							
								
									4bbdb59f3d
								
							
						
					
					
						commit
						fe70166e6a
					
				| 
						 | 
					@ -10,6 +10,7 @@ export const config = {
 | 
				
			||||||
    // Limits for the bot functions
 | 
					    // Limits for the bot functions
 | 
				
			||||||
    alias: {
 | 
					    alias: {
 | 
				
			||||||
      // Roll Alias system
 | 
					      // Roll Alias system
 | 
				
			||||||
 | 
					      maxNameLength: 200, // Max alias name length allowed in DB
 | 
				
			||||||
      free: {
 | 
					      free: {
 | 
				
			||||||
        user: 100, // Allows users to have 100 aliased rolls for free
 | 
					        user: 100, // Allows users to have 100 aliased rolls for free
 | 
				
			||||||
        guild: 1_000, // Allows guilds to have 1000 aliased rolls for free
 | 
					        guild: 1_000, // Allows guilds to have 1000 aliased rolls for free
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,7 +30,7 @@ await dbClient.execute(`
 | 
				
			||||||
  CREATE TABLE aliases (
 | 
					  CREATE TABLE aliases (
 | 
				
			||||||
    guildid bigint unsigned NOT NULL,
 | 
					    guildid bigint unsigned NOT NULL,
 | 
				
			||||||
    userid bigint unsigned NOT NULL,
 | 
					    userid bigint unsigned NOT NULL,
 | 
				
			||||||
    aliasName varchar(100) NOT NULL,
 | 
					    aliasName varchar(200) NOT NULL,
 | 
				
			||||||
    rollStr varchar(4000) NOT NULL,
 | 
					    rollStr varchar(4000) NOT NULL,
 | 
				
			||||||
    yVarCnt tinyint unsigned NOT NULL,
 | 
					    yVarCnt tinyint unsigned NOT NULL,
 | 
				
			||||||
    premium tinyint(1) NOT NULL,
 | 
					    premium tinyint(1) NOT NULL,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,14 +49,15 @@ const handleAddUpdate = async (message: DiscordenoMessage, guildMode: boolean, a
 | 
				
			||||||
  const aliasName = (argSpaces.shift() || '').trim();
 | 
					  const aliasName = (argSpaces.shift() || '').trim();
 | 
				
			||||||
  argSpaces.shift();
 | 
					  argSpaces.shift();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (aliasName.length > 100) {
 | 
					  if (aliasName.length > config.limits.alias.maxNameLength) {
 | 
				
			||||||
    message
 | 
					    message
 | 
				
			||||||
      .send({
 | 
					      .send({
 | 
				
			||||||
        embeds: [
 | 
					        embeds: [
 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
            color: failColor,
 | 
					            color: failColor,
 | 
				
			||||||
            title: 'Error: Alias Name is too long',
 | 
					            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.`,
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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.
 | 
					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: \`${
 | 
					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(
 | 
					          ReservedWords.join('`, `')
 | 
				
			||||||
            '`, `',
 | 
					 | 
				
			||||||
          )
 | 
					 | 
				
			||||||
        }\``,
 | 
					        }\``,
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue