diff options
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/config/prefix.ts (renamed from src/commands/server-config/prefix.ts) | 4 | ||||
-rw-r--r-- | src/commands/dev/eval.ts | 144 | ||||
-rw-r--r-- | src/commands/dev/reload.ts | 4 | ||||
-rw-r--r-- | src/commands/dev/setLevel.ts | 2 | ||||
-rw-r--r-- | src/commands/info/help.ts | 2 | ||||
-rw-r--r-- | src/commands/info/ping.ts | 2 | ||||
-rw-r--r-- | src/commands/info/pronouns.ts | 2 | ||||
-rw-r--r-- | src/commands/moderation/ban.ts | 12 | ||||
-rw-r--r-- | src/commands/moderation/kick.ts | 10 | ||||
-rw-r--r-- | src/commands/moderation/role.ts | 22 | ||||
-rw-r--r-- | src/commands/moulberry-bush/capePerms.ts | 13 | ||||
-rw-r--r-- | src/commands/moulberry-bush/giveawayPing.ts | 7 | ||||
-rw-r--r-- | src/commands/moulberry-bush/rule.ts | 8 |
13 files changed, 136 insertions, 96 deletions
diff --git a/src/commands/server-config/prefix.ts b/src/commands/config/prefix.ts index 9cdc331..c20cfa5 100644 --- a/src/commands/server-config/prefix.ts +++ b/src/commands/config/prefix.ts @@ -1,15 +1,15 @@ import { ApplicationCommandOptionType } from 'discord-api-types'; import { Guild as DiscordGuild, Message } from 'discord.js'; +import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; import { BushCommand } from '../../lib/extensions/BushCommand'; import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; -import { SlashCommandOption } from '../../lib/extensions/Util'; import { Guild } from '../../lib/models'; export default class PrefixCommand extends BushCommand { constructor() { super('prefix', { aliases: ['prefix'], - category: 'server config', + category: 'config', args: [ { id: 'prefix' diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index 2f1d45d..8bf88ff 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -1,16 +1,20 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ import { exec } from 'child_process'; import { Constants } from 'discord-akairo'; -import { Message, MessageEmbed, MessageEmbedOptions, Util } from 'discord.js'; +import { CommandInteraction, MessageEmbed, MessageEmbedOptions, Util } from 'discord.js'; import { transpile } from 'typescript'; import { inspect, promisify } from 'util'; import { BushCommand } from '../../lib/extensions/BushCommand'; +import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; +import { BushMessage } from '../../lib/extensions/BushMessage'; const clean = (text) => { if (typeof text === 'string') { return (text = Util.cleanCodeBlockContent(text)); } else return text; }; +const sh = promisify(exec); + export default class EvalCommand extends BushCommand { public constructor() { super('eval', { @@ -23,7 +27,7 @@ export default class EvalCommand extends BushCommand { }, args: [ { - id: 'selDepth', + id: 'sel_depth', match: Constants.ArgumentMatches.OPTION, type: Constants.ArgumentTypes.NUMBER, flag: '--depth', @@ -35,7 +39,7 @@ export default class EvalCommand extends BushCommand { flag: '--sudo' }, { - id: 'deleteMSG', + id: 'delete_msg', match: Constants.ArgumentMatches.FLAG, flag: '--delete' }, @@ -55,7 +59,7 @@ export default class EvalCommand extends BushCommand { flag: '--hidden' }, { - id: 'showProto', + id: 'show_proto', match: Constants.ArgumentMatches.FLAG, flag: '--proto' }, @@ -70,62 +74,99 @@ export default class EvalCommand extends BushCommand { } ], ownerOnly: true, - clientPermissions: ['EMBED_LINKS'] + slash: true, + slashOptions: [ + { + name: 'code', + description: 'The code you would like to evaluate.', + type: 'STRING', + required: true + }, + { + name: 'sel_depth', + description: 'How deep to display the output.', + type: 'INTEGER', + required: false + }, + { + name: 'sudo', + description: 'Whether or not to override checks.', + type: 'BOOLEAN', + required: false + }, + { + name: 'silent', + description: 'Whether or not to make the response silent', + type: 'BOOLEAN', + required: false + }, + { + name: 'typescript', + description: 'Whether or not to compile the code from typescript.', + type: 'BOOLEAN', + required: false + }, + { + name: 'hidden', + description: 'Whether or not to show hidden items.', + type: 'BOOLEAN', + required: false + }, + { + name: 'show_proto', + description: 'Show prototype.', + type: 'BOOLEAN', + required: false + } + ] }); } - private redactCredentials(old: string) { - const mapping = { - ['token']: 'Token', - ['devToken']: 'Dev Token', - ['MongoDB']: 'MongoDB URI', - ['hypixelApiKey']: 'Hypixel Api Key', - ['webhookID']: 'Webhook ID', - ['webhookToken']: 'Webhook Token' - }; - return mapping[old] || old; - } - public async exec( - message: Message, - { - selDepth, - code: codeArg, - sudo, - silent, - deleteMSG, - typescript, - hidden, - showProto - }: { - selDepth: number; + message: BushMessage | BushInteractionMessage, + args: { + sel_depth: number; code: string; sudo: boolean; silent: boolean; deleteMSG: boolean; typescript: boolean; hidden: boolean; - showProto: boolean; + show_proto: boolean; } ): Promise<unknown> { if (!this.client.config.owners.includes(message.author.id)) - return await message.channel.send(`${this.client.util.emojis.error} Only my developers can run this command.`); + return await message.util.reply(`${this.client.util.emojis.error} Only my developers can run this command.`); + if (message.util.isSlash) { + await (message as BushInteractionMessage).interaction.defer({ ephemeral: args.silent }); + } + const code: { js?: string | null; ts?: string | null; lang?: 'js' | 'ts' } = {}; - codeArg = codeArg.replace(/[“”]/g, '"'); - codeArg = codeArg.replace(/```/g, ''); - if (typescript) { - code.ts = codeArg; - code.js = transpile(codeArg); + args.code = args.code.replace(/[“”]/g, '"'); + args.code = args.code.replace(/```/g, ''); + if (args.typescript) { + code.ts = args.code; + code.js = transpile(args.code); code.lang = 'ts'; } else { code.ts = null; - code.js = codeArg; + code.js = args.code; code.lang = 'js'; } const embed: MessageEmbed = new MessageEmbed(); const bad_phrases: string[] = ['delete', 'destroy']; - if (bad_phrases.some((p) => code[code.lang].includes(p)) && !sudo) { + + function ae(old: string) { + const mapping = { + ['token']: 'Token', + ['devToken']: 'Dev Token', + ['hypixelApiKey']: 'Hypixel Api Key' + }; + return mapping[old] || old; + } + + if (bad_phrases.some((p) => code[code.lang].includes(p)) && !args.sudo) { return await message.util.send(`${this.client.util.emojis.error} This eval was blocked by smooth brain protection™.`); } const embeds: (MessageEmbed | MessageEmbedOptions)[] = [new MessageEmbed()]; @@ -140,10 +181,7 @@ export default class EvalCommand extends BushCommand { channel = message.channel, config = this.client.config, members = message.guild.members, - roles = message.guild.roles, - sh = promisify(exec), - models = this.client.db.models, - got = require('got'); // eslint-disable-line @typescript-eslint/no-var-requires + roles = message.guild.roles; if (code[code.lang].replace(/ /g, '').includes('9+10' || '10+9')) { output = 21; } else { @@ -151,15 +189,15 @@ export default class EvalCommand extends BushCommand { output = await output; } let proto, outputProto; - if (showProto) { + if (args.show_proto) { proto = Object.getPrototypeOf(output); outputProto = clean(inspect(proto, { depth: 1, getters: true, showHidden: true })); } if (typeof output !== 'string') - output = inspect(output, { depth: selDepth, showHidden: hidden, getters: true, showProxy: true }); + output = inspect(output, { depth: args.sel_depth || 0, showHidden: args.hidden, getters: true, showProxy: true }); for (const credentialName in this.client.config.credentials) { const credential = this.client.config.credentials[credentialName]; - const newCredential = this.redactCredentials(credentialName); + const newCredential = ae(credentialName); output = output.replace( new RegExp(credential.toString().replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), `[${newCredential} Omitted]` @@ -187,7 +225,7 @@ export default class EvalCommand extends BushCommand { embed.addField('📥 Input', await this.client.util.codeblock(inputJS, 1024, 'js')); } embed.addField('📤 Output', await this.client.util.codeblock(output, 1024, 'js')); - if (showProto) embed.addField('⚙️ Proto', await this.client.util.codeblock(outputProto, 1024, 'js')); + if (args.show_proto) embed.addField('⚙️ Proto', await this.client.util.codeblock(outputProto, 1024, 'js')); } catch (e) { const inputJS = clean(code.js); embed @@ -205,19 +243,21 @@ export default class EvalCommand extends BushCommand { } embed.addField('📤 Output', await this.client.util.codeblock(e?.stack, 1024, 'js')); } - if (!silent) { - await message.util.reply({ embeds: [embed] }); + if (!args.silent && !message.util.isSlash) { + await message.util.reply({ embeds: [embed], ephemeral: args.silent }); + } else if (message.util.isSlash) { + await (message.interaction as CommandInteraction).editReply({ embeds: [embed] }); } else { try { await message.author.send({ embeds: [embed] }); - if (!deleteMSG) await message.react(this.client.util.emojis.successFull); + if (!args.deleteMSG) await (message as BushMessage).react(this.client.util.emojis.successFull); } catch (e) { - if (!deleteMSG) await message.react(this.client.util.emojis.errorFull); + if (!args.deleteMSG) await (message as BushMessage).react(this.client.util.emojis.errorFull); } } - if (deleteMSG && message.deletable) { - await message.delete(); + if (args.deleteMSG && (message as BushMessage).deletable) { + await (message as BushMessage).delete(); } } } diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts index 3194ce2..82a98a0 100644 --- a/src/commands/dev/reload.ts +++ b/src/commands/dev/reload.ts @@ -1,9 +1,9 @@ import { stripIndent } from 'common-tags'; import { ApplicationCommandOptionType } from 'discord-api-types'; import { Message } from 'discord.js'; +import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; import { BushCommand } from '../../lib/extensions/BushCommand'; import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; -import { SlashCommandOption } from '../../lib/extensions/Util'; export default class ReloadCommand extends BushCommand { constructor() { @@ -28,7 +28,7 @@ export default class ReloadCommand extends BushCommand { { type: ApplicationCommandOptionType.BOOLEAN, name: 'fast', - description: 'Wheather to use esbuild for fast compiling or not', + description: 'Whether to use esbuild for fast compiling or not', required: false } ] diff --git a/src/commands/dev/setLevel.ts b/src/commands/dev/setLevel.ts index 7401699..4f97528 100644 --- a/src/commands/dev/setLevel.ts +++ b/src/commands/dev/setLevel.ts @@ -1,8 +1,8 @@ import { ApplicationCommandOptionType } from 'discord-api-types'; import { Message, User } from 'discord.js'; +import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; import { BushCommand } from '../../lib/extensions/BushCommand'; import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; -import { SlashCommandOption } from '../../lib/extensions/Util'; import { Level } from '../../lib/models'; import AllowedMentions from '../../lib/utils/AllowedMentions'; diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index 317091e..8dac8ee 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -1,9 +1,9 @@ import { stripIndent } from 'common-tags'; import { ApplicationCommandOptionType } from 'discord-api-types'; import { Message, MessageEmbed } from 'discord.js'; +import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; import { BushCommand } from '../../lib/extensions/BushCommand'; import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; -import { SlashCommandOption } from '../../lib/extensions/Util'; export default class HelpCommand extends BushCommand { constructor() { diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts index feb48ad..f0d017e 100644 --- a/src/commands/info/ping.ts +++ b/src/commands/info/ping.ts @@ -16,7 +16,7 @@ export default class PingCommand extends BushCommand { } public async exec(message: Message): Promise<void> { - const sentMessage = await message.util.send('Pong!'); + const sentMessage = await message.util.send('Pong!') as Message; const timestamp: number = message.editedTimestamp ? message.editedTimestamp : message.createdTimestamp; const botLatency = `\`\`\`\n ${Math.floor(sentMessage.createdTimestamp - timestamp)}ms \`\`\``; const apiLatency = `\`\`\`\n ${Math.round(message.client.ws.ping)}ms \`\`\``; diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts index faf3aa2..bade100 100644 --- a/src/commands/info/pronouns.ts +++ b/src/commands/info/pronouns.ts @@ -1,9 +1,9 @@ import { ApplicationCommandOptionType } from 'discord-api-types'; import { CommandInteraction, Message, MessageEmbed, User } from 'discord.js'; import got, { HTTPError } from 'got'; +import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; import { BushCommand } from '../../lib/extensions/BushCommand'; import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; -import { SlashCommandOption } from '../../lib/extensions/Util'; export const pronounMapping = { unspecified: 'Unspecified', diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index f843ac4..4847d19 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -1,9 +1,9 @@ import { ApplicationCommandOptionType } from 'discord-api-types'; import { CommandInteraction, Message, User } from 'discord.js'; import moment from 'moment'; +import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; import { BushCommand } from '../../lib/extensions/BushCommand'; import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; -import { SlashCommandOption } from '../../lib/extensions/Util'; import { Ban, Guild, Modlog, ModlogType } from '../../lib/models'; const durationAliases: Record<string, string[]> = { @@ -133,8 +133,8 @@ export default class BanCommand extends BushCommand { await modlogEnry.save(); await banEntry.save(); } catch (e) { - console.error(e); - yield 'Error saving to database. Please report this to a developer.'; + this.client.console.error(`BanCommand`, `Error saving to database. ${e?.stack}`); + yield `${this.client.util.emojis.error} Error saving to database. Please report this to a developer.`; return; } try { @@ -144,18 +144,18 @@ export default class BanCommand extends BushCommand { } with reason \`${reason || 'No reason given'}\`` ); } catch (e) { - yield 'Error sending message to user'; + yield `${this.client.util.emojis.warn} Unable to dm user`; } await message.guild.members.ban(user, { reason: `Banned by ${message instanceof CommandInteraction ? message.user.tag : message.author.tag} with ${ reason ? `reason ${reason}` : 'no reason' }` }); - yield `Banned <@!${user.id}> ${ + yield `${this.client.util.emojis.success} Banned <@!${user.id}> ${ translatedTime.length >= 1 ? `for ${translatedTime.join(', ')}` : 'permanently' } with reason \`${reason || 'No reason given'}\``; } catch { - yield 'Error banning :/'; + yield `${this.client.util.emojis.error} Error banning :/`; await banEntry.destroy(); await modlogEnry.destroy(); return; diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts index eed0122..7bd53e0 100644 --- a/src/commands/moderation/kick.ts +++ b/src/commands/moderation/kick.ts @@ -71,14 +71,14 @@ export default class KickCommand extends BushCommand { }); await modlogEnry.save(); } catch (e) { - console.error(e); - yield 'Error saving to database. Please report this to a developer.'; + this.client.console.error(`BanCommand`, `Error saving to database. ${e?.stack}`); + yield `${this.client.util.emojis.error} Error saving to database. Please report this to a developer.`; return; } try { await user.send(`You were kicked in ${message.guild.name} with reason \`${reason || 'No reason given'}\``); } catch (e) { - yield 'Error sending message to user'; + yield `${this.client.util.emojis.warn} Unable to dm user`; } try { await user.kick( @@ -87,11 +87,11 @@ export default class KickCommand extends BushCommand { }` ); } catch { - yield 'Error kicking :/'; + yield `${this.client.util.emojis.error} Error kicking :/`; await modlogEnry.destroy(); return; } - yield `Kicked <@!${user.id}> with reason \`${reason || 'No reason given'}\``; + yield `${this.client.util.emojis.success} Kicked <@!${user.id}> with reason \`${reason || 'No reason given'}\``; } async exec(message: Message, { user, reason }: { user: GuildMember; reason?: string }): Promise<void> { diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts index 8951560..1b82245 100644 --- a/src/commands/moderation/role.ts +++ b/src/commands/moderation/role.ts @@ -43,7 +43,7 @@ export default class RoleCommand extends BushCommand { type: 'member', prompt: { start: `What user do you want to add/remove the role on?`, - retry: `<:error:837123021016924261> Choose a valid user to add/remove the role on.` + retry: `{error} Choose a valid user to add/remove the role on.` } }, { @@ -52,7 +52,7 @@ export default class RoleCommand extends BushCommand { match: 'restContent', prompt: { start: `What role do you want to add/remove?`, - retry: `<:error:837123021016924261> Choose a valid role to add/remove.` + retry: `{error} Choose a valid role to add/remove.` } } ], @@ -78,7 +78,7 @@ export default class RoleCommand extends BushCommand { const mappedRole = this.client.util.moulberryBushRoleMap.find((m) => m.id === role.id); if (!mappedRole || !this.roleWhitelist[mappedRole.name]) { return message.util.reply({ - content: `<:error:837123021016924261> <@&${role.id}> is not whitelisted, and you do not have manage roles permission.`, + content: `${this.client.util.emojis.error} <@&${role.id}> is not whitelisted, and you do not have manage roles permission.`, allowedMentions: AllowedMentions.none() }); } @@ -87,7 +87,7 @@ export default class RoleCommand extends BushCommand { }); if (!message.member.roles.cache.some((role) => allowedRoles.includes(role.id))) { return message.util.reply({ - content: `<:error:837123021016924261> <@&${role.id}> is whitelisted, but you do not have any of the roles required to manage it.`, + content: `${this.client.util.emojis.error} <@&${role.id}> is whitelisted, but you do not have any of the roles required to manage it.`, allowedMentions: AllowedMentions.none() }); } @@ -95,19 +95,19 @@ export default class RoleCommand extends BushCommand { if (!this.client.ownerID.includes(message.author.id)) { if (role.comparePositionTo(message.member.roles.highest) >= 0) { return message.util.reply({ - content: `<:error:837123021016924261> <@&${role.id}> is higher or equal to your highest role.`, + content: `${this.client.util.emojis.error} <@&${role.id}> is higher or equal to your highest role.`, allowedMentions: AllowedMentions.none() }); } if (role.comparePositionTo(message.guild.me.roles.highest) >= 0) { return message.util.reply({ - content: `<:error:837123021016924261> <@&${role.id}> is higher or equal to my highest role.`, + content: `${this.client.util.emojis.error} <@&${role.id}> is higher or equal to my highest role.`, allowedMentions: AllowedMentions.none() }); } if (role.managed) { await message.util.reply({ - content: `<:error:837123021016924261> <@&${role.id}> is managed by an integration and cannot be managed.`, + content: `${this.client.util.emojis.error} <@&${role.id}> is managed by an integration and cannot be managed.`, allowedMentions: AllowedMentions.none() }); } @@ -118,12 +118,12 @@ export default class RoleCommand extends BushCommand { await user.roles.remove(role.id); } catch { return message.util.reply({ - content: `<:error:837123021016924261> Could not remove <@&${role.id}> from <@${user.id}>.`, + content: `${this.client.util.emojis.error} Could not remove <@&${role.id}> from <@${user.id}>.`, allowedMentions: AllowedMentions.none() }); } return message.util.reply({ - content: `<:checkmark:837109864101707807> Successfully removed <@&${role.id}> from <@${user.id}>!`, + content: `${this.client.util.emojis.success} Successfully removed <@&${role.id}> from <@${user.id}>!`, allowedMentions: AllowedMentions.none() }); } else { @@ -131,12 +131,12 @@ export default class RoleCommand extends BushCommand { await user.roles.add(role.id); } catch { return message.util.reply({ - content: `<:error:837123021016924261> Could not add <@&${role.id}> to <@${user.id}>.`, + content: `${this.client.util.emojis.error} Could not add <@&${role.id}> to <@${user.id}>.`, allowedMentions: AllowedMentions.none() }); } return message.util.reply({ - content: `<:checkmark:837109864101707807> Successfully added <@&${role.id}> to <@${user.id}>!`, + content: `${this.client.util.emojis.success} Successfully added <@&${role.id}> to <@${user.id}>!`, allowedMentions: AllowedMentions.none() }); } diff --git a/src/commands/moulberry-bush/capePerms.ts b/src/commands/moulberry-bush/capePerms.ts index 7eb90c5..380ed2d 100644 --- a/src/commands/moulberry-bush/capePerms.ts +++ b/src/commands/moulberry-bush/capePerms.ts @@ -1,9 +1,9 @@ import { ApplicationCommandOptionType } from 'discord-api-types'; import { Message, MessageEmbed } from 'discord.js'; import got from 'got'; +import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; import { BushCommand } from '../../lib/extensions/BushCommand'; import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; -import { SlashCommandOption } from '../../lib/extensions/Util'; interface Capeperms { success: boolean; @@ -57,7 +57,7 @@ export default class CapePermissionsCommand extends BushCommand { type: 'string', prompt: { start: 'Who would you like to see the cape permissions of?', - retry: '<:error:837123021016924261> Choose someone to see the capes their available capes.', + retry: '{error} Choose someone to see the capes their available capes.', optional: false } } @@ -79,7 +79,7 @@ export default class CapePermissionsCommand extends BushCommand { try { uuid = await this.client.util.mcUUID(user); } catch (e) { - return { content: `<:error:837123021016924261> \`${user}\` doesn't appear to be a valid username.` }; + return { content: `${this.client.util.emojis.error} \`${user}\` doesn't appear to be a valid username.` }; } try { @@ -88,11 +88,12 @@ export default class CapePermissionsCommand extends BushCommand { capeperms = null; } if (capeperms == null) { - return { content: `<:error:837123021016924261> There was an error finding cape perms for \`${user}\`.` }; + return { content: `${this.client.util.emojis.error} There was an error finding cape perms for \`${user}\`.` }; } else { if (capeperms?.perms) { const foundUser = capeperms.perms.find((u) => u._id === uuid); - if (foundUser == null) return { content: `<:error:837123021016924261> \`${user}\` does not appear to have any capes.` }; + if (foundUser == null) + return { content: `${this.client.util.emojis.error} \`${user}\` does not appear to have any capes.` }; const userPerm: string[] = foundUser.perms; const embed = this.client.util .createEmbed(this.client.util.colors.default) @@ -100,7 +101,7 @@ export default class CapePermissionsCommand extends BushCommand { .setDescription(userPerm.join('\n')); return { embeds: [embed] }; } else { - return { content: `<:error:837123021016924261> There was an error finding cape perms for ${user}.` }; + return { content: `${this.client.util.emojis.error} There was an error finding cape perms for ${user}.` }; } } } diff --git a/src/commands/moulberry-bush/giveawayPing.ts b/src/commands/moulberry-bush/giveawayPing.ts index 9a03140..d308602 100644 --- a/src/commands/moulberry-bush/giveawayPing.ts +++ b/src/commands/moulberry-bush/giveawayPing.ts @@ -24,9 +24,9 @@ export default class GiveawayPingCommand extends BushCommand { } public async exec(message: Message): Promise<unknown> { if (message.guild.id !== '516977525906341928') - return message.reply("<:error:837123021016924261> This command may only be run in Moulberry's Bush."); + return message.reply(`${this.client.util.emojis.error} This command may only be run in Moulberry's Bush.`); if (!['767782084981817344', '833855738501267456'].includes(message.channel.id)) - return message.reply('<:error:837123021016924261> This command may only be run in giveaway channels.'); + return message.reply(`${this.client.util.emojis.error} This command may only be run in giveaway channels.`); await message.delete().catch(() => undefined); const webhooks = await (message.channel as TextChannel | NewsChannel).fetchWebhooks(); let webhookClient: WebhookClient; @@ -38,8 +38,7 @@ export default class GiveawayPingCommand extends BushCommand { webhookClient = new WebhookClient(webhook.id, webhook.token); } return webhookClient.send({ - content: - '🎉 <@&767782793261875210> Giveaway.\n\n<:mad:783046135392239626> Spamming, line breaking, gibberish etc. disqualifies you from winning. We can and will ban you from giveaways. Winners will all be checked and rerolled if needed.', + content: `🎉 <@&767782793261875210> Giveaway.\n\n${this.client.util.emojis.mad} Spamming, line breaking, gibberish etc. disqualifies you from winning. We can and will ban you from giveaways. Winners will all be checked and rerolled if needed.`, username: `${message.member.nickname || message.author.username}`, avatarURL: message.author.avatarURL({ dynamic: true }), allowedMentions: AllowedMentions.roles() diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index b71b42f..674b776 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -1,9 +1,9 @@ import { Argument } from 'discord-akairo'; import { ApplicationCommandOptionType } from 'discord-api-types'; import { CommandInteraction, Message, MessageEmbed, User } from 'discord.js'; +import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; import { BushCommand } from '../../lib/extensions/BushCommand'; import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; -import { SlashCommandOption } from '../../lib/extensions/Util'; export default class RuleCommand extends BushCommand { private rules = [ @@ -80,7 +80,7 @@ export default class RuleCommand extends BushCommand { type: Argument.range('number', 1, 12, true), prompt: { start: 'What rule would you like to have cited?', - retry: '<:no:787549684196704257> Choose a valid rule.', + retry: '{error} Choose a valid rule.', optional: true }, default: undefined @@ -90,7 +90,7 @@ export default class RuleCommand extends BushCommand { type: 'user', prompt: { start: 'What user would you like to mention?', - retry: '<:no:787549684196704257> Choose a valid user to mention.', + retry: '{error} Choose a valid user to mention.', optional: true }, default: undefined @@ -123,7 +123,7 @@ export default class RuleCommand extends BushCommand { message.guild.id !== '516977525906341928' && !this.client.ownerID.includes(message instanceof Message ? message.author.id : message.user.id) ) { - return { content: "<:no:787549684196704257> This command can only be run in Moulberry's Bush." }; + return { content: `${this.client.util.emojis.error} This command can only be run in Moulberry's Bush.` }; } let rulesEmbed = new MessageEmbed().setColor('ef3929'); if (message instanceof Message) { |