diff options
Diffstat (limited to 'src/commands/leveling')
| -rw-r--r-- | src/commands/leveling/leaderboard.ts | 6 | ||||
| -rw-r--r-- | src/commands/leveling/level.ts | 6 | ||||
| -rw-r--r-- | src/commands/leveling/levelRoles.ts | 9 | ||||
| -rw-r--r-- | src/commands/leveling/setLevel.ts | 7 | ||||
| -rw-r--r-- | src/commands/leveling/setXp.ts | 7 |
5 files changed, 19 insertions, 16 deletions
diff --git a/src/commands/leveling/leaderboard.ts b/src/commands/leveling/leaderboard.ts index ffed9e9..2e0ce5d 100644 --- a/src/commands/leveling/leaderboard.ts +++ b/src/commands/leveling/leaderboard.ts @@ -1,5 +1,5 @@ import { BushCommand, ButtonPaginator, Level, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { MessageEmbed } from 'discord.js'; +import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js'; export default class LeaderboardCommand extends BushCommand { public constructor() { @@ -17,7 +17,7 @@ export default class LeaderboardCommand extends BushCommand { prompt: 'What page of the leaderboard would you like to view?', retry: '{error} Pick a valid argument.', optional: true, - slashType: 'INTEGER' + slashType: ApplicationCommandOptionType.Integer } ], slash: true, @@ -32,7 +32,7 @@ export default class LeaderboardCommand extends BushCommand { if (!(await message.guild.hasFeature('leveling'))) return await message.util.reply( `${util.emojis.error} This command can only be run in servers with the leveling feature enabled.${ - message.member?.permissions.has('MANAGE_GUILD') + message.member?.permissions.has(Permissions.FLAGS.MANAGE_GUILD) ? ` You can toggle features using the \`${util.prefix(message)}features\` command.` : '' }` diff --git a/src/commands/leveling/level.ts b/src/commands/leveling/level.ts index 48cf3ed..18648e8 100644 --- a/src/commands/leveling/level.ts +++ b/src/commands/leveling/level.ts @@ -12,7 +12,7 @@ import { import { SimplifyNumber } from '@notenoughupdates/simplify-number'; import assert from 'assert'; import canvas from 'canvas'; -import { MessageAttachment } from 'discord.js'; +import { ApplicationCommandOptionType, MessageAttachment, Permissions } from 'discord.js'; import got from 'got'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; @@ -36,7 +36,7 @@ export default class LevelCommand extends BushCommand { prompt: 'What user would you like to see the level of?', retry: '{error} Choose a valid user to see the level of.', optional: true, - slashType: 'USER' + slashType: ApplicationCommandOptionType.User } ], slash: true, @@ -51,7 +51,7 @@ export default class LevelCommand extends BushCommand { if (!(await message.guild.hasFeature('leveling'))) return await message.util.reply( `${util.emojis.error} This command can only be run in servers with the leveling feature enabled.${ - message.member?.permissions.has('MANAGE_GUILD') + message.member?.permissions.has(Permissions.FLAGS.MANAGE_GUILD) ? ` You can toggle features using the \`${util.prefix(message)}features\` command.` : '' }` diff --git a/src/commands/leveling/levelRoles.ts b/src/commands/leveling/levelRoles.ts index a5eb5c4..115ace1 100644 --- a/src/commands/leveling/levelRoles.ts +++ b/src/commands/leveling/levelRoles.ts @@ -1,5 +1,6 @@ import { AllowedMentions, BushCommand, type ArgType, type BushMessage, type BushSlashMessage, type OptionalArgType } from '#lib'; import assert from 'assert'; +import { ApplicationCommandOptionType, Permissions } from 'discord.js'; export default class LevelRolesCommand extends BushCommand { public constructor() { @@ -17,7 +18,7 @@ export default class LevelRolesCommand extends BushCommand { description: 'The level to assign the role when reached.', prompt: 'What level would you like to set a role for when reached?', retry: '{error} Pick a valid integer representing the role to assign a role to when reached.', - slashType: 'INTEGER' + slashType: ApplicationCommandOptionType.Integer }, { id: 'role', @@ -26,14 +27,14 @@ export default class LevelRolesCommand extends BushCommand { description: 'The role to assign to a user who reaches the specified level.', prompt: 'What role would you like to assign to users when they reach that level?', retry: '{error} Choose a valid role to assign to users upon reaching the specified level.', - slashType: 'ROLE', + slashType: ApplicationCommandOptionType.Role, optional: true } ], slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, ['MANAGE_ROLES']), - userPermissions: ['MANAGE_GUILD', 'MANAGE_ROLES'] + clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_ROLES]), + userPermissions: [Permissions.FLAGS.MANAGE_GUILD, Permissions.FLAGS.MANAGE_ROLES] }); } diff --git a/src/commands/leveling/setLevel.ts b/src/commands/leveling/setLevel.ts index 184ee1b..29f36e0 100644 --- a/src/commands/leveling/setLevel.ts +++ b/src/commands/leveling/setLevel.ts @@ -1,4 +1,5 @@ import { AllowedMentions, BushCommand, Level, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; +import { ApplicationCommandOptionType, Permissions } from 'discord.js'; export default class SetLevelCommand extends BushCommand { public constructor() { @@ -15,7 +16,7 @@ export default class SetLevelCommand extends BushCommand { type: 'user', prompt: 'What user would you like to change the level of?', retry: '{error} Choose a valid user to change the level of.', - slashType: 'USER' + slashType: ApplicationCommandOptionType.User }, { id: 'level', @@ -23,13 +24,13 @@ export default class SetLevelCommand extends BushCommand { type: 'integer', prompt: 'What level would you like to set the user to?', retry: '{error} Choose a valid level to set the user to.', - slashType: 'INTEGER' + slashType: ApplicationCommandOptionType.Integer } ], slash: true, channel: 'guild', clientPermissions: (m) => util.clientSendAndPermCheck(m), - userPermissions: ['ADMINISTRATOR'] + userPermissions: [Permissions.FLAGS.ADMINISTRATOR] }); } diff --git a/src/commands/leveling/setXp.ts b/src/commands/leveling/setXp.ts index d6f28b2..721f28f 100644 --- a/src/commands/leveling/setXp.ts +++ b/src/commands/leveling/setXp.ts @@ -1,4 +1,5 @@ import { AllowedMentions, BushCommand, Level, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; +import { ApplicationCommandOptionType, Permissions } from 'discord.js'; export default class SetXpCommand extends BushCommand { public constructor() { @@ -15,7 +16,7 @@ export default class SetXpCommand extends BushCommand { type: 'user', prompt: 'What user would you like to change the xp of?', retry: '{error} Choose a valid user to change the xp of.', - slashType: 'USER' + slashType: ApplicationCommandOptionType.User }, { id: 'xp', @@ -24,13 +25,13 @@ export default class SetXpCommand extends BushCommand { match: 'restContent', prompt: 'How much xp should the user have?', retry: "{error} Choose a valid number to set the user's xp to.", - slashType: 'INTEGER' + slashType: ApplicationCommandOptionType.Integer } ], slash: true, channel: 'guild', clientPermissions: (m) => util.clientSendAndPermCheck(m), - userPermissions: ['ADMINISTRATOR'] + userPermissions: [Permissions.FLAGS.ADMINISTRATOR] }); } |
