From 4cebaca70939b87c78537c5c3cd099e29e2e4e04 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Wed, 29 Dec 2021 16:17:48 -0500 Subject: use new setFooter overload --- src/commands/dev/eval.ts | 6 ++++-- src/commands/dev/javascript.ts | 6 ++++-- src/commands/dev/sh.ts | 2 +- src/commands/dev/test.ts | 2 +- src/commands/info/help.ts | 4 ++-- src/commands/info/ping.ts | 7 +++++-- src/commands/info/userInfo.ts | 19 +++++++++++++++---- src/commands/moderation/purge.ts | 9 +++++++-- src/commands/moulberry-bush/rule.ts | 8 ++++++-- src/commands/moulberry-bush/serverStatus.ts | 2 +- src/commands/utilities/price.ts | 6 +++--- src/commands/utilities/viewRaw.ts | 12 ++++++------ src/listeners/custom/bushBan.ts | 2 +- src/listeners/custom/bushKick.ts | 2 +- src/listeners/custom/bushMute.ts | 2 +- src/listeners/custom/bushPunishRole.ts | 2 +- src/listeners/custom/bushPunishRoleRemove.ts | 2 +- src/listeners/custom/bushPurge.ts | 2 +- src/listeners/custom/bushUnban.ts | 2 +- src/listeners/custom/bushUnmute.ts | 2 +- src/listeners/custom/bushWarn.ts | 2 +- src/listeners/message/directMessage.ts | 2 +- 22 files changed, 65 insertions(+), 38 deletions(-) diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index f97f00d..ac114ea 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -1,4 +1,4 @@ -import { ArgType, BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; +import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; import { exec } from 'child_process'; import { MessageEmbed as _MessageEmbed } from 'discord.js'; import ts from 'typescript'; @@ -219,7 +219,9 @@ export default class EvalCommand extends BushCommand { embed.addField('📤 Error', await util.inspectCleanRedactCodeblock(e, 'js')); } - embed.setTimestamp().setFooter(message.author.tag, message.author.displayAvatarURL({ dynamic: true }) ?? undefined); + embed + .setTimestamp() + .setFooter({ text: message.author.tag, iconURL: message.author.displayAvatarURL({ dynamic: true }) ?? undefined }); if (!args.silent || message.util.isSlashMessage(message)) { await message.util.reply({ embeds: [embed] }); diff --git a/src/commands/dev/javascript.ts b/src/commands/dev/javascript.ts index 2a6a87b..a5f90cb 100644 --- a/src/commands/dev/javascript.ts +++ b/src/commands/dev/javascript.ts @@ -1,4 +1,4 @@ -import { ArgType, BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; +import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; import { MessageEmbed } from 'discord.js'; import { VM } from 'vm2'; @@ -83,7 +83,9 @@ export default class JavascriptCommand extends BushCommand { embed.addField('📤 Error', await util.inspectCleanRedactCodeblock(e, 'js')); } - embed.setTimestamp().setFooter(message.author.tag, message.author.displayAvatarURL({ dynamic: true }) ?? undefined); + embed + .setTimestamp() + .setFooter({ text: message.author.tag, iconURL: message.author.displayAvatarURL({ dynamic: true }) ?? undefined }); await message.util.reply({ embeds: [embed] }); } diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts index 5ef72b1..e6398b6 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -44,7 +44,7 @@ export default class ShCommand extends BushCommand { const embed = new MessageEmbed() .setColor(util.colors.gray) - .setFooter(message.author.tag, message.author.avatarURL({ dynamic: true }) ?? undefined) + .setFooter({ text: message.author.tag, iconURL: message.author.avatarURL({ dynamic: true }) ?? undefined }) .setTimestamp() .setTitle('Shell Command') .addField('📥 Input', await util.codeblock(input, 1024, 'sh', true)) diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index f3ac627..247ae20 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -62,7 +62,7 @@ export default class TestCommand extends BushCommand { .setAuthor({ name: 'Author', iconURL: 'https://www.w3schools.com/w3css/img_snowtops.jpg', url: 'https://google.com/' }) .setColor(message.member?.displayColor ?? util.colors.default) .setDescription('Description') - .setFooter('Footer', message.author.avatarURL() ?? undefined) + .setFooter({ text: 'Footer', iconURL: message.author.avatarURL() ?? undefined }) .setURL('https://duckduckgo.com/') .setTimestamp() .setImage('https://media.sproutsocial.com/uploads/2017/02/10x-featured-social-media-image-size.png') diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index 277017e..e1e9844 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -1,4 +1,4 @@ -import { ArgType, BushCommand, BushMessage, BushSlashMessage } from '#lib'; +import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; import { MessageActionRow, MessageButton, MessageEmbed } from 'discord.js'; import packageDotJSON from '../../../package.json' assert { type: 'json' }; @@ -55,7 +55,7 @@ export default class HelpCommand extends BushCommand { if (!isOwner) args.showHidden = false; if (!command || command.pseudo) { const embed = new MessageEmbed().setColor(util.colors.default).setTimestamp(); - embed.setFooter(`For more information about a command use ${prefix}help `); + embed.setFooter({ text: `For more information about a command use ${prefix}help ` }); for (const [, category] of this.handler.categories) { const categoryFilter = category.filter((command) => { if (command.pseudo) return false; diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts index 619971f..a156368 100644 --- a/src/commands/info/ping.ts +++ b/src/commands/info/ping.ts @@ -24,7 +24,7 @@ export default class PingCommand extends BushCommand { .setTitle('Pong! 🏓') .addField('Bot Latency', botLatency, true) .addField('API Latency', apiLatency, true) - .setFooter(message.author.username, message.author.displayAvatarURL({ dynamic: true })) + .setFooter({ text: message.author.username, iconURL: message.author.displayAvatarURL({ dynamic: true }) }) .setColor(util.colors.default) .setTimestamp(); await sentMessage.edit({ @@ -43,7 +43,10 @@ export default class PingCommand extends BushCommand { .setTitle('Pong! 🏓') .addField('Bot Latency', botLatency, true) .addField('API Latency', apiLatency, true) - .setFooter(message.interaction.user.username, message.interaction.user.displayAvatarURL({ dynamic: true })) + .setFooter({ + text: message.interaction.user.username, + iconURL: message.interaction.user.displayAvatarURL({ dynamic: true }) + }) .setColor(util.colors.default) .setTimestamp(); await message.interaction.editReply({ diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 9c7a2a7..f8c7c68 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -1,4 +1,12 @@ -import { ArgType, BushCommand, BushGuild, BushGuildMember, type BushMessage, type BushSlashMessage, type BushUser } from '#lib'; +import { + BushCommand, + type ArgType, + type BushGuild, + type BushGuildMember, + type BushMessage, + type BushSlashMessage, + type BushUser +} from '#lib'; import { MessageEmbed } from 'discord.js'; // TODO: Add bot information @@ -144,7 +152,10 @@ export default class UserInfoCommand extends BushCommand { offline = '787550565382750239', invisible = '787550565382750239' } - userEmbed.setFooter(user.tag, client.emojis.cache.get(statusEmojis[member?.presence.status])?.url ?? undefined); + userEmbed.setFooter({ + text: user.tag, + iconURL: client.emojis.cache.get(statusEmojis[member?.presence.status])?.url ?? undefined + }); } // roles @@ -160,8 +171,8 @@ export default class UserInfoCommand extends BushCommand { const perms = []; if (member?.permissions.has('ADMINISTRATOR') || guild?.ownerId == user.id) { perms.push('`Administrator`'); - } else if (member?.permissions.toArray(false).length) { - member.permissions.toArray(false).forEach((permission) => { + } else if (member?.permissions.toArray().length) { + member.permissions.toArray().forEach((permission) => { if (client.consts.mappings.permissions[permission]?.important) { perms.push(`\`${client.consts.mappings.permissions[permission].name}\``); } diff --git a/src/commands/moderation/purge.ts b/src/commands/moderation/purge.ts index 7a25a0d..6125293 100644 --- a/src/commands/moderation/purge.ts +++ b/src/commands/moderation/purge.ts @@ -1,4 +1,5 @@ -import { ArgType, BushCommand, BushMessage } from '#lib'; +import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; +import assert from 'assert'; import { Collection, type Snowflake } from 'discord.js'; export default class PurgeCommand extends BushCommand { @@ -47,7 +48,11 @@ export default class PurgeCommand extends BushCommand { }); } - public override async exec(message: BushMessage, args: { amount: number; bot: boolean; user: ArgType<'user'> }) { + public override async exec( + message: BushMessage | BushSlashMessage, + args: { amount: number; bot: boolean; user: ArgType<'user'> } + ) { + assert(message.channel); if (message.channel.type === 'DM') return message.util.reply(`${util.emojis.error} You cannot run this command in dms.`); if (args.amount > 100 || args.amount < 1) return message.util.reply(`${util.emojis.error} `); diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index cc59db5..ab2632c 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -1,4 +1,4 @@ -import { AllowedMentions, BushCommand, OptionalArgType, type BushMessage } from '#lib'; +import { AllowedMentions, BushCommand, type BushMessage, type OptionalArgType } from '#lib'; import { MessageEmbed } from 'discord.js'; const rules = [ @@ -50,6 +50,7 @@ const rules = [ 'If there are loopholes in our rules, the staff team may moderate based on what they deem appropriate. The staff team holds final discretion.' } ]; + export default class RuleCommand extends BushCommand { public constructor() { super('rule', { @@ -96,7 +97,10 @@ export default class RuleCommand extends BushCommand { ) { const rulesEmbed = new MessageEmbed() .setColor('#ef3929') - .setFooter(`Triggered by ${message.author.tag}`, message.author.avatarURL({ dynamic: true }) ?? undefined) + .setFooter({ + text: `Triggered by ${message.author.tag}`, + iconURL: message.author.avatarURL({ dynamic: true }) ?? undefined + }) .setTimestamp(); if (rule != null && (rule > 12 || rule < 1)) { diff --git a/src/commands/moulberry-bush/serverStatus.ts b/src/commands/moulberry-bush/serverStatus.ts index ac37684..790ac09 100644 --- a/src/commands/moulberry-bush/serverStatus.ts +++ b/src/commands/moulberry-bush/serverStatus.ts @@ -21,7 +21,7 @@ export default class ServerStatusCommand extends BushCommand { .setTitle('Server status') .setDescription(`Checking server:\n${util.emojis.loading}`) .setColor(util.colors.default) - .setFooter('Checking https://moulberry.codes/lowestbin.json'); + .setFooter({ text: 'Checking https://moulberry.codes/lowestbin.json' }); await message.util.reply({ embeds: [msgEmbed] }); let main; try { diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts index d931dd2..16dd327 100644 --- a/src/commands/utilities/price.ts +++ b/src/commands/utilities/price.ts @@ -56,7 +56,7 @@ export default class PriceCommand extends BushCommand { if (bazaar?.success === false) errors.push('bazaar'); if (errors?.length) { - priceEmbed.setFooter(`Could not fetch data from ${util.oxford(errors, 'and', '')}`); + priceEmbed.setFooter({ text: `Could not fetch data from ${util.oxford(errors, 'and', '')}` }); } // create a set from all the item names so that there are no duplicates for the fuzzy search @@ -69,7 +69,7 @@ export default class PriceCommand extends BushCommand { // fuzzy search if (!strict) { - parsedItem = new Fuse(Array.from(itemNames), { + parsedItem = new Fuse([...itemNames], { isCaseSensitive: false, findAllMatches: true, threshold: 0.7, @@ -98,7 +98,7 @@ export default class PriceCommand extends BushCommand { priceEmbed .setColor(util.colors.success) .setTitle(`Price Information for \`${parsedItem}\``) - .setFooter('All information is based on the last 3 days.'); + .setFooter({ text: 'All information is based on the last 3 days.' }); } else { const errorEmbed = new MessageEmbed(); errorEmbed diff --git a/src/commands/utilities/viewRaw.ts b/src/commands/utilities/viewRaw.ts index eeec4d9..b524b3c 100644 --- a/src/commands/utilities/viewRaw.ts +++ b/src/commands/utilities/viewRaw.ts @@ -1,11 +1,11 @@ import { - ArgType, BushCommand, - BushNewsChannel, - BushTextChannel, - OptionalArgType, + type ArgType, type BushMessage, - type BushSlashMessage + type BushNewsChannel, + type BushSlashMessage, + type BushTextChannel, + type OptionalArgType } from '#lib'; import { Message, MessageEmbed, type Snowflake } from 'discord.js'; @@ -96,7 +96,7 @@ export default class ViewRawCommand extends BushCommand { : message.content || '[No Content]'; const lang = options.json ? 'json' : options.js ? 'js' : undefined; return new MessageEmbed() - .setFooter(message.author.tag, message.author.avatarURL({ dynamic: true }) ?? undefined) + .setFooter({ text: message.author.tag, iconURL: message.author.avatarURL({ dynamic: true }) ?? undefined }) .setTimestamp(message.createdTimestamp) .setColor(message.member?.roles?.color?.color ?? util.colors.default) .setTitle('Raw Message Information') diff --git a/src/listeners/custom/bushBan.ts b/src/listeners/custom/bushBan.ts index 062c2c7..59e010e 100644 --- a/src/listeners/custom/bushBan.ts +++ b/src/listeners/custom/bushBan.ts @@ -18,7 +18,7 @@ export default class BushBanListener extends BushListener { const logEmbed = new MessageEmbed() .setColor(util.colors.discord.RED) .setTimestamp() - .setFooter(`CaseID: ${caseID}`) + .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined }) .addField('**Action**', `${duration ? 'Temp Ban' : 'Perm Ban'}`) .addField('**User**', `${user} (${user.tag})`) diff --git a/src/listeners/custom/bushKick.ts b/src/listeners/custom/bushKick.ts index 66f92e5..866aba4 100644 --- a/src/listeners/custom/bushKick.ts +++ b/src/listeners/custom/bushKick.ts @@ -18,7 +18,7 @@ export default class BushKickListener extends BushListener { const logEmbed = new MessageEmbed() .setColor(util.colors.discord.RED) .setTimestamp() - .setFooter(`CaseID: ${caseID}`) + .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined }) .addField('**Action**', `${'Kick'}`) .addField('**User**', `${user} (${user.tag})`) diff --git a/src/listeners/custom/bushMute.ts b/src/listeners/custom/bushMute.ts index ed40370..c25bd69 100644 --- a/src/listeners/custom/bushMute.ts +++ b/src/listeners/custom/bushMute.ts @@ -18,7 +18,7 @@ export default class BushMuteListener extends BushListener { const logEmbed = new MessageEmbed() .setColor(util.colors.discord.ORANGE) .setTimestamp() - .setFooter(`CaseID: ${caseID}`) + .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined }) .addField('**Action**', `${duration ? 'Temp Mute' : 'Perm Mute'}`) .addField('**User**', `${user} (${user.tag})`) diff --git a/src/listeners/custom/bushPunishRole.ts b/src/listeners/custom/bushPunishRole.ts index 6a5f13c..3491166 100644 --- a/src/listeners/custom/bushPunishRole.ts +++ b/src/listeners/custom/bushPunishRole.ts @@ -18,7 +18,7 @@ export default class BushPunishRoleListener extends BushListener { const logEmbed = new MessageEmbed() .setColor(util.colors.discord.YELLOW) .setTimestamp() - .setFooter(`CaseID: ${caseID}`) + .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined }) .addField('**Action**', `${duration ? 'Temp Punishment Role' : 'Perm Punishment Role'}`) .addField('**User**', `${user} (${user.tag})`) diff --git a/src/listeners/custom/bushPunishRoleRemove.ts b/src/listeners/custom/bushPunishRoleRemove.ts index 26073cc..eb1ae71 100644 --- a/src/listeners/custom/bushPunishRoleRemove.ts +++ b/src/listeners/custom/bushPunishRoleRemove.ts @@ -18,7 +18,7 @@ export default class BushPunishRoleRemoveListener extends BushListener { const logEmbed = new MessageEmbed() .setColor(util.colors.discord.GREEN) .setTimestamp() - .setFooter(`CaseID: ${caseID}`) + .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined }) .addField('**Action**', `${'Remove Punishment Role'}`) .addField('**Role**', `${role}`) diff --git a/src/listeners/custom/bushPurge.ts b/src/listeners/custom/bushPurge.ts index 81b3867..97824a4 100644 --- a/src/listeners/custom/bushPurge.ts +++ b/src/listeners/custom/bushPurge.ts @@ -26,7 +26,7 @@ export default class BushPurgeListener extends BushListener { const logEmbed = new MessageEmbed() .setColor(util.colors.discord.DARK_PURPLE) .setTimestamp() - .setFooter(`${messages.size.toLocaleString()} Messages`) + .setFooter({ text: `${messages.size.toLocaleString()} Messages` }) .setAuthor({ name: moderator.tag, iconURL: moderator.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined }) .addField('**Action**', `${'Purge'}`) .addField('**Moderator**', `${moderator} (${moderator.tag})`) diff --git a/src/listeners/custom/bushUnban.ts b/src/listeners/custom/bushUnban.ts index 713f04c..a59bcf0 100644 --- a/src/listeners/custom/bushUnban.ts +++ b/src/listeners/custom/bushUnban.ts @@ -18,7 +18,7 @@ export default class BushUnbanListener extends BushListener { const logEmbed = new MessageEmbed() .setColor(util.colors.discord.GREEN) .setTimestamp() - .setFooter(`CaseID: ${caseID}`) + .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined }) .addField('**Action**', `${'Unban'}`) .addField('**User**', `${user} (${user.tag})`) diff --git a/src/listeners/custom/bushUnmute.ts b/src/listeners/custom/bushUnmute.ts index 46a5fd3..bd14fcd 100644 --- a/src/listeners/custom/bushUnmute.ts +++ b/src/listeners/custom/bushUnmute.ts @@ -18,7 +18,7 @@ export default class BushUnmuteListener extends BushListener { const logEmbed = new MessageEmbed() .setColor(util.colors.discord.GREEN) .setTimestamp() - .setFooter(`CaseID: ${caseID}`) + .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined }) .addField('**Action**', `${'Unmute'}`) .addField('**User**', `${user} (${user.tag})`) diff --git a/src/listeners/custom/bushWarn.ts b/src/listeners/custom/bushWarn.ts index e137473..1554aa4 100644 --- a/src/listeners/custom/bushWarn.ts +++ b/src/listeners/custom/bushWarn.ts @@ -18,7 +18,7 @@ export default class BushWarnListener extends BushListener { const logEmbed = new MessageEmbed() .setColor(util.colors.discord.YELLOW) .setTimestamp() - .setFooter(`CaseID: ${caseID}`) + .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined }) .addField('**Action**', `${'Warn'}`) .addField('**User**', `${user} (${user.tag})`) diff --git a/src/listeners/message/directMessage.ts b/src/listeners/message/directMessage.ts index 2eab341..39d203c 100644 --- a/src/listeners/message/directMessage.ts +++ b/src/listeners/message/directMessage.ts @@ -14,7 +14,7 @@ export default class DirectMessageListener extends BushListener { if (message.channel.type === 'DM') { if (!(message.author.id == client.user!.id) && message.author.bot) return; if (client.cache.global.blacklistedUsers.includes(message.author.id)) return; - const dmLogEmbed = new MessageEmbed().setTimestamp().setFooter(`User ID • ${message.channel.recipient.id}`); + const dmLogEmbed = new MessageEmbed().setTimestamp().setFooter({ text: `User ID • ${message.channel.recipient.id}` }); if (message.author.id != client.user!.id) { dmLogEmbed -- cgit