diff options
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/config/blacklist.ts | 6 | ||||
-rw-r--r-- | src/commands/config/config.ts | 12 | ||||
-rw-r--r-- | src/commands/config/disable.ts | 3 | ||||
-rw-r--r-- | src/commands/dev/test.ts | 18 | ||||
-rw-r--r-- | src/commands/info/guildInfo.ts | 13 | ||||
-rw-r--r-- | src/commands/info/userInfo.ts | 11 | ||||
-rw-r--r-- | src/commands/leveling/level.ts | 11 | ||||
-rw-r--r-- | src/commands/leveling/setLevel.ts | 3 | ||||
-rw-r--r-- | src/commands/moderation/evidence.ts | 9 | ||||
-rw-r--r-- | src/commands/moderation/hideCase.ts | 3 | ||||
-rw-r--r-- | src/commands/moderation/kick.ts | 4 | ||||
-rw-r--r-- | src/commands/moderation/mute.ts | 4 | ||||
-rw-r--r-- | src/commands/moulberry-bush/capes.ts | 14 | ||||
-rw-r--r-- | src/commands/moulberry-bush/rule.ts | 3 | ||||
-rw-r--r-- | src/commands/utilities/activity.ts | 5 | ||||
-rw-r--r-- | src/commands/utilities/calculator.ts | 5 | ||||
-rw-r--r-- | src/commands/utilities/suicide.ts | 6 |
17 files changed, 50 insertions, 80 deletions
diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts index d6d7c18..c928265 100644 --- a/src/commands/config/blacklist.ts +++ b/src/commands/config/blacklist.ts @@ -69,8 +69,7 @@ export default class BlacklistCommand extends BushCommand { if (global) { if ((action as 'blacklist' | 'unblacklist' | 'toggle') === 'toggle') { const globalDB = - (await Global.findByPk(client.config.environment)) ?? - (await Global.create({ environment: client.config.environment })); + (await Global.findByPk(client.config.environment)) ?? (await Global.create({ environment: client.config.environment })); const blacklistedUsers = globalDB.blacklistedUsers; const blacklistedChannels = globalDB.blacklistedChannels; action = blacklistedUsers.includes(targetID) || blacklistedChannels.includes(targetID) ? 'unblacklist' : 'blacklist'; @@ -96,8 +95,7 @@ export default class BlacklistCommand extends BushCommand { }); // guild disable } else { - if (!message.guild) - return await message.util.reply(`${util.emojis.error} You have to be in a guild to disable commands.`); + if (!message.guild) return await message.util.reply(`${util.emojis.error} You have to be in a guild to disable commands.`); const blacklistedChannels = (await message.guild.getSetting('blacklistedChannels')) ?? []; const blacklistedUsers = (await message.guild.getSetting('blacklistedUsers')) ?? []; if ((action as 'blacklist' | 'unblacklist' | 'toggle') === 'toggle') { diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index 0ca8ef8..3342456 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -51,9 +51,7 @@ export default class SettingsCommand extends BushCommand { options: [ { name: 'value', - description: `What would you like to add to the server's ${guildSettingsObj[ - setting - ].name.toLowerCase()}?'`, + description: `What would you like to add to the server's ${guildSettingsObj[setting].name.toLowerCase()}?'`, type: guildSettingsObj[setting].type.replace('-array', '').toUpperCase() as SlashArgType, required: true } @@ -88,9 +86,7 @@ export default class SettingsCommand extends BushCommand { options: [ { name: 'value', - description: `What would you like to set the server's ${guildSettingsObj[ - setting - ].name.toLowerCase()} to?'`, + description: `What would you like to set the server's ${guildSettingsObj[setting].name.toLowerCase()} to?'`, type: guildSettingsObj[setting].type.toUpperCase() as SlashArgType, required: true } @@ -186,9 +182,7 @@ export default class SettingsCommand 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('MANAGE_GUILD') && !message.member?.user.isOwner()) - return await message.util.reply( - `${util.emojis.error} You must have the **MANAGE_GUILD** permission to run this command.` - ); + return await message.util.reply(`${util.emojis.error} You must have the **MANAGE_GUILD** 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!; const value = args.value; diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts index 2e3ce74..521972b 100644 --- a/src/commands/config/disable.ts +++ b/src/commands/config/disable.ts @@ -70,8 +70,7 @@ export default class DisableCommand extends BushCommand { if (global) { if (action === 'toggle') { const disabledCommands = ( - (await Global.findByPk(client.config.environment)) ?? - (await Global.create({ environment: client.config.environment })) + (await Global.findByPk(client.config.environment)) ?? (await Global.create({ environment: client.config.environment })) ).disabledCommands; action = disabledCommands.includes(commandID) ? 'disable' : 'enable'; } diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index e3aa20d..8ea57f9 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -75,7 +75,11 @@ export default class TestCommand extends BushCommand { .setTitle('Title'); const buttonRow = new MessageActionRow().addComponents( - new MessageButton({ style: jsConstants.MessageButtonStyles.LINK, label: 'Link', url: 'https://www.google.com/' }) + new MessageButton({ + style: jsConstants.MessageButtonStyles.LINK, + label: 'Link', + url: 'https://www.google.com/' + }) ); return await message.util.reply({ content: 'Test', embeds: [embed], components: [buttonRow] }); } else if (['lots of buttons'].includes(args?.feature?.toLowerCase())) { @@ -84,7 +88,11 @@ export default class TestCommand extends BushCommand { const row = new MessageActionRow(); for (let b = 1; b <= 5; b++) { const id = (a + 5 * (b - 1)).toString(); - const button = new MessageButton({ style: jsConstants.MessageButtonStyles.SECONDARY, customId: id, label: id }); + const button = new MessageButton({ + style: jsConstants.MessageButtonStyles.SECONDARY, + customId: id, + label: id + }); row.addComponents(button); } ButtonRows.push(row); @@ -126,7 +134,11 @@ export default class TestCommand extends BushCommand { const row = new MessageActionRow(); for (let b = 1; b <= 5; b++) { const id = (a + 5 * (b - 1)).toString(); - const button = new MessageButton({ style: jsConstants.MessageButtonStyles.SECONDARY, customId: id, label: id }); + const button = new MessageButton({ + style: jsConstants.MessageButtonStyles.SECONDARY, + customId: id, + label: id + }); row.addComponents(button); } ButtonRows.push(row); diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts index 3a592e9..51d9984 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -97,10 +97,7 @@ export default class GuildInfoCommand extends BushCommand { ); if (guild.me?.permissions.has('MANAGE_GUILD') && guild.vanityURLCode) { const vanityInfo: Vanity = await guild.fetchVanityData(); - guildAbout.push( - `**Vanity URL:** discord.gg/${vanityInfo.code}`, - `**Vanity Uses:** ${vanityInfo.uses?.toLocaleString()}` - ); + guildAbout.push(`**Vanity URL:** discord.gg/${vanityInfo.code}`, `**Vanity Uses:** ${vanityInfo.uses?.toLocaleString()}`); } if (guild.icon) guildAbout.push(`**Icon:** [link](${guild.iconURL({ dynamic: true, size: 4096, format: 'png' })})`); @@ -112,13 +109,7 @@ export default class GuildInfoCommand extends BushCommand { // subtract 1 for @everyone role `**Roles:** ${((guild.roles.cache.size ?? 0) - 1).toLocaleString()} / 250`, `**Emojis:** ${guild.emojis.cache.size?.toLocaleString() ?? 0} / ${ - guild.premiumTier === 'TIER_3' - ? 500 - : guild.premiumTier === 'TIER_2' - ? 300 - : guild.premiumTier === 'TIER_1' - ? 100 - : 50 + guild.premiumTier === 'TIER_3' ? 500 : guild.premiumTier === 'TIER_2' ? 300 : guild.premiumTier === 'TIER_1' ? 100 : 50 }`, `**Stickers:** ${guild.stickers.cache.size?.toLocaleString() ?? 0} / ${ guild.premiumTier === 'TIER_3' ? 60 : guild.premiumTier === 'TIER_2' ? 30 : guild.premiumTier === 'TIER_1' ? 15 : 0 diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index b3c8a67..7969875 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -92,11 +92,7 @@ export default class UserInfoCommand extends BushCommand { premiumSinceDelta = member && member.premiumSince ? util.dateDelta(member.premiumSince, 2) : undefined; // General Info - const generalInfo = [ - `**Mention:** <@${user.id}>`, - `**ID:** ${user.id}`, - `**Created:** ${createdAt} (${createdAtDelta} ago)` - ]; + 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({ dynamic: true, format: 'png', size: 4096 })})`); const pronouns = await util.getPronounsOf(user); @@ -114,10 +110,7 @@ export default class UserInfoCommand extends BushCommand { if (member?.displayHexColor) serverUserInfo.push(`**Display Color:** ${member.displayHexColor}`); if (user.id == '322862723090219008' && message.guild?.id == client.consts.mappings.guilds.bush) serverUserInfo.push(`**General Deletions:** 1⅓`); - if ( - ['384620942577369088', '496409778822709251'].includes(user.id) && - message.guild?.id == client.consts.mappings.guilds.bush - ) + if (['384620942577369088', '496409778822709251'].includes(user.id) && message.guild?.id == client.consts.mappings.guilds.bush) serverUserInfo.push(`**General Deletions:** ⅓`); if (member?.nickname) serverUserInfo.push(`**Nickname:** ${member?.nickname}`); if (serverUserInfo.length) diff --git a/src/commands/leveling/level.ts b/src/commands/leveling/level.ts index faaf201..588456b 100644 --- a/src/commands/leveling/level.ts +++ b/src/commands/leveling/level.ts @@ -1,13 +1,4 @@ -import { - AllowedMentions, - BushCommand, - BushGuild, - BushMessage, - BushSlashMessage, - BushUser, - CanvasProgressBar, - Level -} from '@lib'; +import { AllowedMentions, BushCommand, BushGuild, BushMessage, BushSlashMessage, BushUser, CanvasProgressBar, Level } from '@lib'; import canvas from 'canvas'; import { MessageAttachment } from 'discord.js'; import got from 'got/dist/source'; diff --git a/src/commands/leveling/setLevel.ts b/src/commands/leveling/setLevel.ts index e085a8e..18138bc 100644 --- a/src/commands/leveling/setLevel.ts +++ b/src/commands/leveling/setLevel.ts @@ -54,8 +54,7 @@ export default class SetLevelCommand extends BushCommand { if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a guild.`); if (!user.id) throw new Error('user.id is null'); - if (isNaN(level)) - return await message.util.reply(`${util.emojis.error} Provide a valid number to set the user's level to.`); + if (isNaN(level)) return await message.util.reply(`${util.emojis.error} Provide a valid number to set the user's level to.`); if (level > 6553 || level < 0) return await message.util.reply(`${util.emojis.error} You cannot set a level higher than \`6553\`.`); diff --git a/src/commands/moderation/evidence.ts b/src/commands/moderation/evidence.ts index 0a297de..8dc65f3 100644 --- a/src/commands/moderation/evidence.ts +++ b/src/commands/moderation/evidence.ts @@ -63,17 +63,12 @@ export default class EvidenceCommand extends BushCommand { ) { const entry = await ModLog.findByPk(caseID); if (!entry || entry.pseudo) return message.util.send(`${util.emojis.error} Invalid modlog entry.`); - if (entry.guild !== message.guild!.id) - return message.util.reply(`${util.emojis.error} This modlog is from another server.`); + if (entry.guild !== message.guild!.id) return message.util.reply(`${util.emojis.error} This modlog is from another server.`); if (evidence && (message as BushMessage).attachments?.size) return message.util.reply(`${util.emojis.error} Please either attach an image or a reason not both.`); - const _evidence = evidence - ? evidence - : !message.util.isSlash - ? (message as BushMessage).attachments.first()?.url - : undefined; + const _evidence = evidence ? evidence : !message.util.isSlash ? (message as BushMessage).attachments.first()?.url : undefined; if (!_evidence) return message.util.reply(`${util.emojis.error} You must provide evidence for this modlog.`); const oldEntry = entry.evidence; diff --git a/src/commands/moderation/hideCase.ts b/src/commands/moderation/hideCase.ts index a873784..693197a 100644 --- a/src/commands/moderation/hideCase.ts +++ b/src/commands/moderation/hideCase.ts @@ -38,8 +38,7 @@ export default class HideCaseCommand extends BushCommand { public override async exec(message: BushMessage | BushSlashMessage, { case_id: caseID }: { case_id: string }) { const entry = await ModLog.findByPk(caseID); if (!entry || entry.pseudo) return message.util.send(`${util.emojis.error} Invalid entry.`); - if (entry.guild !== message.guild!.id) - return message.util.reply(`${util.emojis.error} This modlog is from another server.`); + if (entry.guild !== message.guild!.id) return message.util.reply(`${util.emojis.error} This modlog is from another server.`); const action = entry.hidden ? 'no longer hidden' : 'now hidden'; const oldEntry = entry.hidden; entry.hidden = !entry.hidden; diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts index 34c1b76..dab6807 100644 --- a/src/commands/moderation/kick.ts +++ b/src/commands/moderation/kick.ts @@ -62,9 +62,7 @@ export default class KickCommand extends BushCommand { const member = await message.guild!.members.fetch(user.id); if (!member) - return await message.util.reply( - `${util.emojis.error} The user you selected is not in the server or is not a valid user.` - ); + return await message.util.reply(`${util.emojis.error} The user you selected is not in the server or is not a valid user.`); if (!message.member) throw new Error(`message.member is null`); const useForce = force && message.author.isOwner(); const canModerateResponse = await Moderation.permissionCheck(message.member, member, 'kick', true, useForce); diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts index 844809b..6f594a0 100644 --- a/src/commands/moderation/mute.ts +++ b/src/commands/moderation/mute.ts @@ -69,9 +69,7 @@ export default class MuteCommand extends BushCommand { if (reason.duration === null) reason.duration = 0; const member = await message.guild!.members.fetch(args.user.id).catch(() => null); if (!member) - return await message.util.reply( - `${util.emojis.error} The user you selected is not in the server or is not a valid user.` - ); + return await message.util.reply(`${util.emojis.error} The user you selected is not in the server or is not a valid user.`); if (!message.member) throw new Error(`message.member is null`); const useForce = args.force && message.author.isOwner(); diff --git a/src/commands/moulberry-bush/capes.ts b/src/commands/moulberry-bush/capes.ts index d5d8531..3590d9f 100644 --- a/src/commands/moulberry-bush/capes.ts +++ b/src/commands/moulberry-bush/capes.ts @@ -52,7 +52,12 @@ export default class CapesCommand extends BushCommand { const capes1: { name: string; url: string; index: number; purchasable?: boolean }[] = []; client.consts.mappings.capes.forEach((mapCape) => { if (!capes.some((gitCape) => gitCape.match!.groups!.name === mapCape.name) && mapCape.custom) { - capes1.push({ name: mapCape.name, url: mapCape.custom, index: mapCape.index, purchasable: mapCape.purchasable }); + capes1.push({ + name: mapCape.name, + url: mapCape.custom, + index: mapCape.index, + purchasable: mapCape.purchasable + }); } }); capes.forEach((gitCape) => { @@ -92,12 +97,7 @@ export default class CapesCommand extends BushCommand { } } - private makeEmbed(cape: { - name: string; - url: string; - index: number; - purchasable?: boolean | undefined; - }): MessageEmbedOptions { + private makeEmbed(cape: { name: string; url: string; index: number; purchasable?: boolean | undefined }): MessageEmbedOptions { return { title: `${cape.name} cape`, color: util.colors.default, diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index 42745bb..fa421f5 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -32,8 +32,7 @@ const rules = [ }, { title: '7.) Impersonation', - description: - 'Do not try to impersonate others for the express intent of being deceitful, defamation , and/or personal gain.' + description: 'Do not try to impersonate others for the express intent of being deceitful, defamation , and/or personal gain.' }, { title: '8.) Swearing', description: 'Swearing is allowed only when not used as an insult.' }, { diff --git a/src/commands/utilities/activity.ts b/src/commands/utilities/activity.ts index a2ca3e2..455bbf3 100644 --- a/src/commands/utilities/activity.ts +++ b/src/commands/utilities/activity.ts @@ -97,7 +97,10 @@ export default class YouTubeCommand extends BushCommand { description: 'What activity would you like to play?', type: 'STRING', required: true, - choices: Object.keys(activityMap).map((key) => ({ name: key, value: activityMap[key as keyof typeof activityMap] })) + choices: Object.keys(activityMap).map((key) => ({ + name: key, + value: activityMap[key as keyof typeof activityMap] + })) } ], clientPermissions: (m) => util.clientSendAndPermCheck(m), diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts index 861a356..b32b29b 100644 --- a/src/commands/utilities/calculator.ts +++ b/src/commands/utilities/calculator.ts @@ -38,10 +38,7 @@ export default class CalculatorCommand extends BushCommand { }); } public override async exec(message: BushMessage | BushSlashMessage, args: { expression: string }) { - const decodedEmbed = new MessageEmbed().addField( - '📥 Input', - await util.inspectCleanRedactCodeblock(args.expression, 'mma') - ); + const decodedEmbed = new MessageEmbed().addField('📥 Input', await util.inspectCleanRedactCodeblock(args.expression, 'mma')); try { const calculated = /^(9\s*?\+\s*?10)|(10\s*?\+\s*?9)$/.test(args.expression) ? '21' : evaluate(args.expression); decodedEmbed diff --git a/src/commands/utilities/suicide.ts b/src/commands/utilities/suicide.ts index 3709e37..8d6f002 100644 --- a/src/commands/utilities/suicide.ts +++ b/src/commands/utilities/suicide.ts @@ -49,7 +49,11 @@ export default class TemplateCommand extends BushCommand { // If the original message was a reply -> imitate it !message.util.isSlashMessage(message) && message.reference?.messageId && message.guild && message.channel ? await message.channel.messages.fetch(message.reference!.messageId!).then(async (message1) => { - await message1.reply({ embeds: [suicideEmbed], allowedMentions: AllowedMentions.users(), target: message1 }); + await message1.reply({ + embeds: [suicideEmbed], + allowedMentions: AllowedMentions.users(), + target: message1 + }); }) : await message.util.send({ embeds: [suicideEmbed], allowedMentions: AllowedMentions.users() }) ); |