diff options
Diffstat (limited to 'src')
62 files changed, 552 insertions, 447 deletions
diff --git a/src/arguments/permission.ts b/src/arguments/permission.ts index 36c8fcb..8c09072 100644 --- a/src/arguments/permission.ts +++ b/src/arguments/permission.ts @@ -4,7 +4,7 @@ import { Permissions } from 'discord.js'; export const permission: BushArgumentTypeCaster = (_, phrase) => { if (!phrase) return null; phrase = phrase.toUpperCase().replace(/ /g, '_'); - if (!Reflect.has(Permissions.FLAGS, phrase)) { + if (!(phrase in Permissions.FLAGS)) { return null; } else { return phrase; diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index 00c6a69..2ce4246 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -229,7 +229,7 @@ export default class SettingsCommand extends BushCommand { } const collector = msg.createMessageComponentCollector({ time: 300_000, - filter: (i) => i.guildId === msg.guildId && i.message.id === msg.id + filter: (i) => i.guildId === msg.guildId && i.message?.id === msg.id }); collector.on('collect', async (interaction: MessageComponentInteraction) => { diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts index 8c9351d..d0f9c5c 100644 --- a/src/commands/config/features.ts +++ b/src/commands/config/features.ts @@ -1,6 +1,7 @@ import { BushCommand, - guildFeaturesArr, guildFeaturesObj, + guildFeaturesArr, + guildFeaturesObj, type BushMessage, type BushSlashMessage, type GuildFeatures @@ -36,7 +37,7 @@ export default class FeaturesCommand extends BushCommand { const collector = msg.createMessageComponentCollector({ componentType: 'SELECT_MENU', time: 300_000, - filter: (i) => i.guildId === msg.guildId && i.message.id === msg.id + filter: (i) => i.guildId === msg.guildId && i.message?.id === msg.id }); collector.on('collect', async (interaction: SelectMenuInteraction) => { @@ -78,7 +79,7 @@ export default class FeaturesCommand extends BushCommand { return new MessageActionRow().addComponents( new MessageSelectMenu({ customId: 'command_selectFeature', - disabled: disable, + disabled: disable, maxValues: 1, minValues: 2, options: guildFeatures.map((f) => ({ diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index d4109f4..5120a34 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -1,11 +1,11 @@ import { BushCommand, ButtonPaginator, type BushMessage } from '#lib'; import { - Constants as jsConstants, - MessageActionRow, - MessageButton, - MessageEmbed, - type ApplicationCommand, - type Collection + Constants as jsConstants, + MessageActionRow, + MessageButton, + MessageEmbed, + type ApplicationCommand, + type Collection } from 'discord.js'; export default class TestCommand extends BushCommand { diff --git a/src/commands/fun/minesweeper.ts b/src/commands/fun/minesweeper.ts index 71c5055..9b511a3 100644 --- a/src/commands/fun/minesweeper.ts +++ b/src/commands/fun/minesweeper.ts @@ -1,5 +1,5 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; -import Minesweeper from 'discord.js-minesweeper'; +import Minesweeper from '@notenoughupdates/discord.js-minesweeper'; export default class MinesweeperCommand extends BushCommand { public constructor() { diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index 04a1b14..833ed96 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -1,7 +1,7 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; import { MessageEmbed, version as discordJSVersion } from 'discord.js'; import * as os from 'os'; -const {default: prettyBytes} = await import('pretty-bytes') +const { default: prettyBytes } = await import('pretty-bytes'); export default class BotInfoCommand extends BushCommand { public constructor() { diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts index ef1c232..47a8281 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -1,5 +1,13 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; -import { Constants, Guild, MessageEmbed, type BaseGuildVoiceChannel, type GuildPreview, type Snowflake, type Vanity } from 'discord.js'; +import { + Constants, + Guild, + MessageEmbed, + type BaseGuildVoiceChannel, + type GuildPreview, + type Snowflake, + type Vanity +} from 'discord.js'; export default class GuildInfoCommand extends BushCommand { public constructor() { @@ -66,17 +74,17 @@ export default class GuildInfoCommand extends BushCommand { await guild.fetch(); const channels = guild.channels.cache; - type ChannelType = 'GUILD_TEXT'|'GUILD_NEWS'|'GUILD_VOICE'|'GUILD_STAGE_VOICE'|'GUILD_STORE'|'GUILD_CATEGORY'|'THREAD' - const channelTypes = ([ - 'GUILD_TEXT', - 'GUILD_VOICE', - 'GUILD_STAGE_VOICE', - 'GUILD_STORE', - 'GUILD_CATEGORY', - 'THREAD', - ] as ChannelType[]).map( - (type)=>`${otherEmojis[type]} ${channels.filter((channel) => channel.type.includes(type)).size.toLocaleString()}` - ) + type ChannelType = + | 'GUILD_TEXT' + | 'GUILD_NEWS' + | 'GUILD_VOICE' + | 'GUILD_STAGE_VOICE' + | 'GUILD_STORE' + | 'GUILD_CATEGORY' + | 'THREAD'; + const channelTypes = ( + ['GUILD_TEXT', 'GUILD_VOICE', 'GUILD_STAGE_VOICE', 'GUILD_STORE', 'GUILD_CATEGORY', 'THREAD'] as ChannelType[] + ).map((type) => `${otherEmojis[type]} ${channels.filter((channel) => channel.type.includes(type)).size.toLocaleString()}`); const guildRegions = [ ...new Set( @@ -105,8 +113,18 @@ export default class GuildInfoCommand extends BushCommand { 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' })})`); - enum EmojiTierMap { TIER_3 = 500, TIER_2 = 300, TIER_1 = 100, NONE = 50 } - enum StickerTierMap { TIER_3 = 60, TIER_2 = 30, TIER_1 = 15, NONE = 0 } + enum EmojiTierMap { + TIER_3 = 500, + TIER_2 = 300, + TIER_1 = 100, + NONE = 50 + } + enum StickerTierMap { + TIER_3 = 60, + TIER_2 = 30, + TIER_1 = 15, + NONE = 0 + } guildStats.push( `**Channels:** ${guild.channels.cache.size.toLocaleString()} / 500 (${channelTypes.join(', ')})`, diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index f956405..3bf8f5e 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -44,35 +44,7 @@ export default class HelpCommand extends BushCommand { args: { command: BushCommand | string; showHidden?: boolean } ) { const prefix = util.prefix(message); - const row = new MessageActionRow(); - - if (!client.config.isDevelopment && !client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) { - row.addComponents( - new MessageButton({ - style: 'LINK', - label: 'Invite Me', - url: `https://discord.com/api/oauth2/authorize?client_id=${ - client.user!.id - }&permissions=5368709119918&scope=bot%20applications.commands` - }) - ); - } - if (!client.guilds.cache.get(client.config.supportGuild.id)?.members.cache.has(message.author.id)) { - row.addComponents( - new MessageButton({ - style: 'LINK', - label: 'Support Server', - url: client.config.supportGuild.invite - }) - ); - } - row.addComponents( - new MessageButton({ - style: 'LINK', - label: 'GitHub', - url: packageDotJSON.repository - }) - ); + const row = this.addLinks(message); const isOwner = client.isOwner(message.author); const isSuperUser = client.isSuperUser(message.author); @@ -91,17 +63,13 @@ export default class HelpCommand extends BushCommand { if (command.hidden && !args.showHidden) return false; if (command.channel == 'guild' && !message.guild && !args.showHidden) return false; if (command.ownerOnly && !isOwner) return false; - if (command.superUserOnly && !isSuperUser) { - return false; - } + if (command.superUserOnly && !isSuperUser) return false; return !(command.restrictedGuilds?.includes(message.guild?.id ?? '') === false && !args.showHidden); }); const categoryNice = category.id - .replace(/(\b\w)/gi, (lc): string => lc.toUpperCase()) - .replace(/'(S)/g, (letter): string => letter.toLowerCase()); - const categoryCommands = categoryFilter - .filter((cmd): boolean => cmd.aliases.length > 0) - .map((cmd): string => `\`${cmd.aliases[0]}\``); + .replace(/(\b\w)/gi, (lc) => lc.toUpperCase()) + .replace(/'(S)/g, (letter) => letter.toLowerCase()); + const categoryCommands = categoryFilter.filter((cmd) => cmd.aliases.length > 0).map((cmd) => `\`${cmd.aliases[0]}\``); if (categoryCommands.length > 0) { embed.addField(`${categoryNice}`, `${categoryCommands.join(' ')}`); } @@ -153,4 +121,38 @@ export default class HelpCommand extends BushCommand { return await message.util.reply({ embeds: [embed], components: [row] }); } + + private addLinks(message: BushMessage | BushSlashMessage) { + const row = new MessageActionRow(); + + if (!client.config.isDevelopment && !client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) { + row.addComponents( + new MessageButton({ + style: 'LINK', + label: 'Invite Me', + url: `https://discord.com/api/oauth2/authorize?client_id=${ + client.user!.id + }&permissions=5368709119918&scope=bot%20applications.commands` + }) + ); + } + if (!client.guilds.cache.get(client.config.supportGuild.id)?.members.cache.has(message.author.id)) { + row.addComponents( + new MessageButton({ + style: 'LINK', + label: 'Support Server', + url: client.config.supportGuild.invite + }) + ); + } + row.addComponents( + new MessageButton({ + style: 'LINK', + label: 'GitHub', + url: packageDotJSON.repository + }) + ); + + return row; + } } diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts index a7df5aa..3cf27b6 100644 --- a/src/commands/info/pronouns.ts +++ b/src/commands/info/pronouns.ts @@ -39,7 +39,7 @@ export default class PronounsCommand extends BushCommand { const user = args.user ?? message.author; const author = user.id === message.author.id; - if (message.util.isSlashMessage(message)) await message.interaction.deferReply() + if (message.util.isSlashMessage(message)) await message.interaction.deferReply(); const pronouns = await util.getPronounsOf(user); if (!pronouns) { diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts index 3b1a073..deb5692 100644 --- a/src/commands/info/snowflake.ts +++ b/src/commands/info/snowflake.ts @@ -6,7 +6,8 @@ import { type CategoryChannel, type Channel, type DeconstructedSnowflake, - type DMChannel, type Guild, + type DMChannel, + type Guild, type NewsChannel, type Role, type Snowflake, @@ -60,7 +61,9 @@ export default class SnowflakeCommand extends BushCommand { if (['dm', 'group'].includes(channel.type)) { const _channel = channel as DMChannel; channelInfo.push(`**Recipient:** ${util.discord.escapeMarkdown(_channel.recipient.tag)} (${_channel.recipient.id})`); - snowflakeEmbed.setTitle(`:snowflake: DM with ${util.discord.escapeMarkdown((channel as DMChannel).recipient.tag)} \`[Channel]\``); + snowflakeEmbed.setTitle( + `:snowflake: DM with ${util.discord.escapeMarkdown((channel as DMChannel).recipient.tag)} \`[Channel]\`` + ); } else if ( [ 'GUILD_CATEGORY', @@ -89,7 +92,9 @@ export default class SnowflakeCommand extends BushCommand { const guild: Guild = client.guilds.cache.get(snowflake)!; const guildInfo = [ `**Name:** ${util.discord.escapeMarkdown(guild.name)}`, - `**Owner:** ${util.discord.escapeMarkdown(client.users.cache.get(guild.ownerId)?.tag ?? '¯\\_(ツ)_/¯')} (${guild.ownerId})`, + `**Owner:** ${util.discord.escapeMarkdown(client.users.cache.get(guild.ownerId)?.tag ?? '¯\\_(ツ)_/¯')} (${ + guild.ownerId + })`, `**Members:** ${guild.memberCount?.toLocaleString()}` ]; if (guild.icon) snowflakeEmbed.setThumbnail(guild.iconURL({ size: 2048, dynamic: true })!); @@ -110,7 +115,10 @@ export default class SnowflakeCommand extends BushCommand { // Emoji if (client.emojis.cache.has(snowflake)) { const emoji = client.emojis.cache.get(snowflake)!; - const emojiInfo = [`**Name:** ${util.discord.escapeMarkdown(emoji.name ?? '¯\\_(ツ)_/¯')}`, `**Animated:** ${emoji.animated}`]; + const emojiInfo = [ + `**Name:** ${util.discord.escapeMarkdown(emoji.name ?? '¯\\_(ツ)_/¯')}`, + `**Animated:** ${emoji.animated}` + ]; if (emoji.url) snowflakeEmbed.setThumbnail(emoji.url); snowflakeEmbed.addField('» Emoji Info', emojiInfo.join('\n')); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(emoji.name ?? '¯\\_(ツ)_/¯')} \`[Emoji]\``); diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 49c23c9..601e044 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -53,9 +53,7 @@ export default class UserInfoCommand extends BushCommand { const userEmbed: MessageEmbed = new MessageEmbed() .setTitle(util.discord.escapeMarkdown(user.tag)) - .setThumbnail( - user.displayAvatarURL({ size: 2048, format: 'png', dynamic: true }) - ) + .setThumbnail(user.displayAvatarURL({ size: 2048, format: 'png', dynamic: true })) .setTimestamp(); // Flags @@ -95,7 +93,7 @@ export default class UserInfoCommand extends BushCommand { 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 Promise.race([util.getPronounsOf(user), util.sleep(2)]); + const pronouns = await Promise.race([util.getPronounsOf(user), util.sleep(2)]); if (pronouns && typeof pronouns === 'string') generalInfo.push(`**Pronouns:** ${pronouns}`); userEmbed.addField('» General Info', generalInfo.join('\n')); @@ -137,7 +135,8 @@ export default class UserInfoCommand extends BushCommand { presenceInfo.push(`**${devices.length - 1 ? 'Devices' : 'Device'}:** ${util.oxford(devices, 'and', '')}`); if (activitiesNames.length) presenceInfo.push(`**Activit${activitiesNames.length - 1 ? 'ies' : 'y'}:** ${util.oxford(activitiesNames, 'and', '')}`); - if (customStatus && customStatus.length) presenceInfo.push(`**Custom Status:** ${util.discord.escapeMarkdown(customStatus)}`); + if (customStatus && customStatus.length) + presenceInfo.push(`**Custom Status:** ${util.discord.escapeMarkdown(customStatus)}`); userEmbed.addField('» Presence', presenceInfo.join('\n')); enum statusEmojis { diff --git a/src/commands/leveling/level.ts b/src/commands/leveling/level.ts index ea77124..eb86155 100644 --- a/src/commands/leveling/level.ts +++ b/src/commands/leveling/level.ts @@ -15,7 +15,7 @@ import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; // idk why I need to do default twice, it is being weird -const { default: SimplifyNumber } = ((await import('simplify-number')).default as unknown as typeof import('simplify-number')); +const { default: SimplifyNumber } = (await import('simplify-number')).default as unknown as typeof import('simplify-number'); export default class LevelCommand extends BushCommand { public constructor() { @@ -92,9 +92,12 @@ export default class LevelCommand extends BushCommand { gray = '#23272A', highlight = user.hexAccentColor ?? '#5865F2'; // Load roboto font - canvas.registerFont(join(dirname(fileURLToPath(import.meta.url)), '..', '..', '..', '..', 'lib', 'assets', 'Roboto-Regular.ttf'), { - family: 'Roboto' - }); + canvas.registerFont( + join(dirname(fileURLToPath(import.meta.url)), '..', '..', '..', '..', 'lib', 'assets', 'Roboto-Regular.ttf'), + { + family: 'Roboto' + } + ); // Create image canvas const levelCard = canvas.createCanvas(800, 200), ctx = levelCard.getContext('2d'); diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts index 5b77096..e05a409 100644 --- a/src/commands/moderation/slowmode.ts +++ b/src/commands/moderation/slowmode.ts @@ -1,4 +1,11 @@ -import { BushCommand, type BushMessage, type BushNewsChannel, type BushSlashMessage, type BushTextChannel, type BushThreadChannel } from '#lib'; +import { + BushCommand, + type BushMessage, + type BushNewsChannel, + type BushSlashMessage, + type BushTextChannel, + type BushThreadChannel +} from '#lib'; import { Argument } from 'discord-akairo'; import { TextChannel, ThreadChannel, type NewsChannel } from 'discord.js'; diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts index e1bda63..c31ce21 100644 --- a/src/commands/moderation/unmute.ts +++ b/src/commands/moderation/unmute.ts @@ -1,4 +1,12 @@ -import { AllowedMentions, BushCommand, Moderation, type BushGuildMember, type BushMessage, type BushSlashMessage, type BushUser } from '#lib'; +import { + AllowedMentions, + BushCommand, + Moderation, + type BushGuildMember, + type BushMessage, + type BushSlashMessage, + type BushUser +} from '#lib'; export default class UnmuteCommand extends BushCommand { public constructor() { diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts index 25b47ec..9b58cf6 100644 --- a/src/commands/moderation/warn.ts +++ b/src/commands/moderation/warn.ts @@ -1,4 +1,12 @@ -import { AllowedMentions, BushCommand, Moderation, type BushGuildMember, type BushMessage, type BushSlashMessage, type BushUser } from '#lib'; +import { + AllowedMentions, + BushCommand, + Moderation, + type BushGuildMember, + type BushMessage, + type BushSlashMessage, + type BushUser +} from '#lib'; export default class WarnCommand extends BushCommand { public constructor() { diff --git a/src/commands/utilities/uuid.ts b/src/commands/utilities/uuid.ts index 1be6079..556a4de 100644 --- a/src/commands/utilities/uuid.ts +++ b/src/commands/utilities/uuid.ts @@ -2,7 +2,7 @@ import { BushCommand, type BushMessage } from '#lib'; export default class UuidCommand extends BushCommand { public constructor() { - super('uuid', { + super('uuid', { aliases: ['uuid'], category: 'utilities', description: { diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts index 13512bb..f64fd4f 100644 --- a/src/commands/utilities/wolframAlpha.ts +++ b/src/commands/utilities/wolframAlpha.ts @@ -1,6 +1,6 @@ import { AllowedMentions, BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; +import { initializeClass as WolframAlphaAPI } from "@notenoughupdates/wolfram-alpha-api"; import { MessageEmbed, type MessageOptions } from 'discord.js'; -const { default: WolframAlphaAPI } = (await import("@notenoughupdates/wolfram-alpha-api")).default as unknown as typeof import("@notenoughupdates/wolfram-alpha-api") export default class WolframAlphaCommand extends BushCommand { public constructor() { diff --git a/src/inhibitors/blacklist/channelGlobalBlacklist.ts b/src/inhibitors/blacklist/channelGlobalBlacklist.ts index 5a0f0f1..b9d7240 100644 --- a/src/inhibitors/blacklist/channelGlobalBlacklist.ts +++ b/src/inhibitors/blacklist/channelGlobalBlacklist.ts @@ -15,7 +15,10 @@ export default class UserGlobalBlacklistInhibitor extends BushInhibitor { if (client.isOwner(message.author) || /* client.isSuperUser(message.author) ||*/ client.user!.id === message.author.id) return false; if (client.cache.global.blacklistedChannels.includes(message.channel!.id) && !command.bypassChannelBlacklist) { - void client.console.verbose('channelGlobalBlacklist', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.`) + void client.console.verbose( + 'channelGlobalBlacklist', + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` + ); return true; } return false; diff --git a/src/inhibitors/blacklist/channelGuildBlacklist.ts b/src/inhibitors/blacklist/channelGuildBlacklist.ts index a2c50e3..e881ebb 100644 --- a/src/inhibitors/blacklist/channelGuildBlacklist.ts +++ b/src/inhibitors/blacklist/channelGuildBlacklist.ts @@ -24,7 +24,10 @@ export default class ChannelGuildBlacklistInhibitor extends BushInhibitor { (await message.guild.getSetting('blacklistedChannels'))?.includes(message.channel!.id) && !command.bypassChannelBlacklist ) { - void client.console.verbose('channelGuildBlacklist', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.`) + void client.console.verbose( + 'channelGuildBlacklist', + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` + ); return true; } return false; diff --git a/src/inhibitors/blacklist/guildBlacklist.ts b/src/inhibitors/blacklist/guildBlacklist.ts index 4fb7b5a..b319475 100644 --- a/src/inhibitors/blacklist/guildBlacklist.ts +++ b/src/inhibitors/blacklist/guildBlacklist.ts @@ -18,7 +18,10 @@ export default class GuildBlacklistInhibitor extends BushInhibitor { ) return false; if (client.cache.global.blacklistedGuilds.includes(message.guild.id)) { - void client.console.verbose('guildBlacklist', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.`) + void client.console.verbose( + 'guildBlacklist', + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` + ); return true; } return false; diff --git a/src/inhibitors/blacklist/userGlobalBlacklist.ts b/src/inhibitors/blacklist/userGlobalBlacklist.ts index 5d07ddb..0f8cea7 100644 --- a/src/inhibitors/blacklist/userGlobalBlacklist.ts +++ b/src/inhibitors/blacklist/userGlobalBlacklist.ts @@ -15,7 +15,12 @@ export default class UserGlobalBlacklistInhibitor extends BushInhibitor { if (client.isOwner(message.author) || client.isSuperUser(message.author) || client.user!.id === message.author.id) return false; if (client.cache.global.blacklistedUsers.includes(message.author.id)) { - void client.console.verbose('userGlobalBlacklist', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.inGuild() ? message.guild?.name : message.author.tag}>>.`) + void client.console.verbose( + 'userGlobalBlacklist', + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${ + message.inGuild() ? message.guild?.name : message.author.tag + }>>.` + ); return true; } return false; diff --git a/src/inhibitors/blacklist/userGuildBlacklist.ts b/src/inhibitors/blacklist/userGuildBlacklist.ts index e1c40ce..a87e47c 100644 --- a/src/inhibitors/blacklist/userGuildBlacklist.ts +++ b/src/inhibitors/blacklist/userGuildBlacklist.ts @@ -15,7 +15,10 @@ export default class UserGuildBlacklistInhibitor extends BushInhibitor { if (client.isOwner(message.author) || client.isSuperUser(message.author) || client.user!.id === message.author.id) return false; if ((await message.guild.getSetting('blacklistedUsers'))?.includes(message.author.id)) { - void client.console.verbose('userGuildBlacklist', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.`) + void client.console.verbose( + 'userGuildBlacklist', + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` + ); return true; } return false; diff --git a/src/inhibitors/checks/fatal.ts b/src/inhibitors/checks/fatal.ts index 68e1371..2521b2f 100644 --- a/src/inhibitors/checks/fatal.ts +++ b/src/inhibitors/checks/fatal.ts @@ -14,7 +14,10 @@ export default class FatalInhibitor extends BushInhibitor { if (client.isOwner(message.author)) return false; for (const property in client.cache.global) { if (!client.cache.global[property as keyof typeof client.cache.global]) { - void client.console.verbose('fatal', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.`) + void client.console.verbose( + 'fatal', + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` + ); return true; } } diff --git a/src/inhibitors/checks/guildUnavailable.ts b/src/inhibitors/checks/guildUnavailable.ts index 38d0ffa..eb85fb7 100644 --- a/src/inhibitors/checks/guildUnavailable.ts +++ b/src/inhibitors/checks/guildUnavailable.ts @@ -12,7 +12,10 @@ export default class GuildUnavailableInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage): Promise<boolean> { if (message.guild && !message.guild.available) { - void client.console.verbose('guildUnavailable', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.`) + void client.console.verbose( + 'guildUnavailable', + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` + ); return true; } return false; diff --git a/src/inhibitors/command/dm.ts b/src/inhibitors/command/dm.ts index 34fcb12..ebcd647 100644 --- a/src/inhibitors/command/dm.ts +++ b/src/inhibitors/command/dm.ts @@ -12,7 +12,10 @@ export default class DMInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> { if (command.channel === 'dm' && message.guild) { - void client.console.verbose('dm', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.`) + void client.console.verbose( + 'dm', + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` + ); return true; } return false; diff --git a/src/inhibitors/command/globalDisabledCommand.ts b/src/inhibitors/command/globalDisabledCommand.ts index da267ef..82163f0 100644 --- a/src/inhibitors/command/globalDisabledCommand.ts +++ b/src/inhibitors/command/globalDisabledCommand.ts @@ -13,7 +13,10 @@ export default class DisabledGuildCommandInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> { if (message.author.isOwner()) return false; if (client.cache.global.disabledCommands?.includes(command?.id)) { - void client.console.verbose('disabledGlobalCommand', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.`) + void client.console.verbose( + 'disabledGlobalCommand', + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` + ); return true; } return false; diff --git a/src/inhibitors/command/guild.ts b/src/inhibitors/command/guild.ts index 9843972..69b5df9 100644 --- a/src/inhibitors/command/guild.ts +++ b/src/inhibitors/command/guild.ts @@ -12,7 +12,10 @@ export default class GuildInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> { if (command.channel === 'guild' && !message.guild) { - void client.console.verbose('guild', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.author.tag}>>.`) + void client.console.verbose( + 'guild', + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.author.tag}>>.` + ); return true; } return false; diff --git a/src/inhibitors/command/guildDisabledCommand.ts b/src/inhibitors/command/guildDisabledCommand.ts index 4343b1a..a04984d 100644 --- a/src/inhibitors/command/guildDisabledCommand.ts +++ b/src/inhibitors/command/guildDisabledCommand.ts @@ -15,7 +15,10 @@ export default class DisabledGuildCommandInhibitor extends BushInhibitor { if (message.author.isOwner() || message.author.isSuperUser()) return false; // super users bypass guild disabled commands if ((await message.guild.getSetting('disabledCommands'))?.includes(command?.id)) { - void client.console.verbose('disabledGuildCommand', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.`) + void client.console.verbose( + 'disabledGuildCommand', + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` + ); return true; } return false; diff --git a/src/inhibitors/command/nsfw.ts b/src/inhibitors/command/nsfw.ts index 7f0f3e7..fb4e51f 100644 --- a/src/inhibitors/command/nsfw.ts +++ b/src/inhibitors/command/nsfw.ts @@ -13,7 +13,10 @@ export default class NsfwInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> { if (command.onlyNsfw && !(message.channel as TextChannel).nsfw) { - void client.console.verbose('notNsfw', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.`) + void client.console.verbose( + 'notNsfw', + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` + ); return true; } return false; diff --git a/src/inhibitors/command/owner.ts b/src/inhibitors/command/owner.ts index 86bab76..8eee1e0 100644 --- a/src/inhibitors/command/owner.ts +++ b/src/inhibitors/command/owner.ts @@ -13,7 +13,10 @@ export default class OwnerInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> { if (command.ownerOnly) { if (!client.isOwner(message.author)) { - void client.console.verbose('owner', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.`) + void client.console.verbose( + 'owner', + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` + ); return true; } } diff --git a/src/inhibitors/command/restrictedChannel.ts b/src/inhibitors/command/restrictedChannel.ts index 265200e..c8f2e1e 100644 --- a/src/inhibitors/command/restrictedChannel.ts +++ b/src/inhibitors/command/restrictedChannel.ts @@ -13,7 +13,10 @@ export default class RestrictedChannelInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> { if (command.restrictedChannels?.length && message.channel) { if (!command.restrictedChannels.includes(message.channel.id)) { - void client.console.verbose('restrictedChannel', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.`) + void client.console.verbose( + 'restrictedChannel', + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` + ); return true; } } diff --git a/src/inhibitors/command/restrictedGuild.ts b/src/inhibitors/command/restrictedGuild.ts index a27220c..a8a5097 100644 --- a/src/inhibitors/command/restrictedGuild.ts +++ b/src/inhibitors/command/restrictedGuild.ts @@ -13,7 +13,10 @@ export default class RestrictedGuildInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> { if (command.restrictedChannels?.length && message.channel) { if (!command.restrictedChannels.includes(message.channel.id)) { - void client.console.verbose('restrictedGuild', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.`) + void client.console.verbose( + 'restrictedGuild', + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` + ); return true; } } diff --git a/src/inhibitors/command/superUser.ts b/src/inhibitors/command/superUser.ts index a34df6d..a7c1f47 100644 --- a/src/inhibitors/command/superUser.ts +++ b/src/inhibitors/command/superUser.ts @@ -13,7 +13,10 @@ export default class SuperUserInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> { if (command.superUserOnly) { if (!client.isSuperUser(message.author)) { - void client.console.verbose('superUser', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.`) + void client.console.verbose( + 'superUser', + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` + ); return true; } } diff --git a/src/lib/badwords.ts b/src/lib/badwords.ts index 20ca29d..cab7cec 100644 --- a/src/lib/badwords.ts +++ b/src/lib/badwords.ts @@ -359,7 +359,6 @@ export default { regex: false, }, - /* -------------------------------------------------------------------------- */ /* Misc Scams */ /* -------------------------------------------------------------------------- */ diff --git a/src/lib/common/ButtonPaginator.ts b/src/lib/common/ButtonPaginator.ts index 6a2dba2..b8ae249 100644 --- a/src/lib/common/ButtonPaginator.ts +++ b/src/lib/common/ButtonPaginator.ts @@ -1,11 +1,11 @@ import { DeleteButton, type BushMessage, type BushSlashMessage } from '#lib'; import { - Constants, - MessageActionRow, - MessageButton, - MessageEmbed, - type MessageComponentInteraction, - type MessageEmbedOptions + Constants, + MessageActionRow, + MessageButton, + MessageEmbed, + type MessageComponentInteraction, + type MessageEmbedOptions } from 'discord.js'; export class ButtonPaginator { @@ -75,7 +75,7 @@ export class ButtonPaginator { })) as BushMessage; const collector = this.sentMessage.createMessageComponentCollector({ - filter: (i) => i.customId.startsWith('paginate_') && i.message.id === this.sentMessage!.id, + filter: (i) => i.customId.startsWith('paginate_') && i.message?.id === this.sentMessage!.id, time: 300000 }); @@ -128,11 +128,13 @@ export class ButtonPaginator { } protected async edit(interaction: MessageComponentInteraction) { - return interaction?.update({ - content: this.text, - embeds: [this.embeds[this.curPage]], - components: [this.getPaginationRow()] - }).catch(() => null); + return interaction + ?.update({ + content: this.text, + embeds: [this.embeds[this.curPage]], + components: [this.getPaginationRow()] + }) + .catch(() => null); } protected getPaginationRow(disableAll = false): MessageActionRow { diff --git a/src/lib/common/DeleteButton.ts b/src/lib/common/DeleteButton.ts index 4792cf7..38ce6df 100644 --- a/src/lib/common/DeleteButton.ts +++ b/src/lib/common/DeleteButton.ts @@ -25,7 +25,7 @@ export class DeleteButton { const msg = (await this.message.util.reply(this.messageOptions)) as BushMessage; const collector = msg.createMessageComponentCollector({ - filter: (interaction) => interaction.customId == 'paginate__stop' && interaction.message.id == msg.id, + filter: (interaction) => interaction.customId == 'paginate__stop' && interaction.message?.id == msg.id, time: 300000 }); diff --git a/src/lib/common/Moderation.ts b/src/lib/common/Moderation.ts index 13ebf69..a7a037f 100644 --- a/src/lib/common/Moderation.ts +++ b/src/lib/common/Moderation.ts @@ -1,12 +1,12 @@ import { - ActivePunishment, - ActivePunishmentType, - Guild, - ModLog, - ModLogType, - type BushGuildMember, - type BushGuildMemberResolvable, - type BushGuildResolvable + ActivePunishment, + ActivePunishmentType, + Guild, + ModLog, + ModLogType, + type BushGuildMember, + type BushGuildMemberResolvable, + type BushGuildResolvable } from '#lib'; import { type Snowflake } from 'discord.js'; diff --git a/src/lib/common/typings/BushInspectOptions.d.ts b/src/lib/common/typings/BushInspectOptions.d.ts index e51e758..38c70b1 100644 --- a/src/lib/common/typings/BushInspectOptions.d.ts +++ b/src/lib/common/typings/BushInspectOptions.d.ts @@ -42,7 +42,7 @@ export interface BushInspectOptions extends InspectOptions { * **Default**: `false`. */ showProxy?: boolean | undefined; - + /** * Specifies the maximum number of `Array`, [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) and * [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) elements to include when formatting. Set to `null` or `Infinity` to @@ -88,7 +88,7 @@ export interface BushInspectOptions extends InspectOptions { * **Default**: `false`. */ sorted?: boolean | ((a: string, b: string) => number) | undefined; - + /** * If set to `true`, getters are inspected. If set to `'get'`, only getters without a * corresponding setter are inspected. If set to `'set'`, only getters with a diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 93ed9d7..59aea26 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -10,6 +10,7 @@ import type { BushUserManager, Config } from '#lib'; +import { patch, type PatchedElements } from '@notenoughupdates/events-intercept'; import * as Sentry from '@sentry/node'; import { AkairoClient, ContextMenuCommandHandler, version as akairoVersion } from 'discord-akairo'; import { @@ -18,7 +19,9 @@ import { Structures, version as discordJsVersion, type Awaitable, - type Collection, type DMChannel, type InteractionReplyOptions, + type Collection, + type DMChannel, + type InteractionReplyOptions, type Message, type MessageEditOptions, type MessageOptions, @@ -28,8 +31,6 @@ import { type Snowflake, type WebhookEditMessageOptions } from 'discord.js'; -//@ts-ignore: no typings -import eventsIntercept from 'events-intercept'; import path from 'path'; import readline from 'readline'; import type { Sequelize as SequelizeType } from 'sequelize'; @@ -92,7 +93,7 @@ export type BushThreadMemberResolvable = BushThreadMember | BushUserResolvable; export type BushUserResolvable = BushUser | Snowflake | BushMessage | BushGuildMember | BushThreadMember; export type BushGuildMemberResolvable = BushGuildMember | BushUserResolvable; export type BushRoleResolvable = BushRole | Snowflake; -export type BushMessageResolvable = Message| BushMessage | Snowflake; +export type BushMessageResolvable = Message | BushMessage | Snowflake; export type BushEmojiResolvable = Snowflake | BushGuildEmoji | BushReactionEmoji; export type BushEmojiIdentifierResolvable = string | BushEmojiResolvable; export type BushThreadChannelResolvable = BushThreadChannel | Snowflake; @@ -157,6 +158,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re makeCache: Options.cacheWithLimits({}), failIfNotExists: false }); + patch(this); this.token = config.token as If<Ready, string, string | null>; this.config = config; @@ -344,8 +346,6 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re * Starts the bot */ public async start() { - eventsIntercept.patch(this); - //@ts-expect-error: no typings this.intercept('ready', async (arg, done) => { await this.guilds.fetch(); const promises = this.guilds.cache.map((guild) => { @@ -386,23 +386,21 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re const userID = this.users.resolveId(user)!; return !!client.cache?.global?.superUsers?.includes(userID) || this.config.owners.includes(userID); } - - } -export interface BushClient { +export interface BushClient extends PatchedElements { on<K extends keyof BushClientEvents>(event: K, listener: (...args: BushClientEvents[K]) => Awaitable<void>): this; - on<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, listener: (...args: any[]) => Awaitable<void>): this + on<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, listener: (...args: any[]) => Awaitable<void>): this; once<K extends keyof BushClientEvents>(event: K, listener: (...args: BushClientEvents[K]) => Awaitable<void>): this; - once<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, listener: (...args: any[]) => Awaitable<void>): this + once<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, listener: (...args: any[]) => Awaitable<void>): this; emit<K extends keyof BushClientEvents>(event: K, ...args: BushClientEvents[K]): boolean; - emit<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, ...args: unknown[]): boolean + emit<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, ...args: unknown[]): boolean; off<K extends keyof BushClientEvents>(event: K, listener: (...args: BushClientEvents[K]) => Awaitable<void>): this; - off<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, listener: (...args: any[]) => Awaitable<void>): this + off<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, listener: (...args: any[]) => Awaitable<void>): this; removeAllListeners<K extends keyof BushClientEvents>(event?: K): this; - removeAllListeners<S extends string | symbol>(event?: Exclude<S, keyof BushClientEvents>): this + removeAllListeners<S extends string | symbol>(event?: Exclude<S, keyof BushClientEvents>): this; } diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index f21d104..8f1e67a 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -16,6 +16,7 @@ import { type Pronoun, type PronounCode } from '#lib'; +import { humanizeDuration } from '@notenoughupdates/humanize-duration'; import { exec } from 'child_process'; import { ClientUtil, Util as AkairoUtil } from 'discord-akairo'; import { APIMessage } from 'discord-api-types'; @@ -40,7 +41,6 @@ import moment from 'moment'; import { inspect, promisify } from 'util'; import CommandErrorListener from '../../../listeners/commands/commandError.js'; import { Format } from '../../common/Format.js'; -const { default: humanizeDuration } = await import ('humanize-duration') export class BushClientUtil extends ClientUtil { /** @@ -255,11 +255,11 @@ export class BushClientUtil extends ClientUtil { * @param options - The options you would like to use to inspect the object */ public inspect(object: any, options?: BushInspectOptions): string { - const optionsWithDefaults = this.getDefaultInspectOptions(options) + const optionsWithDefaults = this.getDefaultInspectOptions(options); return inspect(object, optionsWithDefaults); } - private getDefaultInspectOptions(options?:BushInspectOptions): BushInspectOptions { + private getDefaultInspectOptions(options?: BushInspectOptions): BushInspectOptions { const { showHidden = false, depth = 2, @@ -274,18 +274,18 @@ export class BushClientUtil extends ClientUtil { getters = true } = options ?? {}; return { - showHidden, - depth, - colors, - customInspect, - showProxy, - maxArrayLength, - maxStringLength, - breakLength, - compact, - sorted, + showHidden, + depth, + colors, + customInspect, + showProxy, + maxArrayLength, + maxStringLength, + breakLength, + compact, + sorted, getters - } + }; } #mapCredential(old: string): string { @@ -331,9 +331,7 @@ export class BushClientUtil extends ClientUtil { length = 1024 ) { input = - !inspectOptions?.inspectStrings && typeof input === 'string' - ? input - : this.inspect(input, inspectOptions ?? undefined); + !inspectOptions?.inspectStrings && typeof input === 'string' ? input : this.inspect(input, inspectOptions ?? undefined); if (inspectOptions) inspectOptions.inspectStrings = undefined; input = this.discord.cleanCodeBlockContent(input); input = this.redact(input); @@ -449,8 +447,8 @@ export class BushClientUtil extends ClientUtil { } public humanizeDuration(duration: number, largest?: number): string { - if (largest) return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2, largest }); - else return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2 }); + if (largest) return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2, largest })!; + else return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2 })!; } public timestampDuration(duration: number): string { diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts index 03f6606..11f5ee3 100644 --- a/src/lib/extensions/discord-akairo/BushCommand.ts +++ b/src/lib/extensions/discord-akairo/BushCommand.ts @@ -1,10 +1,16 @@ import { type BushClient, type BushCommandHandler, type BushMessage, type BushSlashMessage } from '#lib'; -import { Command, type ArgumentOptions, type ArgumentPromptOptions, type ArgumentTypeCaster, type CommandOptions } from 'discord-akairo'; +import { + Command, + type ArgumentOptions, + type ArgumentPromptOptions, + type ArgumentTypeCaster, + type CommandOptions +} from 'discord-akairo'; import { BaseArgumentType } from 'discord-akairo/dist/src/struct/commands/arguments/Argument'; import { type PermissionResolvable, type Snowflake } from 'discord.js'; -export type BaseBushArgumentType = - | BaseArgumentType +export type BaseBushArgumentType = + | BaseArgumentType | 'duration' | 'contentWithDuration' | 'permission' diff --git a/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts b/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts index 652a50f..c3c279e 100644 --- a/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts +++ b/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts @@ -1,11 +1,4 @@ -import type { - BushCategoryChannel, - BushClient, - BushGuild, - BushGuildMember, - BushMessageManager, - BushThreadManager -} from '#lib'; +import type { BushCategoryChannel, BushClient, BushGuild, BushGuildMember, BushMessageManager, BushThreadManager } from '#lib'; import { BaseGuildTextChannel, type AllowedThreadTypeForNewsChannel, diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index 5849749..ff920ce 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -191,7 +191,11 @@ export class BushGuild extends Guild { const userObject = client.users.cache.get(user.id); const dmSuccess = await userObject - ?.send(`You have been unbanned from **${util.discord.escapeMarkdown(this.toString())}** for **${options.reason ?? 'No reason provided'}**.`) + ?.send( + `You have been unbanned from **${util.discord.escapeMarkdown(this.toString())}** for **${ + options.reason ?? 'No reason provided' + }**.` + ) .catch(() => false); dmSuccessEvent = !!dmSuccess; diff --git a/src/lib/extensions/discord.js/BushGuildManager.d.ts b/src/lib/extensions/discord.js/BushGuildManager.d.ts index 5bb8822..4dd0750 100644 --- a/src/lib/extensions/discord.js/BushGuildManager.d.ts +++ b/src/lib/extensions/discord.js/BushGuildManager.d.ts @@ -3,7 +3,8 @@ import { CachedManager, type Collection, type FetchGuildOptions, - type FetchGuildsOptions, type GuildCreateOptions, + type FetchGuildsOptions, + type GuildCreateOptions, type OAuth2Guild, type Snowflake } from 'discord.js'; diff --git a/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts b/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts index 8b1248c..0866fce 100644 --- a/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts +++ b/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts @@ -1,11 +1,4 @@ -import type { - BushClient, - BushGuild, - BushGuildMember, - BushGuildMemberResolvable, - BushUser, - BushUserResolvable -} from '#lib'; +import type { BushClient, BushGuild, BushGuildMember, BushGuildMemberResolvable, BushUser, BushUserResolvable } from '#lib'; import { CachedManager, type AddGuildMemberOptions, diff --git a/src/lib/extensions/discord.js/BushMessageManager.d.ts b/src/lib/extensions/discord.js/BushMessageManager.d.ts index 9ded94c..f6bc8e7 100644 --- a/src/lib/extensions/discord.js/BushMessageManager.d.ts +++ b/src/lib/extensions/discord.js/BushMessageManager.d.ts @@ -1,26 +1,27 @@ import { BushMessageResolvable, type BushMessage, type BushTextBasedChannels } from '#lib'; import { - CachedManager, - type BaseFetchOptions, - type ChannelLogsQueryOptions, - type Collection, - type EmojiIdentifierResolvable, - type MessageEditOptions, - type MessagePayload, type Snowflake + CachedManager, + type BaseFetchOptions, + type ChannelLogsQueryOptions, + type Collection, + type EmojiIdentifierResolvable, + type MessageEditOptions, + type MessagePayload, + type Snowflake } from 'discord.js'; import type { RawMessageData } from 'discord.js/typings/rawDataTypes'; export class BushMessageManager extends CachedManager<Snowflake, BushMessage, BushMessageResolvable> { - public constructor(channel: BushTextBasedChannels, iterable?: Iterable<RawMessageData>); - public channel: BushTextBasedChannels; - public cache: Collection<Snowflake, BushMessage>; - public crosspost(message: BushMessageResolvable): Promise<BushMessage>; - public delete(message: BushMessageResolvable): Promise<void>; - public edit(message: BushMessageResolvable, options: MessagePayload | MessageEditOptions): Promise<BushMessage>; - public fetch(message: Snowflake, options?: BaseFetchOptions): Promise<BushMessage>; - public fetch(options?: ChannelLogsQueryOptions, cacheOptions?: BaseFetchOptions): Promise<Collection<Snowflake, BushMessage>>; - public fetchPinned(cache?: boolean): Promise<Collection<Snowflake, BushMessage>>; - public react(message: BushMessageResolvable, emoji: EmojiIdentifierResolvable): Promise<void>; - public pin(message: BushMessageResolvable): Promise<void>; - public unpin(message: BushMessageResolvable): Promise<void>; + public constructor(channel: BushTextBasedChannels, iterable?: Iterable<RawMessageData>); + public channel: BushTextBasedChannels; + public cache: Collection<Snowflake, BushMessage>; + public crosspost(message: BushMessageResolvable): Promise<BushMessage>; + public delete(message: BushMessageResolvable): Promise<void>; + public edit(message: BushMessageResolvable, options: MessagePayload | MessageEditOptions): Promise<BushMessage>; + public fetch(message: Snowflake, options?: BaseFetchOptions): Promise<BushMessage>; + public fetch(options?: ChannelLogsQueryOptions, cacheOptions?: BaseFetchOptions): Promise<Collection<Snowflake, BushMessage>>; + public fetchPinned(cache?: boolean): Promise<Collection<Snowflake, BushMessage>>; + public react(message: BushMessageResolvable, emoji: EmojiIdentifierResolvable): Promise<void>; + public pin(message: BushMessageResolvable): Promise<void>; + public unpin(message: BushMessageResolvable): Promise<void>; } diff --git a/src/lib/extensions/discord.js/BushThreadManager.d.ts b/src/lib/extensions/discord.js/BushThreadManager.d.ts index 6822a80..c824ae7 100644 --- a/src/lib/extensions/discord.js/BushThreadManager.d.ts +++ b/src/lib/extensions/discord.js/BushThreadManager.d.ts @@ -1,27 +1,25 @@ -import type { - BushThreadChannel -} from '#lib'; +import type { BushThreadChannel } from '#lib'; import { - CachedManager, - FetchedThreads, - NewsChannel, - TextChannel, - ThreadChannel, - type BaseFetchOptions, - type FetchArchivedThreadOptions, - type FetchThreadsOptions, - type Snowflake, - type ThreadChannelResolvable, - type ThreadCreateOptions + CachedManager, + FetchedThreads, + NewsChannel, + TextChannel, + ThreadChannel, + type BaseFetchOptions, + type FetchArchivedThreadOptions, + type FetchThreadsOptions, + type Snowflake, + type ThreadChannelResolvable, + type ThreadCreateOptions } from 'discord.js'; import type { RawThreadChannelData } from 'discord.js/typings/rawDataTypes'; export class BushThreadManager<AllowedThreadType> extends CachedManager<Snowflake, BushThreadChannel, ThreadChannelResolvable> { - public constructor(channel: TextChannel | NewsChannel, iterable?: Iterable<RawThreadChannelData>); - public channel: TextChannel | NewsChannel; - public create(options: ThreadCreateOptions<AllowedThreadType>): Promise<ThreadChannel>; - public fetch(options: ThreadChannelResolvable, cacheOptions?: BaseFetchOptions): Promise<ThreadChannel | null>; - public fetch(options?: FetchThreadsOptions, cacheOptions?: { cache?: boolean }): Promise<FetchedThreads>; - public fetchArchived(options?: FetchArchivedThreadOptions, cache?: boolean): Promise<FetchedThreads>; - public fetchActive(cache?: boolean): Promise<FetchedThreads>; -}
\ No newline at end of file + public constructor(channel: TextChannel | NewsChannel, iterable?: Iterable<RawThreadChannelData>); + public channel: TextChannel | NewsChannel; + public create(options: ThreadCreateOptions<AllowedThreadType>): Promise<ThreadChannel>; + public fetch(options: ThreadChannelResolvable, cacheOptions?: BaseFetchOptions): Promise<ThreadChannel | null>; + public fetch(options?: FetchThreadsOptions, cacheOptions?: { cache?: boolean }): Promise<FetchedThreads>; + public fetchArchived(options?: FetchArchivedThreadOptions, cache?: boolean): Promise<FetchedThreads>; + public fetchActive(cache?: boolean): Promise<FetchedThreads>; +} diff --git a/src/lib/extensions/discord.js/BushThreadMemberManager.d.ts b/src/lib/extensions/discord.js/BushThreadMemberManager.d.ts index 082d87c..7560c0e 100644 --- a/src/lib/extensions/discord.js/BushThreadMemberManager.d.ts +++ b/src/lib/extensions/discord.js/BushThreadMemberManager.d.ts @@ -1,11 +1,5 @@ import type { BushClient, BushThreadChannel, BushThreadMember, BushThreadMemberResolvable } from '#lib'; -import { - CachedManager, - type BaseFetchOptions, - type Collection, - type Snowflake, - type UserResolvable -} from 'discord.js'; +import { CachedManager, type BaseFetchOptions, type Collection, type Snowflake, type UserResolvable } from 'discord.js'; import type { RawThreadMemberData } from 'discord.js/typings/rawDataTypes'; export class BushThreadMemberManager extends CachedManager<Snowflake, BushThreadMember, BushThreadMemberResolvable> { @@ -14,7 +8,7 @@ export class BushThreadMemberManager extends CachedManager<Snowflake, BushThread public thread: BushThreadChannel; public add(member: UserResolvable | '@me', reason?: string): Promise<Snowflake>; public fetch(member?: UserResolvable, options?: BaseFetchOptions): Promise<BushThreadMember>; - /** @deprecated Use `fetch(member, options)` instead. */ + /** @deprecated Use `fetch(member, options)` instead. */ public fetch(cache?: boolean): Promise<Collection<Snowflake, BushThreadMember>>; public remove(id: Snowflake | '@me', reason?: string): Promise<Snowflake>; } diff --git a/src/lib/models/ActivePunishment.ts b/src/lib/models/ActivePunishment.ts index ec1b500..4512101 100644 --- a/src/lib/models/ActivePunishment.ts +++ b/src/lib/models/ActivePunishment.ts @@ -2,7 +2,7 @@ import { type Snowflake } from 'discord.js'; import { nanoid } from 'nanoid'; import { type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel.js'; -const { DataTypes } = (await import('sequelize')).default +const { DataTypes } = (await import('sequelize')).default; export enum ActivePunishmentType { BAN = 'BAN', @@ -35,38 +35,38 @@ export class ActivePunishment extends BaseModel<ActivePunishmentModel, ActivePunishmentModelCreationAttributes> implements ActivePunishmentModel { - /** - * The ID of this punishment (no real use just for a primary key) + /** + * The ID of this punishment (no real use just for a primary key) */ public declare id: string; - /** + /** * The type of punishment. */ public declare type: ActivePunishmentType; - /** - * The user who is punished. + /** + * The user who is punished. */ public declare user: Snowflake; - /** - * The guild they are punished in. + /** + * The guild they are punished in. */ public declare guild: Snowflake; - /** - * Additional info about the punishment if applicable. The channel id for channel blocks and role for punishment roles. + /** + * Additional info about the punishment if applicable. The channel id for channel blocks and role for punishment roles. */ public declare extraInfo: Snowflake; - /** - * The date when this punishment expires (optional). + /** + * The date when this punishment expires (optional). */ public declare expires: Date | null; - /** - * The reference to the modlog entry. + /** + * The reference to the modlog entry. */ public declare modlog: string; diff --git a/src/lib/models/Global.ts b/src/lib/models/Global.ts index b096c7f..e0cd7f9 100644 --- a/src/lib/models/Global.ts +++ b/src/lib/models/Global.ts @@ -3,7 +3,7 @@ import { type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel.js'; import { jsonArray } from './__helpers.js'; -const { DataTypes } = (await import('sequelize')).default +const { DataTypes } = (await import('sequelize')).default; export interface GlobalModel { environment: 'production' | 'development' | 'beta'; @@ -24,32 +24,32 @@ export interface GlobalModelCreationAttributes { } export class Global extends BaseModel<GlobalModel, GlobalModelCreationAttributes> implements GlobalModel { - /** - * The bot's environment. + /** + * The bot's environment. */ public declare environment: 'production' | 'development' | 'beta'; - /** - * Trusted users. + /** + * Trusted users. */ public declare superUsers: Snowflake[]; - /** - * Globally disabled commands. + /** + * Globally disabled commands. */ public declare disabledCommands: string[]; - /** - * Globally blacklisted users. + /** + * Globally blacklisted users. */ public declare blacklistedUsers: Snowflake[]; - /** - * Guilds blacklisted from using the bot. + /** + * Guilds blacklisted from using the bot. */ public declare blacklistedGuilds: Snowflake[]; - /** + /** * Channels where the bot is prevented from running commands in. */ public declare blacklistedChannels: Snowflake[]; diff --git a/src/lib/models/Guild.ts b/src/lib/models/Guild.ts index 78be846..02f487b 100644 --- a/src/lib/models/Guild.ts +++ b/src/lib/models/Guild.ts @@ -5,7 +5,7 @@ import { type BushClient } from '../extensions/discord-akairo/BushClient.js'; import { BaseModel } from './BaseModel.js'; import { jsonArray, jsonObject } from './__helpers.js'; -const { DataTypes } = (await import('sequelize')).default +const { DataTypes } = (await import('sequelize')).default; export interface GuildModel { id: Snowflake; @@ -50,93 +50,93 @@ export interface GuildModelCreationAttributes { } export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> implements GuildModel { - /** - * The ID of the guild + /** + * The ID of the guild */ public declare id: Snowflake; - /** - * The bot's prefix for the guild + /** + * The bot's prefix for the guild */ public declare prefix: string; - /** - * Channels that will have their messages automatically published + /** + * Channels that will have their messages automatically published */ public declare autoPublishChannels: Snowflake[]; - /** - * Channels where the bot won't respond in. + /** + * Channels where the bot won't respond in. */ public declare blacklistedChannels: Snowflake[]; - /** - * Users that the bot ignores in this guild + /** + * Users that the bot ignores in this guild */ public declare blacklistedUsers: Snowflake[]; - /** - * The channels where the welcome messages are sent + /** + * The channels where the welcome messages are sent */ public declare welcomeChannel: Snowflake; - /** - * The role given out when muting someone + /** + * The role given out when muting someone */ public declare muteRole: Snowflake; - /** - * The message that gets sent after someone gets a punishment dm + /** + * The message that gets sent after someone gets a punishment dm */ public declare punishmentEnding: string; - /** - * Guild specific disabled commands + /** + * Guild specific disabled commands */ public declare disabledCommands: string[]; - /** - * Channels that should get locked down when the lockdown command gets used. + /** + * Channels that should get locked down when the lockdown command gets used. */ public declare lockdownChannels: Snowflake[]; - /** - * Custom automod phases + /** + * Custom automod phases */ public declare autoModPhases: BadWords; - /** - * The features enabled in a guild + /** + * The features enabled in a guild */ public declare enabledFeatures: GuildFeatures[]; - /** - * The roles to assign to a user if they are not assigned sticky roles + /** + * The roles to assign to a user if they are not assigned sticky roles */ public declare joinRoles: Snowflake[]; - /** - * The channels where logging messages will be sent. + /** + * The channels where logging messages will be sent. */ public declare logChannels: LogChannelDB; - /** - * These users will be able to use commands in channels blacklisted + /** + * These users will be able to use commands in channels blacklisted */ public declare bypassChannelBlacklist: Snowflake[]; - /** - * Channels where users will not earn xp for leveling. + /** + * Channels where users will not earn xp for leveling. */ public declare noXpChannels: Snowflake[]; - /** - * What roles get given to users when they reach certain levels. + /** + * What roles get given to users when they reach certain levels. */ public declare levelRoles: { [level: number]: Snowflake }; - /** - * The channel to send level up messages in instead of last channel. + /** + * The channel to send level up messages in instead of last channel. */ public declare levelUpChannel: Snowflake; diff --git a/src/lib/models/Level.ts b/src/lib/models/Level.ts index f1083fc..baf359b 100644 --- a/src/lib/models/Level.ts +++ b/src/lib/models/Level.ts @@ -2,7 +2,7 @@ import { type Snowflake } from 'discord.js'; import { type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel.js'; -const { DataTypes } = (await import('sequelize')).default +const { DataTypes } = (await import('sequelize')).default; export interface LevelModel { user: Snowflake; @@ -17,13 +17,13 @@ export interface LevelModelCreationAttributes { } export class Level extends BaseModel<LevelModel, LevelModelCreationAttributes> implements LevelModel { - /** - * The user's id. + /** + * The user's id. */ public declare user: Snowflake; - /** - * The guild where the user is gaining xp. + /** + * The guild where the user is gaining xp. */ public declare guild: Snowflake; @@ -32,8 +32,8 @@ export class Level extends BaseModel<LevelModel, LevelModelCreationAttributes> i */ public declare xp: number; - /** - * The user's level. + /** + * The user's level. */ public get level(): number { return Level.convertXpToLevel(this.xp); diff --git a/src/lib/models/ModLog.ts b/src/lib/models/ModLog.ts index bb1be8c..7d656a4 100644 --- a/src/lib/models/ModLog.ts +++ b/src/lib/models/ModLog.ts @@ -3,7 +3,7 @@ import { nanoid } from 'nanoid'; import { type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel.js'; import { jsonBoolean } from './__helpers.js'; -const { DataTypes } = (await import('sequelize')).default +const { DataTypes } = (await import('sequelize')).default; export enum ModLogType { PERM_BAN = 'PERM_BAN', @@ -49,53 +49,53 @@ export interface ModLogModelCreationAttributes { } export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes> implements ModLogModel { - /** - * The primary key of the modlog entry. + /** + * The primary key of the modlog entry. */ public declare id: string; - - /** - * The type of punishment. + + /** + * The type of punishment. */ public declare type: ModLogType; - /** - * The user being punished. + /** + * The user being punished. */ public declare user: Snowflake; - /** - * The user carrying out the punishment. + /** + * The user carrying out the punishment. */ public declare moderator: Snowflake; - /** - * The reason the user is getting punished. + /** + * The reason the user is getting punished. */ public declare reason: string | null; - /** - * The amount of time the user is getting punished for. + /** + * The amount of time the user is getting punished for. */ public declare duration: number | null; - /** - * The guild the user is getting punished in. + /** + * The guild the user is getting punished in. */ public declare guild: Snowflake; - /** - * Evidence of what the user is getting punished for. + /** + * Evidence of what the user is getting punished for. */ public declare evidence: string; - /** - * Not an actual modlog just used so a punishment entry can be made. + /** + * Not an actual modlog just used so a punishment entry can be made. */ public declare pseudo: boolean; - /** - * Hides from the modlog command unless show hidden is specified. + /** + * Hides from the modlog command unless show hidden is specified. */ public declare hidden: boolean; diff --git a/src/lib/models/Stat.ts b/src/lib/models/Stat.ts index 31111df..4ecabb8 100644 --- a/src/lib/models/Stat.ts +++ b/src/lib/models/Stat.ts @@ -1,7 +1,7 @@ import { type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel.js'; import { jsonBigint } from './__helpers.js'; -const { DataTypes } = (await import('sequelize')).default +const { DataTypes } = (await import('sequelize')).default; type Environment = 'production' | 'development' | 'beta'; @@ -16,14 +16,14 @@ export interface StatModelCreationAttributes { } export class Stat extends BaseModel<StatModel, StatModelCreationAttributes> implements StatModel { - /** - * The bot's environment. + /** + * The bot's environment. */ public declare environment: Environment; - /** - * The number of commands used - */ + /** + * The number of commands used + */ public declare commandsUsed: bigint; public static initModel(sequelize: Sequelize): void { diff --git a/src/lib/models/StickyRole.ts b/src/lib/models/StickyRole.ts index 63c9726..64f0b4d 100644 --- a/src/lib/models/StickyRole.ts +++ b/src/lib/models/StickyRole.ts @@ -2,7 +2,7 @@ import { type Snowflake } from 'discord.js'; import { type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel.js'; import { jsonArray } from './__helpers.js'; -const { DataTypes } = (await import('sequelize')).default +const { DataTypes } = (await import('sequelize')).default; export interface StickyRoleModel { user: Snowflake; @@ -18,23 +18,23 @@ export interface StickyRoleModelCreationAttributes { } export class StickyRole extends BaseModel<StickyRoleModel, StickyRoleModelCreationAttributes> implements StickyRoleModel { - /** - * The id of the user the roles belongs to. + /** + * The id of the user the roles belongs to. */ public declare user: Snowflake; - /** - * The guild where this should happen. + /** + * The guild where this should happen. */ public declare guild: Snowflake; - /** - * The roles that the user should have returned + /** + * The roles that the user should have returned */ public declare roles: Snowflake[]; - /** - * The user's previous nickname + /** + * The user's previous nickname */ public declare nickname: string; diff --git a/src/lib/models/__helpers.ts b/src/lib/models/__helpers.ts index 8c98d5b..75737c5 100644 --- a/src/lib/models/__helpers.ts +++ b/src/lib/models/__helpers.ts @@ -1,6 +1,6 @@ import { type Model } from 'sequelize'; -const { DataTypes } = (await import('sequelize')).default +const { DataTypes } = (await import('sequelize')).default; export function jsonParseGet(this: Model, key: string): any { return JSON.parse(this.getDataValue(key)); diff --git a/src/lib/utils/BushCache.ts b/src/lib/utils/BushCache.ts index 3808538..bfbd7e3 100644 --- a/src/lib/utils/BushCache.ts +++ b/src/lib/utils/BushCache.ts @@ -8,8 +8,8 @@ export class BushCache { export class GlobalCache { public superUsers: Snowflake[] = []; - public disabledCommands: string[] = [] + public disabledCommands: string[] = []; public blacklistedChannels: Snowflake[] = []; public blacklistedGuilds: Snowflake[] = []; - public blacklistedUsers: Snowflake[] = []; + public blacklistedUsers: Snowflake[] = []; } diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts index c48f7d7..52b0f40 100644 --- a/src/lib/utils/BushConstants.ts +++ b/src/lib/utils/BushConstants.ts @@ -3,8 +3,8 @@ import { Constants, type ConstantsColors } from 'discord.js'; const rawCapeUrl = 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/'; export class BushConstants { public static get emojis() { - return BushEmojis - }; + return BushEmojis; + } public static colors: bushColors = { default: '#1FD8F1', @@ -74,8 +74,8 @@ export class BushConstants { }; public static get pronounMapping() { - return PronounMap - }; + return PronounMap; + } /** A bunch of mappings */ public static mappings = { @@ -329,20 +329,20 @@ export class BushConstants { }; public static get ArgumentMatches() { - return ArgumentMatchesEnum - }; + return ArgumentMatchesEnum; + } public static get ArgumentTypes() { - return BushArgumentTypesEnum - }; + return BushArgumentTypesEnum; + } public static get BlockedReasons() { - return BushBlockedReasonsEnum - }; + return BushBlockedReasonsEnum; + } public static get CommandHandlerEvents() { - return BushCommandHandlerEventsEnum - }; + return BushCommandHandlerEventsEnum; + } public static moulberryBushRoleMap = [ { name: '*', id: '792453550768390194' }, @@ -417,72 +417,72 @@ export enum BushEmojis { } export enum ArgumentMatchesEnum { - PHRASE = "phrase", - FLAG = "flag", - OPTION = "option", - REST = "rest", - SEPARATE = "separate", - TEXT = "text", - CONTENT = "content", - REST_CONTENT = "restContent", - NONE = "none" + PHRASE = 'phrase', + FLAG = 'flag', + OPTION = 'option', + REST = 'rest', + SEPARATE = 'separate', + TEXT = 'text', + CONTENT = 'content', + REST_CONTENT = 'restContent', + NONE = 'none' } export enum BushArgumentTypesEnum { - STRING = "string", - LOWERCASE = "lowercase", - UPPERCASE = "uppercase", - CHAR_CODES = "charCodes", - NUMBER = "number", - INTEGER = "integer", - BIGINT = "bigint", - EMOJINT = "emojint", - URL = "url", - DATE = "date", - COLOR = "color", - USER = "user", - USERS = "users", - MEMBER = "member", - MEMBERS = "members", - RELEVANT = "relevant", - RELEVANTS = "relevants", - CHANNEL = "channel", - CHANNELS = "channels", - TEXT_CHANNEL = "textChannel", - TEXT_CHANNELS = "textChannels", - VOICE_CHANNEL = "voiceChannel", - VOICE_CHANNELS = "voiceChannels", - CATEGORY_CHANNEL = "categoryChannel", - CATEGORY_CHANNELS = "categoryChannels", - NEWS_CHANNEL = "newsChannel", - NEWS_CHANNELS = "newsChannels", - STORE_CHANNEL = "storeChannel", - STORE_CHANNELS = "storeChannels", - STAGE_CHANNEL = "stageChannel", - STAGE_CHANNELS = "stageChannels", - THREAD_CHANNEL = "threadChannel", - THREAD_CHANNELS = "threadChannels", - ROLE = "role", - ROLES = "roles", - EMOJI = "emoji", - EMOJIS = "emojis", - GUILD = "guild", - GUILDS = "guilds", - MESSAGE = "message", - GUILD_MESSAGE = "guildMessage", - RELEVANT_MESSAGE = "relevantMessage", - INVITE = "invite", - USER_MENTION = "userMention", - MEMBER_MENTION = "memberMention", - CHANNEL_MENTION = "channelMention", - ROLE_MENTION = "roleMention", - EMOJI_MENTION = "emojiMention", - COMMAND_ALIAS = "commandAlias", - COMMAND = "command", - INHIBITOR = "inhibitor", - LISTENER = "listener", - TASK = "task", - CONTEXT_MENU_COMMAND = "contextMenuCommand", + STRING = 'string', + LOWERCASE = 'lowercase', + UPPERCASE = 'uppercase', + CHAR_CODES = 'charCodes', + NUMBER = 'number', + INTEGER = 'integer', + BIGINT = 'bigint', + EMOJINT = 'emojint', + URL = 'url', + DATE = 'date', + COLOR = 'color', + USER = 'user', + USERS = 'users', + MEMBER = 'member', + MEMBERS = 'members', + RELEVANT = 'relevant', + RELEVANTS = 'relevants', + CHANNEL = 'channel', + CHANNELS = 'channels', + TEXT_CHANNEL = 'textChannel', + TEXT_CHANNELS = 'textChannels', + VOICE_CHANNEL = 'voiceChannel', + VOICE_CHANNELS = 'voiceChannels', + CATEGORY_CHANNEL = 'categoryChannel', + CATEGORY_CHANNELS = 'categoryChannels', + NEWS_CHANNEL = 'newsChannel', + NEWS_CHANNELS = 'newsChannels', + STORE_CHANNEL = 'storeChannel', + STORE_CHANNELS = 'storeChannels', + STAGE_CHANNEL = 'stageChannel', + STAGE_CHANNELS = 'stageChannels', + THREAD_CHANNEL = 'threadChannel', + THREAD_CHANNELS = 'threadChannels', + ROLE = 'role', + ROLES = 'roles', + EMOJI = 'emoji', + EMOJIS = 'emojis', + GUILD = 'guild', + GUILDS = 'guilds', + MESSAGE = 'message', + GUILD_MESSAGE = 'guildMessage', + RELEVANT_MESSAGE = 'relevantMessage', + INVITE = 'invite', + USER_MENTION = 'userMention', + MEMBER_MENTION = 'memberMention', + CHANNEL_MENTION = 'channelMention', + ROLE_MENTION = 'roleMention', + EMOJI_MENTION = 'emojiMention', + COMMAND_ALIAS = 'commandAlias', + COMMAND = 'command', + INHIBITOR = 'inhibitor', + LISTENER = 'listener', + TASK = 'task', + CONTEXT_MENU_COMMAND = 'contextMenuCommand', DURATION = 'duration', CONTENT_WITH_DURATION = 'contentWithDuration', PERMISSION = 'permission', @@ -490,7 +490,7 @@ export enum BushArgumentTypesEnum { DISCORD_EMOJI = 'discordEmoji', ROLE_WITH_DURATION = 'roleWithDuration', ABBREVIATED_NUMBER = 'abbreviatedNumber', - GLOBAL_USER = 'globalUser', + GLOBAL_USER = 'globalUser' } export enum BushBlockedReasonsEnum { @@ -501,7 +501,7 @@ export enum BushBlockedReasonsEnum { GUILD = 'guild', DM = 'dm', AUTHOR_NOT_FOUND = 'authorNotFound', - NOT_NSFW = "notNsfw", + NOT_NSFW = 'notNsfw', DISABLED_GUILD = 'disabledGuild', DISABLED_GLOBAL = 'disabledGlobal', ROLE_BLACKLIST = 'roleBlacklist', @@ -514,26 +514,26 @@ export enum BushBlockedReasonsEnum { } export enum BushCommandHandlerEventsEnum { - COMMAND_BLOCKED = "commandBlocked", - COMMAND_BREAKOUT = "commandBreakout", - COMMAND_CANCELLED = "commandCancelled", - COMMAND_FINISHED = "commandFinished", - COMMAND_INVALID = "commandInvalid", - COMMAND_LOCKED = "commandLocked", - COMMAND_STARTED = "commandStarted", - COOLDOWN = "cooldown", - ERROR = "error", - IN_PROMPT = "inPrompt", - MESSAGE_BLOCKED = "messageBlocked", - MESSAGE_INVALID = "messageInvalid", - MISSING_PERMISSIONS = "missingPermissions", - SLASH_BLOCKED = "slashBlocked", - SLASH_ERROR = "slashError", - SLASH_FINISHED = "slashFinished", - SLASH_MISSING_PERMISSIONS = "slashMissingPermissions", - SLASH_NOT_FOUND = "slashNotFound", - SLASH_STARTED = "slashStarted", - SLASH_ONLY = "slashOnly" + COMMAND_BLOCKED = 'commandBlocked', + COMMAND_BREAKOUT = 'commandBreakout', + COMMAND_CANCELLED = 'commandCancelled', + COMMAND_FINISHED = 'commandFinished', + COMMAND_INVALID = 'commandInvalid', + COMMAND_LOCKED = 'commandLocked', + COMMAND_STARTED = 'commandStarted', + COOLDOWN = 'cooldown', + ERROR = 'error', + IN_PROMPT = 'inPrompt', + MESSAGE_BLOCKED = 'messageBlocked', + MESSAGE_INVALID = 'messageInvalid', + MISSING_PERMISSIONS = 'missingPermissions', + SLASH_BLOCKED = 'slashBlocked', + SLASH_ERROR = 'slashError', + SLASH_FINISHED = 'slashFinished', + SLASH_MISSING_PERMISSIONS = 'slashMissingPermissions', + SLASH_NOT_FOUND = 'slashNotFound', + SLASH_STARTED = 'slashStarted', + SLASH_ONLY = 'slashOnly' } interface bushColors { @@ -562,5 +562,5 @@ interface bushColors { discord: ConstantsColors; } -export type PronounCode = keyof typeof PronounMap -export type Pronoun = PronounMap
\ No newline at end of file +export type PronounCode = keyof typeof PronounMap; +export type Pronoun = PronounMap; diff --git a/src/listeners/commands/commandBlocked.ts b/src/listeners/commands/commandBlocked.ts index 20c0f6e..7c5bc67 100644 --- a/src/listeners/commands/commandBlocked.ts +++ b/src/listeners/commands/commandBlocked.ts @@ -50,7 +50,9 @@ export default class CommandBlockedListener extends BushListener { } case reasons.DISABLED_GUILD: { return await respond({ - content: `${util.emojis.error} The ${util.format.bold(command!.toString())} command is currently disabled in \`${message.guild?.name}\`.`, + content: `${util.emojis.error} The ${util.format.bold(command!.toString())} command is currently disabled in \`${ + message.guild?.name + }\`.`, ephemeral: true }); } diff --git a/src/listeners/guild/guildMemberRemove.ts b/src/listeners/guild/guildMemberRemove.ts index ac0f341..393eea6 100644 --- a/src/listeners/guild/guildMemberRemove.ts +++ b/src/listeners/guild/guildMemberRemove.ts @@ -1,4 +1,11 @@ -import { BushGuildMember, BushListener, BushTextChannel, StickyRole, type BushClientEvents, type PartialBushGuildMember } from '#lib'; +import { + BushGuildMember, + BushListener, + BushTextChannel, + StickyRole, + type BushClientEvents, + type PartialBushGuildMember +} from '#lib'; import { MessageEmbed, Util } from 'discord.js'; export default class GuildMemberRemoveListener extends BushListener { diff --git a/src/listeners/message/autoThread.ts b/src/listeners/message/autoThread.ts index f817802..c326cec 100644 --- a/src/listeners/message/autoThread.ts +++ b/src/listeners/message/autoThread.ts @@ -37,11 +37,13 @@ export default class autoThreadListener extends BushListener { if (message.guild.id !== '516977525906341928') return; // mb if (message.channel.id !== '714332750156660756') return; // neu-support-1 if (!(message.channel as BushTextChannel).permissionsFor(message.guild.me!).has('CREATE_PUBLIC_THREADS')) return; - const thread = await message.startThread({ - name: `Support - ${message.author.username}#${message.author.discriminator}`, - autoArchiveDuration: 60, - reason: 'Support Thread' - }).catch(() => null); + const thread = await message + .startThread({ + name: `Support - ${message.author.username}#${message.author.discriminator}`, + autoArchiveDuration: 60, + reason: 'Support Thread' + }) + .catch(() => null); if (!thread) return; const embed = new MessageEmbed() .setTitle('NotEnoughUpdates Support') diff --git a/src/listeners/message/directMessage.ts b/src/listeners/message/directMessage.ts index b6cdf59..2eab341 100644 --- a/src/listeners/message/directMessage.ts +++ b/src/listeners/message/directMessage.ts @@ -18,15 +18,18 @@ export default class DirectMessageListener extends BushListener { if (message.author.id != client.user!.id) { dmLogEmbed - .setAuthor(`From: ${message.author.username}`, `${message.author.displayAvatarURL({ dynamic: true })}`) + .setAuthor({ + name: `From: ${message.author.username}`, + iconURL: `${message.author.displayAvatarURL({ dynamic: true })}` + }) .setDescription(`**DM:**\n${message}`) .setColor(util.colors.blue); } else { dmLogEmbed - .setAuthor( - `To: ${message.channel.recipient.username}`, - `${message.channel.recipient.displayAvatarURL({ dynamic: true })}` - ) + .setAuthor({ + name: `To: ${message.channel.recipient.username}`, + iconURL: `${message.channel.recipient.displayAvatarURL({ dynamic: true })}` + }) .setDescription(`**DM:**\n${message}`) .setColor(util.colors.red) .setTimestamp(); |