diff options
Diffstat (limited to 'src')
101 files changed, 369 insertions, 352 deletions
diff --git a/src/arguments/permission.ts b/src/arguments/permission.ts index 4ae6327..cf4c42c 100644 --- a/src/arguments/permission.ts +++ b/src/arguments/permission.ts @@ -1,12 +1,12 @@ import { type BushArgumentTypeCaster } from '#lib'; -import { Permissions, type PermissionString } from 'discord.js'; +import { PermissionFlagsBits, type PermissionsString } from 'discord.js'; -export const permission: BushArgumentTypeCaster<PermissionString | null> = (_, phrase) => { +export const permission: BushArgumentTypeCaster<PermissionsString | null> = (_, phrase) => { if (!phrase) return null; phrase = phrase.toUpperCase().replace(/ /g, '_'); - if (!(phrase in Permissions.FLAGS)) { + if (!(phrase in PermissionFlagsBits)) { return null; } else { - return phrase as PermissionString; + return phrase as PermissionsString; } }; diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts index 4f511cd..e12a131 100644 --- a/src/commands/admin/channelPermissions.ts +++ b/src/commands/admin/channelPermissions.ts @@ -1,5 +1,5 @@ import { BushCommand, ButtonPaginator, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, PermissionFlagsBits } from 'discord.js'; export default class ChannelPermissionsCommand extends BushCommand { public constructor() { @@ -47,8 +47,8 @@ export default class ChannelPermissionsCommand extends BushCommand { ] } ], - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_CHANNELS]), - userPermissions: [Permissions.FLAGS.ADMINISTRATOR], + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageChannels]), + userPermissions: [PermissionFlagsBits.Administrator], channel: 'guild', slash: true }); @@ -63,7 +63,7 @@ export default class ChannelPermissionsCommand extends BushCommand { } ) { if (!message.inGuild()) return await message.util.reply(`${util.emojis.error} This command can only be run in a server.`); - if (!message.member!.permissions.has(Permissions.FLAGS.ADMINISTRATOR) && !message.member!.user.isOwner()) + if (!message.member!.permissions.has(PermissionFlagsBits.Administrator) && !message.member!.user.isOwner()) return await message.util.reply(`${util.emojis.error} You must have admin perms to use this command.`); if (message.util.isSlashMessage(message)) await message.interaction.deferReply(); diff --git a/src/commands/admin/roleAll.ts b/src/commands/admin/roleAll.ts index 3b438d9..c056bbd 100644 --- a/src/commands/admin/roleAll.ts +++ b/src/commands/admin/roleAll.ts @@ -1,5 +1,5 @@ import { AllowedMentions, BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, Permissions, type GuildMember } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; export default class RoleAllCommand extends BushCommand { public constructor() { @@ -30,8 +30,8 @@ export default class RoleAllCommand extends BushCommand { } ], channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_ROLES]), - userPermissions: [Permissions.FLAGS.ADMINISTRATOR], + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageRoles]), + userPermissions: [PermissionFlagsBits.Administrator], typing: true, slash: true }); @@ -39,7 +39,7 @@ export default class RoleAllCommand extends BushCommand { public override async exec(message: BushMessage | BushSlashMessage, args: { role: ArgType<'role'>; bots: ArgType<'boolean'> }) { if (!message.inGuild()) return await message.util.reply(`${util.emojis.error} This command can only be run in a server.`); - if (!message.member!.permissions.has(Permissions.FLAGS.ADMINISTRATOR) && !message.member!.user.isOwner()) + if (!message.member!.permissions.has(PermissionFlagsBits.Administrator) && !message.member!.user.isOwner()) return await message.util.reply(`${util.emojis.error} You must have admin perms to use this command.`); if (message.util.isSlashMessage(message)) await message.interaction.deferReply(); diff --git a/src/commands/config/_customAutomodPhrases.ts b/src/commands/config/_customAutomodPhrases.ts index 1c91f28..bd9bab5 100644 --- a/src/commands/config/_customAutomodPhrases.ts +++ b/src/commands/config/_customAutomodPhrases.ts @@ -1,5 +1,5 @@ // import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; -// import { Permissions } from 'discord.js'; +// import { PermissionFlagsBits } from 'discord.js'; // export default class CustomAutomodPhrasesCommand extends BushCommand { // public constructor() { @@ -31,7 +31,7 @@ // slash: true, // channel: 'guild', // clientPermissions: (m) => util.clientSendAndPermCheck(m), -// userPermissions: [Permissions.FLAGS.MANAGE_GUILD] +// userPermissions: [PermissionFlagsBits.ManageGuild] // }); // } diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts index 0498b87..d210472 100644 --- a/src/commands/config/blacklist.ts +++ b/src/commands/config/blacklist.ts @@ -1,5 +1,5 @@ import { AllowedMentions, BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, Permissions, User } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits, User } from 'discord.js'; export default class BlacklistCommand extends BushCommand { public constructor() { @@ -42,7 +42,7 @@ export default class BlacklistCommand extends BushCommand { slash: true, channel: 'guild', clientPermissions: (m) => util.clientSendAndPermCheck(m), - userPermissions: [Permissions.FLAGS.MANAGE_GUILD] + userPermissions: [PermissionFlagsBits.ManageGuild] }); } diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index 42ff309..8f2472e 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -20,7 +20,7 @@ import { Formatters, GuildMember, InteractionUpdateOptions, - Permissions, + PermissionFlagsBits, Role, SelectMenuComponent, SelectMenuOption, @@ -126,7 +126,7 @@ export default class ConfigCommand extends BushCommand { }), channel: 'guild', clientPermissions: (m) => util.clientSendAndPermCheck(m), - userPermissions: [Permissions.FLAGS.MANAGE_GUILD] + userPermissions: [PermissionFlagsBits.ManageGuild] }); } @@ -209,7 +209,7 @@ export default class ConfigCommand extends BushCommand { } ) { if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`); - if (!message.member?.permissions.has(Permissions.FLAGS.MANAGE_GUILD) && !message.member?.user.isOwner()) + if (!message.member?.permissions.has(PermissionFlagsBits.ManageGuild) && !message.member?.user.isOwner()) return await message.util.reply(`${util.emojis.error} You must have the **Manage Server** permission to run this command.`); const setting = message.util.isSlash ? (_.camelCase(args.subcommandGroup)! as GuildSettings) : args.setting!; const action = message.util.isSlash ? args.subcommand! : args.action!; diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts index d59ff55..a7ebfa2 100644 --- a/src/commands/config/disable.ts +++ b/src/commands/config/disable.ts @@ -1,7 +1,8 @@ import { AllowedMentions, BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, AutocompleteInteraction, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, AutocompleteInteraction, PermissionFlagsBits } from 'discord.js'; import Fuse from 'fuse.js'; + assert(Fuse); export default class DisableCommand extends BushCommand { @@ -48,7 +49,7 @@ export default class DisableCommand extends BushCommand { slash: true, channel: 'guild', clientPermissions: (m) => util.clientSendAndPermCheck(m), - userPermissions: [Permissions.FLAGS.MANAGE_GUILD] + userPermissions: [PermissionFlagsBits.ManageGuild] }); } diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts index 04c0425..2e7d623 100644 --- a/src/commands/config/features.ts +++ b/src/commands/config/features.ts @@ -10,7 +10,7 @@ import { ActionRow, ComponentType, Embed, - Permissions, + PermissionFlagsBits, SelectMenuComponent, SelectMenuOption, type Message, @@ -27,8 +27,8 @@ export default class FeaturesCommand extends BushCommand { examples: ['features'], slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), - userPermissions: [Permissions.FLAGS.MANAGE_GUILD] + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), + userPermissions: [PermissionFlagsBits.ManageGuild] }); } diff --git a/src/commands/config/log.ts b/src/commands/config/log.ts index 4c9a20b..79f9258 100644 --- a/src/commands/config/log.ts +++ b/src/commands/config/log.ts @@ -1,6 +1,6 @@ import { B |
