diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-01-31 19:20:39 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-01-31 19:20:39 -0500 |
commit | bab76f38a17c62f8c1477172fe1bc9428efb3843 (patch) | |
tree | 9aee5ed7b54e74735ff417820427c9d2efa984f4 /src/commands | |
parent | 78ab3362a52578d0bcada903732f147747c609df (diff) | |
download | tanzanite-bab76f38a17c62f8c1477172fe1bc9428efb3843.tar.gz tanzanite-bab76f38a17c62f8c1477172fe1bc9428efb3843.tar.bz2 tanzanite-bab76f38a17c62f8c1477172fe1bc9428efb3843.zip |
fixes, and breaking changes
Diffstat (limited to 'src/commands')
56 files changed, 160 insertions, 159 deletions
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 { BushCommand, guildLogsArr, type ArgType, type BushMessage, type BushSlashMessage, type GuildLogType } from '#lib'; import { ArgumentGeneratorReturn } from 'discord-akairo'; -import { ApplicationCommandOptionType, ChannelType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, ChannelType, PermissionFlagsBits } from 'discord.js'; export default class LogCommand extends BushCommand { public constructor() { @@ -38,7 +38,7 @@ export default class LogCommand extends BushCommand { ], channel: 'guild', clientPermissions: (m) => util.clientSendAndPermCheck(m), - userPermissions: [Permissions.FLAGS.MANAGE_GUILD] + userPermissions: [PermissionFlagsBits.ManageGuild] }); } diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index 28d2c76..617672f 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -32,7 +32,7 @@ import { Message, MessageAttachment, MessageCollector, - Permissions, + PermissionsBitField, ReactionCollector, SelectMenuComponent, Util @@ -268,4 +268,4 @@ export default class EvalCommand extends BushCommand { } } -/** @typedef {ActivePunishment|Global|Guild|Level|ModLog|StickyRole|ButtonInteraction|Collection|Collector|CommandInteraction|ContextMenuCommandInteraction|DMChannel|Emoji|Interaction|InteractionCollector|Message|ActionRow|MessageAttachment|ButtonComponent|MessageCollector|SelectMenuComponent|ReactionCollector|Util|Canvas|Shared|Permissions} VSCodePleaseDontRemove */ +/** @typedef {ActivePunishment|Global|Guild|Level|ModLog|StickyRole|ButtonInteraction|Collection|Collector|CommandInteraction|ContextMenuCommandInteraction|DMChannel|Emoji|Interaction|InteractionCollector|Message|ActionRow|MessageAttachment|ButtonComponent|MessageCollector|SelectMenuComponent|ReactionCollector|Util|Canvas|Shared|PermissionsBitField} VSCodePleaseDontRemove */ diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts index 1d1a27b..0ea9179 100644 --- a/src/commands/info/avatar.ts +++ b/src/commands/info/avatar.ts @@ -1,5 +1,5 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, Embed, GuildMember, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, GuildMember, PermissionFlagsBits } from 'discord.js'; export default class AvatarCommand extends BushCommand { constructor() { @@ -21,14 +21,14 @@ export default class AvatarCommand extends BushCommand { slashType: ApplicationCommandOptionType.User } ], - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [], slash: true }); } override async exec(message: BushMessage | BushSlashMessage, args: { user: ArgType<'member'> | ArgType<'globalUser'> }) { - const params: { size: 2048; format: 'png'; dynamic: true } = { size: 2048, format: 'png', dynamic: true }; + const params: { size: 2048; extension: 'png'; dynamic: true } = { size: 2048, extension: 'png', dynamic: true }; const defaultAvatar = `https://cdn.discordapp.com/embed/avatars/${Math.ceil(Math.random() * 6) - 1}.png`; const member = (args.user ?? message.member) instanceof GuildMember ? args.user ?? message.member : undefined; diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index d899a95..d23f5b1 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -1,6 +1,6 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { Embed, Permissions, version as discordJSVersion } from 'discord.js'; +import { Embed, PermissionFlagsBits, version as discordJSVersion } from 'discord.js'; import * as os from 'os'; const { default: prettyBytes } = await import('pretty-bytes'); assert(prettyBytes); @@ -15,7 +15,7 @@ export default class BotInfoCommand extends BushCommand { usage: ['bot-info'], examples: ['bot-info'], slash: true, - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [] }); } diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts index 0e1be81..6aad1fe 100644 --- a/src/commands/info/color.ts +++ b/src/commands/info/color.ts @@ -9,8 +9,9 @@ import { type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, Embed, Permissions, Role } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, PermissionFlagsBits, Role } from 'discord.js'; import tinycolor from 'tinycolor2'; + assert(tinycolor); const isValidTinyColor: BushArgumentTypeCaster<string | null> = (_message, phase) => { @@ -40,7 +41,7 @@ export default class ColorCommand extends BushCommand { } ], channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [] }); } diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts index 03f6441..0aabb70 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -8,7 +8,7 @@ import { GuildMFALevel, GuildPremiumTier, GuildVerificationLevel, - Permissions, + PermissionFlagsBits, type BaseGuildVoiceChannel, type GuildPreview, type Snowflake, @@ -36,7 +36,7 @@ export default class GuildInfoCommand extends BushCommand { } ], slash: true, - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [] }); } @@ -98,14 +98,14 @@ export default class GuildInfoCommand extends BushCommand { ); if (guild.premiumSubscriptionCount) guildAbout.push(`**Boosts:** Level ${guild.premiumTier} with ${guild.premiumSubscriptionCount ?? 0} boosts`); - if (guild.me?.permissions.has(Permissions.FLAGS.MANAGE_GUILD) && guild.vanityURLCode) { + if (guild.me?.permissions.has(PermissionFlagsBits.ManageGuild) && guild.vanityURLCode) { const vanityInfo: Vanity = await guild.fetchVanityData(); guildAbout.push(`**Vanity URL:** discord.gg/${vanityInfo.code}`, `**Vanity Uses:** ${vanityInfo.uses?.toLocaleString()}`); } - if (guild.icon) guildAbout.push(`**Icon:** [link](${guild.iconURL({ size: 4096, format: 'png' })})`); - if (guild.banner) guildAbout.push(`**Banner:** [link](${guild.bannerURL({ size: 4096, format: 'png' })})`); - if (guild.splash) guildAbout.push(`**Splash:** [link](${guild.splashURL({ size: 4096, format: 'png' })})`); + if (guild.icon) guildAbout.push(`**Icon:** [link](${guild.iconURL({ size: 4096, extension: 'png' })})`); + if (guild.banner) guildAbout.push(`**Banner:** [link](${guild.bannerURL({ size: 4096, extension: 'png' })})`); + if (guild.splash) guildAbout.push(`**Splash:** [link](${guild.splashURL({ size: 4096, extension: 'png' })})`); const EmojiTierMap = { [GuildPremiumTier.Tier3]: 500, @@ -173,7 +173,7 @@ export default class GuildInfoCommand extends BushCommand { .setColor(util.colors.default) .addField({ name: '» About', value: guildAbout.join('\n') }); if (guildStats.length) guildInfoEmbed.addField({ name: '» Stats', value: guildStats.join('\n') }); - const guildIcon = guild.iconURL({ size: 2048, format: 'png' }); + const guildIcon = guild.iconURL({ size: 2048, extension: 'png' }); if (guildIcon) { guildInfoEmbed.setThumbnail(guildIcon); } diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index 67f99d1..e31153b 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -7,7 +7,7 @@ import { ButtonComponent, ButtonStyle, Embed, - Permissions + PermissionFlagsBits } from 'discord.js'; import Fuse from 'fuse.js'; import packageDotJSON from '../../../package.json' assert { type: 'json' }; @@ -47,7 +47,7 @@ export default class HelpCommand extends BushCommand { } ], slash: true, - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [] }); } diff --git a/src/commands/info/icon.ts b/src/commands/info/icon.ts index ed9ab0f..b40b814 100644 --- a/src/commands/info/icon.ts +++ b/src/commands/info/icon.ts @@ -1,5 +1,5 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; -import { Embed, Permissions } from 'discord.js'; +import { Embed, PermissionFlagsBits } from 'discord.js'; export default class IconCommand extends BushCommand { constructor() { @@ -9,7 +9,7 @@ export default class IconCommand extends BushCommand { description: "A command to get the server's icon", usage: ['icon'], examples: ['icon'], - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [], channel: 'guild', slash: true @@ -23,7 +23,7 @@ export default class IconCommand extends BushCommand { .setImage( message.guild!.iconURL({ size: 2048, - format: 'png' + extension: 'png' })! ) .setTitle(util.discord.escapeMarkdown(message.guild!.name)); diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts index 35e9748..c767361 100644 --- a/src/commands/info/ping.ts +++ b/src/commands/info/ping.ts @@ -1,5 +1,5 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; -import { Embed, Permissions, type Message } from 'discord.js'; +import { Embed, PermissionFlagsBits, type Message } from 'discord.js'; export default class PingCommand extends BushCommand { public constructor() { @@ -10,7 +10,7 @@ export default class PingCommand extends BushCommand { usage: ['ping'], examples: ['ping'], slash: true, - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [] }); } diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts index 9ba2a2a..652881b 100644 --- a/src/commands/info/pronouns.ts +++ b/src/commands/info/pronouns.ts @@ -1,5 +1,5 @@ import { BushCommand, 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 PronounsCommand extends BushCommand { public constructor() { @@ -20,7 +20,7 @@ export default class PronounsCommand extends BushCommand { slashType: ApplicationCommandOptionType.User } ], - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [], slash: true }); diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts index 7efd3ce..3295960 100644 --- a/src/commands/info/snowflake.ts +++ b/src/commands/info/snowflake.ts @@ -2,7 +2,7 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } fr import { ApplicationCommandOptionType, Embed, - Permissions, + PermissionFlagsBits, SnowflakeUtil, type DeconstructedSnowflake, type Guild, @@ -29,7 +29,7 @@ export default class SnowflakeCommand extends BushCommand { slashType: ApplicationCommandOptionType.String } ], - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [], slash: true }); diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 2f35770..66eabe1 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -7,7 +7,7 @@ import { type BushSlashMessage, type BushUser } from '#lib'; -import { ActivityType, ApplicationCommandOptionType, Embed, Permissions, UserFlags } from 'discord.js'; +import { ActivityType, ApplicationCommandOptionType, Embed, PermissionFlagsBits, UserFlags } from 'discord.js'; // TODO: Add bot information export default class UserInfoCommand extends BushCommand { @@ -31,7 +31,7 @@ export default class UserInfoCommand extends BushCommand { } ], slash: true, - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [] }); } @@ -58,7 +58,7 @@ export default class UserInfoCommand extends BushCommand { const userEmbed: Embed = new Embed() .setTitle(util.discord.escapeMarkdown(user.tag)) - .setThumbnail(user.displayAvatarURL({ size: 2048, format: 'png' })) + .setThumbnail(user.displayAvatarURL({ size: 2048, extension: 'png' })) .setTimestamp(); // Flags @@ -78,15 +78,15 @@ export default class UserInfoCommand extends BushCommand { Number(user.discriminator) < 10 || client.consts.mappings.maybeNitroDiscrims.includes(user.discriminator) || user.displayAvatarURL()?.endsWith('.gif') || - user.flags?.has(UserFlags.FLAGS.PARTNER) || - user.flags?.has(UserFlags.FLAGS.STAFF) || + user.flags?.has(UserFlags.Partner) || + user.flags?.has(UserFlags.Staff) || member?.avatar // server avatar ) { emojis.push(client.consts.mappings.otherEmojis.Nitro); } if (guild?.ownerId == user.id) emojis.push(client.consts.mappings.otherEmojis.Owner); - else if (member?.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) emojis.push(client.consts.mappings.otherEmojis.Admin); + else if (member?.permissions.has(PermissionFlagsBits.Administrator)) emojis.push(client.consts.mappings.otherEmojis.Admin); if (member?.premiumSinceTimestamp) emojis.push(client.consts.mappings.otherEmojis.Booster); const createdAt = util.timestamp(user.createdAt), @@ -99,7 +99,7 @@ export default class UserInfoCommand extends BushCommand { // General Info const generalInfo = [`**Mention:** <@${user.id}>`, `**ID:** ${user.id}`, `**Created:** ${createdAt} (${createdAtDelta} ago)`]; if (user.accentColor !== null) generalInfo.push(`**Accent Color:** ${user.hexAccentColor}`); - if (user.banner) generalInfo.push(`**Banner:** [link](${user.bannerURL({ format: 'png', size: 4096 })})`); + if (user.banner) generalInfo.push(`**Banner:** [link](${user.bannerURL({ extension: 'png', size: 4096 })})`); const pronouns = await Promise.race([util.getPronounsOf(user), util.sleep(2)]); if (pronouns && typeof pronouns === 'string') generalInfo.push(`**Pronouns:** ${pronouns}`); @@ -173,7 +173,7 @@ export default class UserInfoCommand extends BushCommand { // Important Perms const perms = []; - if (member?.permissions.has(Permissions.FLAGS.ADMINISTRATOR) || guild?.ownerId == user.id) { + if (member?.permissions.has(PermissionFlagsBits.Administrator) || guild?.ownerId == user.id) { perms.push('`Administrator`'); } else if (member?.permissions.toArray().length) { member.permissions.toArray().forEach((permission) => { @@ -184,7 +184,7 @@ export default class UserInfoCommand extends BushCommand { } if (perms.length) userEmbed.addField({ name: '» Important Perms', value: perms.join(' ') }); - if (emojis) userEmbed.setDescription(`\u200B${emojis.join(' ')}`); // zero width space + if (emojis) userEmbed.setDescription(`\u200B${emojis.filter((e) => e).join(' ')}`); // zero width space return userEmbed; } } diff --git a/src/commands/leveling/leaderboard.ts b/src/commands/leveling/leaderboard.ts index 3a00036..eb8b90c 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 { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, PermissionFlagsBits } from 'discord.js'; export default class LeaderboardCommand extends BushCommand { public constructor() { @@ -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(Permissions.FLAGS.MANAGE_GUILD) + message.member?.permissions.has(PermissionFlagsBits.ManageGuild) ? ` 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 18648e8..271c3f6 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 { ApplicationCommandOptionType, MessageAttachment, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, MessageAttachment, PermissionFlagsBits } from 'discord.js'; import got from 'got'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; @@ -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(Permissions.FLAGS.MANAGE_GUILD) + message.member?.permissions.has(PermissionFlagsBits.ManageGuild) ? ` You can toggle features using the \`${util.prefix(message)}features\` command.` : '' }` @@ -96,7 +96,7 @@ export default class LevelCommand extends BushCommand { ctx.fillRect(0, 0, levelCard.width, levelCard.height); // Draw avatar const AVATAR_SIZE = 128; - const avatarBuffer = await got.get(user.displayAvatarURL({ format: 'png', size: AVATAR_SIZE })).buffer(); + const avatarBuffer = await got.get(user.displayAvatarURL({ extension: 'png', size: AVATAR_SIZE })).buffer(); const avatarImage = new canvas.Image(); avatarImage.src = avatarBuffer; const imageTopCoord = levelCard.height / 2 - AVATAR_SIZE / 2; diff --git a/src/commands/leveling/levelRoles.ts b/src/commands/leveling/levelRoles.ts index 115ace1..c15ebcb 100644 --- a/src/commands/leveling/levelRoles.ts +++ b/src/commands/leveling/levelRoles.ts @@ -1,6 +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'; +import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class LevelRolesCommand extends BushCommand { public constructor() { @@ -33,8 +33,8 @@ export default class LevelRolesCommand extends BushCommand { ], slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_ROLES]), - userPermissions: [Permissions.FLAGS.MANAGE_GUILD, Permissions.FLAGS.MANAGE_ROLES] + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageRoles]), + userPermissions: [PermissionFlagsBits.ManageGuild, PermissionFlagsBits.ManageRoles] }); } diff --git a/src/commands/leveling/setLevel.ts b/src/commands/leveling/setLevel.ts index 29f36e0..1016280 100644 --- a/src/commands/leveling/setLevel.ts +++ b/src/commands/leveling/setLevel.ts @@ -1,5 +1,5 @@ import { AllowedMentions, BushCommand, Level, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class SetLevelCommand extends BushCommand { public constructor() { @@ -30,7 +30,7 @@ export default class SetLevelCommand extends BushCommand { slash: true, channel: 'guild', clientPermissions: (m) => util.clientSendAndPermCheck(m), - userPermissions: [Permissions.FLAGS.ADMINISTRATOR] + userPermissions: [PermissionFlagsBits.Administrator] }); } diff --git a/src/commands/leveling/setXp.ts b/src/commands/leveling/setXp.ts index 721f28f..a86c58a 100644 --- a/src/commands/leveling/setXp.ts +++ b/src/commands/leveling/setXp.ts @@ -1,5 +1,5 @@ import { AllowedMentions, BushCommand, Level, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class SetXpCommand extends BushCommand { public constructor() { @@ -31,7 +31,7 @@ export default class SetXpCommand extends BushCommand { slash: true, channel: 'guild', clientPermissions: (m) => util.clientSendAndPermCheck(m), - userPermissions: [Permissions.FLAGS.ADMINISTRATOR] + userPermissions: [PermissionFlagsBits.Administrator] }); } diff --git a/src/commands/moderation/_activePunishments.ts b/src/commands/moderation/_activePunishments.ts index 5b1674c..cffc39f 100644 --- a/src/commands/moderation/_activePunishments.ts +++ b/src/commands/moderation/_activePunishments.ts @@ -38,7 +38,7 @@ // channel: 'guild', // hidden: true, // clientPermissions: (m) => util.clientSendAndPermCheck(m), -// userPermissions: (m) => util.userGuildPermCheck(m, [Permissions.FLAGS.MANAGE_MESSAGES]) +// userPermissions: (m) => util.userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages]) // }); // } // diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index 33f980d..209397c 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -8,7 +8,7 @@ import { type BushSlashMessage, type OptionalArgType } from '#lib'; -import { ApplicationCommandOptionType, Permissions, type User } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits, type User } from 'discord.js'; export default class BanCommand extends BushCommand { public constructor() { @@ -62,8 +62,8 @@ export default class BanCommand extends BushCommand { ], slash: true, channel: 'guild', - clientPermissions: [Permissions.FLAGS.BAN_MEMBERS], - userPermissions: [Permissions.FLAGS.BAN_MEMBERS] + clientPermissions: [PermissionFlagsBits.BanMembers], + userPermissions: [PermissionFlagsBits.BanMembers] }); } diff --git a/src/commands/moderation/block.ts b/src/commands/moderation/block.ts index 0b6458d..20c6e86 100644 --- a/src/commands/moderation/block.ts +++ b/src/commands/moderation/block.ts @@ -11,7 +11,7 @@ import { type OptionalArgType } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class BlockCommand extends BushCommand { public constructor() { @@ -53,8 +53,8 @@ export default class BlockCommand extends BushCommand { ], slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_CHANNELS]), - userPermissions: (m) => util.userGuildPermCheck(m, [Permissions.FLAGS.MANAGE_MESSAGES]) + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageChannels]), + userPermissions: (m) => util.userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages]) }); } diff --git a/src/commands/moderation/evidence.ts b/src/commands/moderation/evidence.ts index 84138f6..d951f3d 100644 --- a/src/commands/moderation/evidence.ts +++ b/src/commands/moderation/evidence.ts @@ -1,7 +1,7 @@ import { BushCommand, ModLog, type BushMessage, type BushSlashMessage } from '#lib'; import { ArgumentGeneratorReturn } from 'discord-akairo'; import { ArgumentTypeCasterReturn } from 'discord-akairo/dist/src/struct/commands/arguments/Argument'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class EvidenceCommand extends BushCommand { public constructor() { @@ -32,7 +32,7 @@ export default class EvidenceCommand extends BushCommand { slash: true, channel: 'guild', clientPermissions: (m) => util.clientSendAndPermCheck(m), - userPermissions: (m) => util.userGuildPermCheck(m, [Permissions.FLAGS.MANAGE_MESSAGES]) + userPermissions: (m) => util.userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages]) }); } diff --git a/src/commands/moderation/hideCase.ts b/src/commands/moderation/hideCase.ts index 2c71119..a59380f 100644 --- a/src/commands/moderation/hideCase.ts +++ b/src/commands/moderation/hideCase.ts @@ -1,5 +1,5 @@ import { BushCommand, ModLog, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class HideCaseCommand extends BushCommand { public constructor() { @@ -21,7 +21,7 @@ export default class HideCaseCommand extends BushCommand { ], slash: true, clientPermissions: (m) => util.clientSendAndPermCheck(m), - userPermissions: (m) => util.userGuildPermCheck(m, [Permissions.FLAGS.MANAGE_MESSAGES]), + userPermissions: (m) => util.userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages]), channel: 'guild' }); } diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts index 4fd6c10..6dfb09b 100644 --- a/src/commands/moderation/kick.ts +++ b/src/commands/moderation/kick.ts @@ -7,7 +7,7 @@ import { type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class KickCommand extends BushCommand { public constructor() { @@ -48,8 +48,8 @@ export default class KickCommand extends BushCommand { } ], slash: true, - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.KICK_MEMBERS]), - userPermissions: [Permissions.FLAGS.KICK_MEMBERS] + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.KickMembers]), + userPermissions: [PermissionFlagsBits.KickMembers] }); } diff --git a/src/commands/moderation/lockdown.ts b/src/commands/moderation/lockdown.ts index ea7c08b..3e4f05b 100644 --- a/src/commands/moderation/lockdown.ts +++ b/src/commands/moderation/lockdown.ts @@ -11,7 +11,7 @@ import { type OptionalArgType } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, ChannelType, Collection, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, ChannelType, Collection, PermissionFlagsBits } from 'discord.js'; export default class LockdownCommand extends BushCommand { public constructor() { @@ -58,8 +58,8 @@ export default class LockdownCommand extends BushCommand { ], slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_CHANNELS]), - userPermissions: [Permissions.FLAGS.MANAGE_CHANNELS] + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageChannels]), + userPermissions: [PermissionFlagsBits.ManageChannels] }); } @@ -71,7 +71,6 @@ export default class LockdownCommand extends BushCommand { all: ArgType<'boolean'>; } ) { - client.console.debug('lockdown command'); return await LockdownCommand.lockdownOrUnlockdown(message, args, 'lockdown'); } diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts index d6ecc37..6b8ae2d 100644 --- a/src/commands/moderation/modlog.ts +++ b/src/commands/moderation/modlog.ts @@ -1,5 +1,5 @@ import { BushCommand, ButtonPaginator, ModLog, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, Embed, Permissions, User } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, PermissionFlagsBits, User } from 'discord.js'; export default class ModlogCommand extends BushCommand { public constructor() { @@ -31,7 +31,7 @@ export default class ModlogCommand extends BushCommand { ], slash: true, clientPermissions: (m) => util.clientSendAndPermCheck(m), - userPermissions: (m) => util.userGuildPermCheck(m, [Permissions.FLAGS.MANAGE_MESSAGES]) + userPermissions: (m) => util.userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages]) }); } diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts index ea935ce..c97ceb7 100644 --- a/src/commands/moderation/mute.ts +++ b/src/commands/moderation/mute.ts @@ -9,7 +9,7 @@ import { type OptionalArgType } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class MuteCommand extends BushCommand { public constructor() { @@ -51,8 +51,8 @@ export default class MuteCommand extends BushCommand { ], slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_ROLES]), - userPermissions: (m) => util.userGuildPermCheck(m, [Permissions.FLAGS.MANAGE_MESSAGES]) + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageRoles]), + userPermissions: (m) => util.userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages]) }); } diff --git a/src/commands/moderation/purge.ts b/src/commands/moderation/purge.ts index b48f997..c882b7f 100644 --- a/src/commands/moderation/purge.ts +++ b/src/commands/moderation/purge.ts @@ -1,6 +1,6 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, Collection, Permissions, type Snowflake } from 'discord.js'; +import { ApplicationCommandOptionType, Collection, PermissionFlagsBits, type Snowflake } from 'discord.js'; export default class PurgeCommand extends BushCommand { public constructor() { @@ -43,8 +43,8 @@ export default class PurgeCommand extends BushCommand { ], slash: true, clientPermissions: (m) => - util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_MESSAGES, Permissions.FLAGS.EMBED_LINKS], true), - userPermissions: [Permissions.FLAGS.MANAGE_MESSAGES], + util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageMessages, PermissionFlagsBits.EmbedLinks], true), + userPermissions: [PermissionFlagsBits.ManageMessages], channel: 'guild' }); } diff --git a/src/commands/moderation/removeReactionEmoji.ts b/src/commands/moderation/removeReactionEmoji.ts index 61759ae..092b8ac 100644 --- a/src/commands/moderation/removeReactionEmoji.ts +++ b/src/commands/moderation/removeReactionEmoji.ts @@ -1,6 +1,6 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, Message, Permissions, type Emoji } from 'discord.js'; +import { ApplicationCommandOptionType, Message, PermissionFlagsBits, type Emoji } from 'discord.js'; export default class RemoveReactionEmojiCommand extends BushCommand { public constructor() { @@ -33,8 +33,8 @@ export default class RemoveReactionEmojiCommand extends BushCommand { slash: true, channel: 'guild', clientPermissions: (m) => - util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_MESSAGES, Permissions.FLAGS.EMBED_LINKS], true), - userPermissions: [Permissions.FLAGS.MANAGE_MESSAGES, Permissions.FLAGS.MANAGE_EMOJIS_AND_STICKERS] // Can't undo the removal of 1000s of reactions + util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageMessages, PermissionFlagsBits.EmbedLinks], true), + userPermissions: [PermissionFlagsBits.ManageMessages, PermissionFlagsBits.ManageEmojisAndStickers] // Can't undo the removal of 1000s of reactions }); } diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts index 0d4d91b..b76795b 100644 --- a/src/commands/moderation/role.ts +++ b/src/commands/moderation/role.ts @@ -9,7 +9,7 @@ import { type OptionalArgType } from '#lib'; import { type ArgumentOptions, type Flag } from 'discord-akairo'; -import { ApplicationCommandOptionType, Permissions, type Snowflake } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits, type Snowflake } from 'discord.js'; export default class RoleCommand extends BushCommand { public constructor() { @@ -61,7 +61,7 @@ export default class RoleCommand extends BushCommand { channel: 'guild', typing: true, clientPermissions: (m) => - util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_ROLES, Permissions.FLAGS.EMBED_LINKS], true), + util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageRoles, PermissionFlagsBits.EmbedLinks], true), userPermissions: [] }); } @@ -130,7 +130,7 @@ export default class RoleCommand extends BushCommand { if (!args.role) return await message.util.reply(`${util.emojis.error} You must specify a role.`); if (args.duration === null) args.duration = 0; if ( - !message.member!.permissions.has(Permissions.FLAGS.MANAGE_ROLES) && + !message.member!.permissions.has(PermissionFlagsBits.ManageRoles) && message.member!.id !== message.guild?.ownerId && !message.member!.user.isOwner() ) { diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts index 96c3881..fb446d1 100644 --- a/src/commands/moderation/slowmode.ts +++ b/src/commands/moderation/slowmode.ts @@ -1,6 +1,6 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; import { Argument } from 'discord-akairo'; -import { ApplicationCommandOptionType, ChannelType, Permissions, type TextChannel, type ThreadChannel } from 'discord.js'; +import { ApplicationCommandOptionType, ChannelType, PermissionFlagsBits, type TextChannel, type ThreadChannel } from 'discord.js'; export default class SlowmodeCommand extends BushCommand { public constructor() { @@ -35,8 +35,8 @@ export default class SlowmodeCommand extends BushCommand { slash: true, channel: 'guild', clientPermissions: (m) => - util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_CHANNELS, Permissions.FLAGS.EMBED_LINKS], true), - userPermissions: (m) => util.userGuildPermCheck(m, [Permissions.FLAGS.MANAGE_MESSAGES]) + util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageChannels, PermissionFlagsBits.EmbedLinks], true), + userPermissions: (m) => util.userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages]) }); } diff --git a/src/commands/moderation/timeout.ts b/src/commands/moderation/timeout.ts index 73b9d50..32fcf76 100644 --- a/src/commands/moderation/timeout.ts +++ b/src/commands/moderation/timeout.ts @@ -8,7 +8,7 @@ import { type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class TimeoutCommand extends BushCommand { public constructor() { @@ -49,8 +49,8 @@ export default class TimeoutCommand extends BushCommand { ], slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.MODERATE_MEMBERS]), - userPermissions: [Permissions.FLAGS.MODERATE_MEMBERS] + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ModerateMembers]), + userPermissions: [PermissionFlagsBits.ModerateMembers] }); } diff --git a/src/commands/moderation/unban.ts b/src/commands/moderation/unban.ts index b2bdd72..7bdb32e 100644 --- a/src/commands/moderation/unban.ts +++ b/src/commands/moderation/unban.ts @@ -7,7 +7,7 @@ import { type BushSlashMessage, type OptionalArgType } from '#lib'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class UnbanCommand extends BushCommand { public constructor() { @@ -39,8 +39,8 @@ export default class UnbanCommand extends BushCommand { ], slash: true, channel: 'guild', - clientPermissions: [Permissions.FLAGS.BAN_MEMBERS], - userPermissions: [Permissions.FLAGS.BAN_MEMBERS] + clientPermissions: [PermissionFlagsBits.BanMembers], + userPermissions: [PermissionFlagsBits.BanMembers] }); } diff --git a/src/commands/moderation/unblock.ts b/src/commands/moderation/unblock.ts index 1abf2be..7d36e15 100644 --- a/src/commands/moderation/unblock.ts +++ b/src/commands/moderation/unblock.ts @@ -11,7 +11,7 @@ import { type OptionalArgType } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class UnblockCommand extends BushCommand { public constructor() { @@ -53,8 +53,8 @@ export default class UnblockCommand extends BushCommand { ], slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_CHANNELS]), - userPermissions: (m) => util.userGuildPermCheck(m, [Permissions.FLAGS.MANAGE_MESSAGES]) + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageChannels]), + userPermissions: (m) => util.userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages]) }); } diff --git a/src/commands/moderation/unlockdown.ts b/src/commands/moderation/unlockdown.ts index ea36b67..4694518 100644 --- a/src/commands/moderation/unlockdown.ts +++ b/src/commands/moderation/unlockdown.ts @@ -1,6 +1,6 @@ import { LockdownCommand } from '#commands'; import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage, type OptionalArgType } from '#lib'; -import { ApplicationCommandOptionType, ChannelType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, ChannelType, PermissionFlagsBits } from 'discord.js'; export default class UnlockdownCommand extends BushCommand { public constructor() { @@ -47,8 +47,8 @@ export default class UnlockdownCommand extends BushCommand { ], slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_CHANNELS]), - userPermissions: [Permissions.FLAGS.MANAGE_CHANNELS] + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageChannels]), + userPermissions: [PermissionFlagsBits.ManageChannels] }); } diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts index 9974b8d..fb4bb55 100644 --- a/src/commands/moderation/unmute.ts +++ b/src/commands/moderation/unmute.ts @@ -9,7 +9,7 @@ import { type BushSlashMessage, type OptionalArgType } from '#lib'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class UnmuteCommand extends BushCommand { public constructor() { @@ -51,8 +51,8 @@ export default class UnmuteCommand extends BushCommand { ], slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_ROLES]), - userPermissions: (m) => util.userGuildPermCheck(m, [Permissions.FLAGS.MANAGE_MESSAGES]) + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageRoles]), + userPermissions: (m) => util.userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages]) }); } diff --git a/src/commands/moderation/untimeout.ts b/src/commands/moderation/untimeout.ts index 6ebd777..6d3632d 100644 --- a/src/commands/moderation/untimeout.ts +++ b/src/commands/moderation/untimeout.ts @@ -9,7 +9,7 @@ import { type OptionalArgType } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class UntimeoutCommand extends BushCommand { public constructor() { @@ -51,8 +51,8 @@ export default class UntimeoutCommand extends BushCommand { ], slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.MODERATE_MEMBERS]), - userPermissions: [Permissions.FLAGS.MODERATE_MEMBERS] + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ModerateMembers]), + userPermissions: [PermissionFlagsBits.ModerateMembers] }); } diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts index af45782..27d04b3 100644 --- a/src/commands/moderation/warn.ts +++ b/src/commands/moderation/warn.ts @@ -9,7 +9,7 @@ import { type BushSlashMessage, type OptionalArgType } from '#lib'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class WarnCommand extends BushCommand { public constructor() { @@ -51,7 +51,7 @@ export default class WarnCommand extends BushCommand { slash: true, channel: 'guild', clientPermissions: (m) => util.clientSendAndPermCheck(m), - userPermissions: (m) => util.userGuildPermCheck(m, [Permissions.FLAGS.MANAGE_MESSAGES]) + userPermissions: (m) => util.userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages]) }); } diff --git a/src/commands/moulberry-bush/capePermissions.ts b/src/commands/moulberry-bush/capePermissions.ts index 7f261d5..e568036 100644 --- a/src/commands/moulberry-bush/capePermissions.ts +++ b/src/commands/moulberry-bush/capePermissions.ts @@ -1,5 +1,5 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, PermissionFlagsBits } from 'discord.js'; import got from 'got'; export default class CapePermissionsCommand extends BushCommand { @@ -21,7 +21,7 @@ export default class CapePermissionsCommand extends BushCommand { } ], slash: true, - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [], channel: 'guild' }); diff --git a/src/commands/moulberry-bush/capes.ts b/src/commands/moulberry-bush/capes.ts index 7965713..8c080e3 100644 --- a/src/commands/moulberry-bush/capes.ts +++ b/src/commands/moulberry-bush/capes.ts @@ -1,7 +1,7 @@ import { BushCommand, ButtonPaginator, DeleteButton, type BushMessage, type OptionalArgType } from '#lib'; import assert from 'assert'; import { APIEmbed } from 'discord-api-types'; -import { ApplicationCommandOptionType, AutocompleteInteraction, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, AutocompleteInteraction, PermissionFlagsBits } from 'discord.js'; import Fuse from 'fuse.js'; import got from 'got'; @@ -29,7 +29,7 @@ export default class CapesCommand extends BushCommand { } ], slash: true, - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [] }); } diff --git a/src/commands/moulberry-bush/giveawayPing.ts b/src/commands/moulberry-bush/giveawayPing.ts index dbbb613..dd305c6 100644 --- a/src/commands/moulberry-bush/giveawayPing.ts +++ b/src/commands/moulberry-bush/giveawayPing.ts @@ -1,5 +1,5 @@ import { AllowedMentions, BushCommand, type BushMessage } from '#lib'; -import { Permissions } from 'discord.js'; +import { PermissionFlagsBits } from 'discord.js'; export default class GiveawayPingCommand extends BushCommand { public constructor() { @@ -9,13 +9,13 @@ export default class GiveawayPingCommand extends BushCommand { description: 'Pings the giveaway role.', usage: ['giveaway-ping'], examples: ['giveaway-ping'], - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_MESSAGES], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageMessages], true), userPermissions: [ - Permissions.FLAGS.MANAGE_GUILD, - Permissions.FLAGS.MANAGE_MESSAGES, - Permissions.FLAGS.BAN_MEMBERS, - Permissions.FLAGS.KICK_MEMBERS, - Permissions.FLAGS.VIEW_CHANNEL + PermissionFlagsBits.ManageGuild, + PermissionFlagsBits.ManageMessages, + PermissionFlagsBits.BanMembers, + PermissionFlagsBits.KickMembers, + PermissionFlagsBits.ViewChannel ], channel: 'guild', ignoreCooldown: [], @@ -29,8 +29,8 @@ export default class GiveawayPingCommand extends BushCommand { } public override async exec(message: BushMessage) { - if (!message.member!.permissions.has(Permissions.FLAGS.MANAGE_GUILD) && !message.member!.user.isOwner()) - await message.util.reply(`${util.emojis.error} You are missing the **MANAGE_GUILD** permission.`); + if (!message.member!.permissions.has(PermissionFlagsBits.ManageGuild) && !message.member!.user.isOwner()) + await message.util.reply(`${util.emojis.error} You are missing the **ManageGuild** permission.`); await message.delete().catch(() => {}); diff --git a/src/commands/moulberry-bush/moulHammer.ts b/src/commands/moulberry-bush/moulHammer.ts index 6aa5ca3..9a16545 100644 --- a/src/commands/moulberry-bush/moulHammer.ts +++ b/src/commands/moulberry-bush/moulHammer.ts @@ -1,5 +1,5 @@ import { BushCommand, 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 MoulHammerCommand extends BushCommand { public constructor() { @@ -22,7 +22,7 @@ export default class MoulHammerCommand extends BushCommand { slash: true, slashGuilds: ['516977525906341928'], restrictedGuilds: ['516977525906341928'], - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [] }); } diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index a2a18ef..7b3e729 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -1,6 +1,6 @@ import { AllowedMentions, BushCommand, type ArgType, type BushMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, PermissionFlagsBits } from 'discord.js'; import moment from 'moment'; assert(moment); @@ -34,7 +34,7 @@ export default class ReportCommand extends BushCommand { } ], slash: true, - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [], channel: 'guild' }); diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index dfb65f3..5eb2b98 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -1,5 +1,5 @@ import { AllowedMentions, BushCommand, BushSlashMessage, type BushMessage, type OptionalArgType } from '#lib'; -import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, PermissionFlagsBits } from 'discord.js'; const rules = [ { @@ -85,7 +85,7 @@ export default class RuleCommand extends BushCommand { slash: true, slashGuilds: ['516977525906341928'], channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [], restrictedGuilds: ['516977525906341928'] }); diff --git a/src/commands/moulberry-bush/serverStatus.ts b/src/commands/moulberry-bush/serverStatus.ts index 435b99e..35240f9 100644 --- a/src/commands/moulberry-bush/serverStatus.ts +++ b/src/commands/moulberry-bush/serverStatus.ts @@ -1,6 +1,6 @@ import { BushCommand, type BushMessage } from '#lib'; import assert from 'assert'; -import { Embed, Permissions } from 'discord.js'; +import { Embed, PermissionFlagsBits } from 'discord.js'; import got from 'got'; assert(got); @@ -13,7 +13,7 @@ export default class ServerStatusCommand extends BushCommand { description: "Gives the status of moulberry's server", usage: ['server-status'], examples: ['server-status', 'ss'], - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [], slash: true }); diff --git a/src/commands/utilities/activity.ts b/src/commands/utilities/activity.ts index 5a56978..52cad26 100644 --- a/src/commands/utilities/activity.ts +++ b/src/commands/utilities/activity.ts @@ -163,10 +163,9 @@ export default class ActivityCommand extends BushCommand { : activityTypeCaster(message, args.activity); let response: string; - const invite = await (<any>client).api - .channels(channel.id) - .invites.post({ - data: { + const invite: any = await client.rest + .post(`/channels/${channel.id}/invites`, { + body: { validate: null, max_age: 604800, max_uses: 0, @@ -175,6 +174,7 @@ export default class ActivityCommand extends BushCommand { temporary: false } }) + .catch((e: Error | DiscordAPIError) => { if ((e as DiscordAPIError)?.code === 50013) { response = `${util.emojis.error} I am missing permissions to make an invite in that channel.`; diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts index 2df70b7..ffc121c 100644 --- a/src/commands/utilities/price.ts +++ b/src/commands/utilities/price.ts @@ -1,6 +1,6 @@ import { BushCommand, type BushMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, AutocompleteInteraction, Embed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, AutocompleteInteraction, Embed, PermissionFlagsBits } from 'discord.js'; import Fuse from 'fuse.js'; import got from 'got'; @@ -39,7 +39,7 @@ export default class PriceCommand extends BushCommand { } ], slash: true, - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [], typing: true }); diff --git a/src/commands/utilities/reminders.ts b/src/commands/utilities/reminders.ts index 369a1a5..509da67 100644 --- a/src/commands/utilities/reminders.ts +++ b/src/commands/utilities/reminders.ts @@ -1,7 +1,7 @@ import { BushCommand, ButtonPaginator, Reminder, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; import { APIEmbed } from 'discord-api-types'; -import { Permissions } from 'discord.js'; +import { PermissionFlagsBits } from 'discord.js'; import { Op } from 'sequelize'; assert(Op); @@ -15,7 +15,7 @@ export default class RemindersCommand extends BushCommand { usage: ['reminder'], examples: ['reminders'], slash: true, - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS]), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks]), userPermissions: [] }); } diff --git a/src/commands/utilities/steal.ts b/src/commands/utilities/steal.ts index a963746..820fa89 100644 --- a/src/commands/utilities/steal.ts +++ b/src/commands/utilities/steal.ts @@ -1,7 +1,7 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; import { type ArgumentOptions, type ArgumentType, type ArgumentTypeCaster, type Flag } from 'discord-akairo'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; import _ from 'lodash'; import { URL } from 'url'; @@ -39,8 +39,8 @@ export default class StealCommand extends BushCommand { ], slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_EMOJIS_AND_STICKERS]), - userPermissions: [Permissions.FLAGS.MANAGE_EMOJIS_AND_STICKERS] + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageEmojisAndStickers]), + userPermissions: [PermissionFlagsBits.ManageEmojisAndStickers] }); } diff --git a/src/commands/utilities/viewRaw.ts b/src/commands/utilities/viewRaw.ts index fc50e31..ee57e2d 100644 --- a/src/commands/utilities/viewRaw.ts +++ b/src/commands/utilities/viewRaw.ts @@ -7,7 +7,7 @@ import { type BushTextChannel, type OptionalArgType } from '#lib'; -import { ApplicationCommandOptionType, ChannelType, Embed, Message, Permissions, type Snowflake } from 'discord.js'; +import { ApplicationCommandOptionType, ChannelType, Embed, Message, PermissionFlagsBits, type Snowflake } from 'discord.js'; export default class ViewRawCommand extends BushCommand { public constructor() { @@ -65,7 +65,7 @@ export default class ViewRawCommand extends BushCommand { ], slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true), + clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [] }); } |