aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/admin/channelPermissions.ts2
-rw-r--r--src/commands/config/_customAutomodPhrases.ts2
-rw-r--r--src/commands/config/blacklist.ts8
-rw-r--r--src/commands/config/config.ts10
-rw-r--r--src/commands/config/disable.ts8
-rw-r--r--src/commands/config/features.ts2
-rw-r--r--src/commands/dev/dm.ts2
-rw-r--r--src/commands/dev/eval.ts8
-rw-r--r--src/commands/dev/javascript.ts7
-rw-r--r--src/commands/dev/reload.ts27
-rw-r--r--src/commands/dev/say.ts2
-rw-r--r--src/commands/dev/servers.ts4
-rw-r--r--src/commands/dev/sh.ts13
-rw-r--r--src/commands/dev/superUser.ts15
-rw-r--r--src/commands/dev/test.ts10
-rw-r--r--src/commands/info/botInfo.ts23
-rw-r--r--src/commands/info/guildInfo.ts2
-rw-r--r--src/commands/info/help.ts13
-rw-r--r--src/commands/info/links.ts4
-rw-r--r--src/commands/info/pronouns.ts3
-rw-r--r--src/commands/info/snowflake.ts27
-rw-r--r--src/commands/info/userInfo.ts16
-rw-r--r--src/commands/leveling/leaderboard.ts3
-rw-r--r--src/commands/leveling/level.ts3
-rw-r--r--src/commands/moderation/_activePunishments.ts12
-rw-r--r--src/commands/moderation/ban.ts4
-rw-r--r--src/commands/moderation/evidence.ts2
-rw-r--r--src/commands/moderation/hideCase.ts2
-rw-r--r--src/commands/moderation/massBan.ts2
-rw-r--r--src/commands/moderation/massEvidence.ts2
-rw-r--r--src/commands/moderation/modlog.ts3
-rw-r--r--src/commands/moderation/mute.ts3
-rw-r--r--src/commands/moderation/purge.ts2
-rw-r--r--src/commands/moderation/unmute.ts3
-rw-r--r--src/commands/moulberry-bush/giveawayPing.ts35
-rw-r--r--src/commands/moulberry-bush/report.ts2
-rw-r--r--src/commands/utilities/_poll.ts2
-rw-r--r--src/commands/utilities/activity.ts2
-rw-r--r--src/commands/utilities/calculator.ts14
-rw-r--r--src/commands/utilities/decode.ts9
-rw-r--r--src/commands/utilities/highlight-add.ts2
-rw-r--r--src/commands/utilities/highlight-clear.ts2
-rw-r--r--src/commands/utilities/highlight-matches.ts2
-rw-r--r--src/commands/utilities/highlight-remove.ts2
-rw-r--r--src/commands/utilities/highlight-show.ts2
-rw-r--r--src/commands/utilities/viewRaw.ts3
-rw-r--r--src/commands/utilities/wolframAlpha.ts19
47 files changed, 169 insertions, 176 deletions
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts
index 12245a9..15a1128 100644
--- a/src/commands/admin/channelPermissions.ts
+++ b/src/commands/admin/channelPermissions.ts
@@ -89,7 +89,7 @@ export default class ChannelPermissionsCommand extends BushCommand {
{ reason: 'Changing overwrites for mass channel perms command' }
);
} catch (e) {
- void client.console.error('channelPermissions', formatError(e, false));
+ void this.client.console.error('channelPermissions', formatError(e, false));
failedChannels.push(channel);
}
}
diff --git a/src/commands/config/_customAutomodPhrases.ts b/src/commands/config/_customAutomodPhrases.ts
index d60688c..0b571e5 100644
--- a/src/commands/config/_customAutomodPhrases.ts
+++ b/src/commands/config/_customAutomodPhrases.ts
@@ -1,4 +1,4 @@
-// import { BushCommand, type ArgType, type CommandMessage, type OptArgType, type SlashMessage } from '#lib';
+// import { BushCommand, clientSendAndPermCheck, type ArgType, type CommandMessage, type OptArgType, type SlashMessage } from '#lib';
// import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
// export default class CustomAutomodPhrasesCommand extends BushCommand {
diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts
index 80acd0b..6768a1c 100644
--- a/src/commands/config/blacklist.ts
+++ b/src/commands/config/blacklist.ts
@@ -6,8 +6,6 @@ import {
clientSendAndPermCheck,
emojis,
format,
- getGlobal,
- setGlobal,
type ArgType,
type CommandMessage,
type SlashMessage
@@ -83,10 +81,10 @@ export default class BlacklistCommand extends BushCommand {
if (!global) assert(message.inGuild());
const blacklistedUsers = global
- ? getGlobal('blacklistedUsers')
+ ? this.client.utils.getGlobal('blacklistedUsers')
: (await message.guild!.getSetting('blacklistedChannels')) ?? [];
const blacklistedChannels = global
- ? getGlobal('blacklistedChannels')
+ ? this.client.utils.getGlobal('blacklistedChannels')
: (await message.guild!.getSetting('blacklistedUsers')) ?? [];
if (action === 'toggle') {
action = blacklistedUsers.includes(targetID) || blacklistedChannels.includes(targetID) ? 'unblacklist' : 'blacklist';
@@ -100,7 +98,7 @@ export default class BlacklistCommand extends BushCommand {
const key = target instanceof User ? 'blacklistedUsers' : 'blacklistedChannels';
const success = await (global
- ? setGlobal(key, newValue)
+ ? this.client.utils.setGlobal(key, newValue)
: message.guild!.setSetting(key, newValue, message.member as GuildMember)
).catch(() => false);
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts
index f0db467..66e10b6 100644
--- a/src/commands/config/config.ts
+++ b/src/commands/config/config.ts
@@ -6,9 +6,7 @@ import {
emojis,
GuildNoArraySetting,
guildSettingsObj,
- inspectAndRedact,
oxford,
- prefix,
settingsArr,
type ArgType,
type CommandMessage,
@@ -284,7 +282,7 @@ export default class ConfigCommand extends BushCommand {
});
collector.on('collect', async (interaction: MessageComponentInteraction) => {
- if (interaction.user.id === message.author.id || client.config.owners.includes(interaction.user.id)) {
+ if (interaction.user.id === message.author.id || this.client.config.owners.includes(interaction.user.id)) {
assert(message.inGuild());
switch (interaction.customId) {
@@ -346,7 +344,7 @@ export default class ConfigCommand extends BushCommand {
const func = ((): ((v: string | any) => string) => {
switch (type.replace('-array', '') as BaseSettingTypes) {
case 'string':
- return (v) => inspectAndRedact(v);
+ return (v) => this.client.utils.inspectAndRedact(v);
case 'channel':
return (v) => `<#${v}>`;
case 'role':
@@ -354,7 +352,7 @@ export default class ConfigCommand extends BushCommand {
case 'user':
return (v) => `<@${v}>`;
case 'custom':
- return inspectAndRedact;
+ return this.client.utils.inspectAndRedact;
default:
return (v) => v;
}
@@ -377,7 +375,7 @@ export default class ConfigCommand extends BushCommand {
);
settingsEmbed.setFooter({
- text: `Run "${prefix(message)}${message.util.parsed?.alias ?? 'config'} ${
+ text: `Run "${this.client.utils.prefix(message)}${message.util.parsed?.alias ?? 'config'} ${
message.util.isSlash ? snakeCase(setting) : setting
} ${guildSettingsObj[setting].type.includes('-array') ? 'add/remove' : 'set'} <value>" to set this setting.`
});
diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts
index 4f52b7c..e9866d5 100644
--- a/src/commands/config/disable.ts
+++ b/src/commands/config/disable.ts
@@ -5,8 +5,6 @@ import {
BushCommand,
clientSendAndPermCheck,
emojis,
- getGlobal,
- setGlobal,
type ArgType,
type CommandMessage,
type SlashMessage
@@ -81,12 +79,14 @@ export default class DisableCommand extends BushCommand {
if (DisableCommand.blacklistedCommands.includes(commandID))
return message.util.send(`${emojis.error} the ${commandID} command cannot be disabled.`);
- const disabledCommands = global ? getGlobal('disabledCommands') : await message.guild.getSetting('disabledCommands');
+ const disabledCommands = global
+ ? this.client.utils.getGlobal('disabledCommands')
+ : await message.guild.getSetting('disabledCommands');
if (action === 'toggle') action = disabledCommands.includes(commandID) ? 'disable' : 'enable';
const newValue = addOrRemoveFromArray(action === 'disable' ? 'add' : 'remove', disabledCommands, commandID);
const success = global
- ? await setGlobal('disabledCommands', newValue).catch(() => false)
+ ? await this.client.utils.setGlobal('disabledCommands', newValue).catch(() => false)
: await message.guild.setSetting('disabledCommands', newValue, message.member!).catch(() => false);
if (!success)
return await message.util.reply({
diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts
index e88f4b7..affcde3 100644
--- a/src/commands/config/features.ts
+++ b/src/commands/config/features.ts
@@ -51,7 +51,7 @@ export default class FeaturesCommand extends BushCommand {
});
collector.on('collect', async (interaction: SelectMenuInteraction) => {
- if (interaction.user.id === message.author.id || client.config.owners.includes(interaction.user.id)) {
+ if (interaction.user.id === message.author.id || this.client.config.owners.includes(interaction.user.id)) {
assert(message.inGuild());
const [selected]: GuildFeatures[] = interaction.values as GuildFeatures[];
diff --git a/src/commands/dev/dm.ts b/src/commands/dev/dm.ts
index f1e2bce..c1340b1 100644
--- a/src/commands/dev/dm.ts
+++ b/src/commands/dev/dm.ts
@@ -41,7 +41,7 @@ export default class DMCommand extends BushCommand {
args: { user: ArgType<'user'>; content: ArgType<'string'> }
) {
try {
- await client.users.send(args.user.id, args.content);
+ await this.client.users.send(args.user.id, args.content);
} catch (e) {
return message.util.reply(`${emojis.error} There was an error sending ${format.input(args.user.tag)} a dm.`);
}
diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts
index 239a06a..2be2963 100644
--- a/src/commands/dev/eval.ts
+++ b/src/commands/dev/eval.ts
@@ -11,7 +11,6 @@ import {
getMethods,
Global,
Guild,
- inspectCleanRedactCodeblock,
Level,
ModLog,
Shared,
@@ -243,10 +242,11 @@ export default class EvalCommand extends BushCommand {
/* eslint-disable @typescript-eslint/no-unused-vars */
const me = message.member,
member = message.member,
- bot = client,
+ bot = this.client,
+ client = this.client,
guild = message.guild,
channel = message.channel,
- config = client.config,
+ config = this.client.config,
members = message.guild?.members,
roles = message.guild?.roles;
/* eslint-enable @typescript-eslint/no-unused-vars */
@@ -315,7 +315,7 @@ export default class EvalCommand extends BushCommand {
options.depth ??= 1;
options.getters ??= true;
- return inspectCleanRedactCodeblock(obj, language, options);
+ return this.client.utils.inspectCleanRedactCodeblock(obj, language, options);
}
}
diff --git a/src/commands/dev/javascript.ts b/src/commands/dev/javascript.ts
index 7c47f2f..e472a5a 100644
--- a/src/commands/dev/javascript.ts
+++ b/src/commands/dev/javascript.ts
@@ -3,7 +3,6 @@ import {
clientSendAndPermCheck,
colors,
emojis,
- inspectCleanRedactCodeblock,
type ArgType,
type CommandMessage,
type OptArgType,
@@ -60,13 +59,13 @@ export default class JavascriptCommand extends BushCommand {
}
const code = args.code.replace(/[โ€œโ€]/g, '"').replace(/```*(?:js)?/g, '');
const embed = new EmbedBuilder();
- const input = await inspectCleanRedactCodeblock(code, 'js');
+ const input = await this.client.utils.inspectCleanRedactCodeblock(code, 'js');
try {
const rawOutput = /^(9\s*?\+\s*?10)|(10\s*?\+\s*?9)$/.test(code)
? '21'
: new VM({ eval: true, wasm: true, timeout: 1_000, fixAsync: true }).run(`${code}`);
- const output = await inspectCleanRedactCodeblock(rawOutput, 'js', {
+ const output = await this.client.utils.inspectCleanRedactCodeblock(rawOutput, 'js', {
depth: args.sel_depth ?? 0,
getters: true,
inspectStrings: true,
@@ -82,7 +81,7 @@ export default class JavascriptCommand extends BushCommand {
embed.setTitle(`${emojis.errorFull} Unable to Evaluate Expression`).setColor(colors.error);
embed.addFields([
{ name: '๐Ÿ“ฅ Input', value: input },
- { name: '๐Ÿ“ค Error', value: await inspectCleanRedactCodeblock(e, 'js', { colors: false }) }
+ { name: '๐Ÿ“ค Error', value: await this.client.utils.inspectCleanRedactCodeblock(e, 'js', { colors: false }) }
]);
}
diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts
index 8c2000f..40d53eb 100644
--- a/src/commands/dev/reload.ts
+++ b/src/commands/dev/reload.ts
@@ -1,13 +1,4 @@
-import {
- BushCommand,
- clientSendAndPermCheck,
- codeblock,
- emojis,
- formatError,
- shell,
- type CommandMessage,
- type SlashMessage
-} from '#lib';
+import { BushCommand, clientSendAndPermCheck, emojis, formatError, shell, type CommandMessage, type SlashMessage } from '#lib';
export default class ReloadCommand extends BushCommand {
public constructor() {
@@ -44,17 +35,19 @@ export default class ReloadCommand extends BushCommand {
const s = new Date();
output = await shell(`yarn build:${/* args.fast ? 'esbuild' : */ 'tsc'}`);
await Promise.all([
- client.commandHandler.reloadAll(),
- client.listenerHandler.reloadAll(),
- client.inhibitorHandler.reloadAll(),
- client.contextMenuCommandHandler.reloadAll(),
- client.taskHandler.reloadAll()
+ this.client.commandHandler.reloadAll(),
+ this.client.listenerHandler.reloadAll(),
+ this.client.inhibitorHandler.reloadAll(),
+ this.client.contextMenuCommandHandler.reloadAll(),
+ this.client.taskHandler.reloadAll()
]);
return message.util.send(`๐Ÿ” Successfully reloaded! (${new Date().getTime() - s.getTime()}ms)`);
} catch (e) {
- if (output!) void client.logger.error('reloadCommand', output);
- return message.util.send(`An error occurred while reloading:\n${await codeblock(formatError(e), 2048 - 34, 'js', true)}`);
+ if (output!) void this.client.logger.error('reloadCommand', output);
+ return message.util.send(
+ `An error occurred while reloading:\n${await this.client.utils.codeblock(formatError(e), 2048 - 34, 'js', true)}`
+ );
}
}
}
diff --git a/src/commands/dev/say.ts b/src/commands/dev/say.ts
index 6ec52a1..2246588 100644
--- a/src/commands/dev/say.ts
+++ b/src/commands/dev/say.ts
@@ -43,7 +43,7 @@ export default class SayCommand extends BushCommand {
}
public override async execSlash(message: SlashMessage, args: { content: string }) {
- if (!client.config.owners.includes(message.author.id)) {
+ if (!this.client.config.owners.includes(message.author.id)) {
return await message.interaction.reply({
content: `${emojis.error} Only my developers can run this command.`,
ephemeral: true
diff --git a/src/commands/dev/servers.ts b/src/commands/dev/servers.ts
index 28a4e5d..ab66f1c 100644
--- a/src/commands/dev/servers.ts
+++ b/src/commands/dev/servers.ts
@@ -26,7 +26,7 @@ export default class ServersCommand extends BushCommand {
}
public override async exec(message: CommandMessage | SlashMessage) {
- const guilds = [...client.guilds.cache.sort((a, b) => (a.memberCount < b.memberCount ? 1 : -1)).values()];
+ const guilds = [...this.client.guilds.cache.sort((a, b) => (a.memberCount < b.memberCount ? 1 : -1)).values()];
const chunkedGuilds: Guild[][] = chunk(guilds, 10);
const embeds: APIEmbed[] = chunkedGuilds.map((chunk) => {
return {
@@ -36,7 +36,7 @@ export default class ServersCommand extends BushCommand {
name: format.input(guild.name),
value: stripIndent`
**ID:** ${guild.id}
- **Owner:** ${client.users.cache.has(guild.ownerId) ? client.users.cache.get(guild.ownerId)!.tag : guild.ownerId}
+ **Owner:** ${this.client.users.cache.has(guild.ownerId) ? this.client.users.cache.get(guild.ownerId)!.tag : guild.ownerId}
**Members:** ${guild.memberCount.toLocaleString()}`
}))
} as APIEmbed;
diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts
index f7c17bd..7ffdf27 100644
--- a/src/commands/dev/sh.ts
+++ b/src/commands/dev/sh.ts
@@ -2,7 +2,6 @@ import {
ArgType,
BushCommand,
clientSendAndPermCheck,
- codeblock,
colors,
emojis,
formatError,
@@ -51,7 +50,7 @@ export default class ShCommand extends BushCommand {
}
public override async exec(message: CommandMessage | SlashMessage, args: { command: ArgType<'string'> }) {
- if (!client.config.owners.includes(message.author.id))
+ if (!this.client.config.owners.includes(message.author.id))
return await message.util.reply(`${emojis.error} Only my developers can run this command.`);
const input = clean(args.command);
@@ -61,7 +60,7 @@ export default class ShCommand extends BushCommand {
.setTimestamp()
.setTitle('Shell Command')
.addFields([
- { name: '๐Ÿ“ฅ Input', value: await codeblock(input, 1024, 'sh', true) },
+ { name: '๐Ÿ“ฅ Input', value: await this.client.utils.codeblock(input, 1024, 'sh', true) },
{ name: 'Running', value: emojis.loading }
]);
@@ -81,12 +80,14 @@ export default class ShCommand extends BushCommand {
embed.setTitle(`${emojis.successFull} Executed command successfully.`).setColor(colors.success).spliceFields(1, 1);
- if (stdout) embed.addFields([{ name: '๐Ÿ“ค stdout', value: await codeblock(stdout, 1024, 'ansi', true) }]);
- if (stderr) embed.addFields([{ name: '๐Ÿ“ค stderr', value: await codeblock(stderr, 1024, 'ansi', true) }]);
+ if (stdout) embed.addFields([{ name: '๐Ÿ“ค stdout', value: await this.client.utils.codeblock(stdout, 1024, 'ansi', true) }]);
+ if (stderr) embed.addFields([{ name: '๐Ÿ“ค stderr', value: await this.client.utils.codeblock(stderr, 1024, 'ansi', true) }]);
} catch (e) {
embed.setTitle(`${emojis.errorFull} An error occurred while executing.`).setColor(colors.error).spliceFields(1, 1);
- embed.addFields([{ name: '๐Ÿ“ค Output', value: await codeblock(formatError(e, true), 1024, 'ansi', true) }]);
+ embed.addFields([
+ { name: '๐Ÿ“ค Output', value: await this.client.utils.codeblock(formatError(e, true), 1024, 'ansi', true) }
+ ]);
}
await message.util.edit({ embeds: [embed] });
}
diff --git a/src/commands/dev/superUser.ts b/src/commands/dev/superUser.ts
index 3de04bf..24e8c9a 100644
--- a/src/commands/dev/superUser.ts
+++ b/src/commands/dev/superUser.ts
@@ -1,13 +1,4 @@
-import {
- BushCommand,
- clientSendAndPermCheck,
- emojis,
- format,
- getShared,
- insertOrRemoveFromShared,
- type ArgType,
- type CommandMessage
-} from '#lib';
+import { BushCommand, clientSendAndPermCheck, emojis, format, type ArgType, type CommandMessage } from '#lib';
import { type ArgumentGeneratorReturn, type ArgumentTypeCasterReturn } from 'discord-akairo';
export default class SuperUserCommand extends BushCommand {
@@ -65,14 +56,14 @@ export default class SuperUserCommand extends BushCommand {
public override async exec(message: CommandMessage, args: { action: 'add' | 'remove'; user: ArgType<'user'> }) {
if (!message.author.isOwner()) return await message.util.reply(`${emojis.error} Only my developers can run this command.`);
- const superUsers: string[] = getShared('superUsers');
+ const superUsers: string[] = this.client.utils.getShared('superUsers');
if (args.action === 'add' ? superUsers.includes(args.user.id) : !superUsers.includes(args.user.id))
return message.util.reply(
`${emojis.warn} ${format.input(args.user.tag)} is ${args.action === 'add' ? 'already' : 'not'} a superuser.`
);
- const success = await insertOrRemoveFromShared(args.action, 'superUsers', args.user.id).catch(() => false);
+ const success = await this.client.utils.insertOrRemoveFromShared(args.action, 'superUsers', args.user.id).catch(() => false);
if (success) {
return await message.util.reply(
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index 9491d19..600aeac 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -135,15 +135,15 @@ export default class TestCommand extends BushCommand {
return await message.util.reply({ content: 'this is content', components: ButtonRows, embeds });
} else if (['delete slash commands'].includes(args.feature?.toLowerCase())) {
if (!message.guild) return await message.util.reply(`${emojis.error} This test can only be run in a guild.`);
- await client.guilds.fetch();
+ await this.client.guilds.fetch();
const promises: Promise<Collection<string, ApplicationCommand>>[] = [];
- client.guilds.cache.each((guild) => {
+ this.client.guilds.cache.each((guild) => {
promises.push(guild.commands.set([]));
});
await Promise.all(promises);
- await client.application!.commands.fetch();
- await client.application!.commands.set([]);
+ await this.client.application!.commands.fetch();
+ await this.client.application!.commands.set([]);
return await message.util.reply(`${emojis.success} Removed guild commands and global commands.`);
} else if (['drop down', 'drop downs', 'select menu', 'select menus'].includes(args.feature?.toLowerCase())) {
@@ -166,7 +166,7 @@ export default class TestCommand extends BushCommand {
});
// eslint-disable-next-line @typescript-eslint/no-misused-promises
- client.ws.on(GatewayDispatchEvents.InteractionCreate, async (i: any) => {
+ this.client.ws.on(GatewayDispatchEvents.InteractionCreate, async (i: any) => {
if (i?.data?.custom_id !== 'test;modal' || i?.data?.component_type !== 2) return;
if (i?.message?.id !== m.id) return;
diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts
index decbe04..25b860c 100644
--- a/src/commands/info/botInfo.ts
+++ b/src/commands/info/botInfo.ts
@@ -3,7 +3,6 @@ import {
clientSendAndPermCheck,
colors,
humanizeDuration,
- mapIDs,
shell,
type CommandMessage,
type SlashMessage
@@ -44,14 +43,14 @@ export default class BotInfoCommand extends BushCommand {
haiku = 'Haiku'
}
- const developers = (await mapIDs(client.config.owners)).map((u) => u?.tag).join('\n');
+ const developers = (await this.client.utils.mapIDs(this.client.config.owners)).map((u) => u?.tag).join('\n');
const currentCommit = (await shell('git rev-parse HEAD')).stdout.replace('\n', '');
let repoUrl = (await shell('git remote get-url origin')).stdout.replace('\n', '');
if (repoUrl.includes('.git')) repoUrl = repoUrl.substring(0, repoUrl.length - 4);
const embed = new EmbedBuilder()
.setTitle('Bot Info:')
.addFields([
- { name: '**Uptime**', value: humanizeDuration(client.uptime!, 2), inline: true },
+ { name: '**Uptime**', value: humanizeDuration(this.client.uptime!, 2), inline: true },
{
name: '**Memory Usage**',
value: `System: ${prettyBytes(os.totalmem() - os.freemem(), { binary: true })}/${prettyBytes(os.totalmem(), {
@@ -62,18 +61,18 @@ export default class BotInfoCommand extends BushCommand {
)}`,
inline: true
},
- { name: '**CPU Usage**', value: `${client.stats.cpu}%`, inline: true },
+ { name: '**CPU Usage**', value: `${this.client.stats.cpu}%`, inline: true },
{ name: '**Platform**', value: Platform[process.platform], inline: true },
- { name: '**Commands Used**', value: `${client.stats.commandsUsed.toLocaleString()}`, inline: true },
- { name: '**Slash Commands Used**', value: `${client.stats.slashCommandsUsed.toLocaleString()}`, inline: true },
- { name: '**Servers**', value: client.guilds.cache.size.toLocaleString(), inline: true },
- { name: '**Users**', value: client.users.cache.size.toLocaleString(), inline: true },
+ { name: '**Commands Used**', value: `${this.client.stats.commandsUsed.toLocaleString()}`, inline: true },
+ { name: '**Slash Commands Used**', value: `${this.client.stats.slashCommandsUsed.toLocaleString()}`, inline: true },
+ { name: '**Servers**', value: this.client.guilds.cache.size.toLocaleString(), inline: true },
+ { name: '**Users**', value: this.client.users.cache.size.toLocaleString(), inline: true },
{ name: '**Discord.js Version**', value: discordJSVersion, inline: true },
{ name: '**Node.js Version**', value: process.version.slice(1), inline: true },
- { name: '**Commands**', value: client.commandHandler.modules.size.toLocaleString(), inline: true },
- { name: '**Listeners**', value: client.listenerHandler.modules.size.toLocaleString(), inline: true },
- { name: '**Inhibitors**', value: client.inhibitorHandler.modules.size.toLocaleString(), inline: true },
- { name: '**Tasks**', value: client.taskHandler.modules.size.toLocaleString(), inline: true },
+ { name: '**Commands**', value: this.client.commandHandler.modules.size.toLocaleString(), inline: true },
+ { name: '**Listeners**', value: this.client.listenerHandler.modules.size.toLocaleString(), inline: true },
+ { name: '**Inhibitors**', value: this.client.inhibitorHandler.modules.size.toLocaleString(), inline: true },
+ { name: '**Tasks**', value: this.client.taskHandler.modules.size.toLocaleString(), inline: true },
{
name: '**Current Commit**',
value: `[${currentCommit.substring(0, 7)}](${repoUrl}/commit/${currentCommit})`,
diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts
index 92999a5..060a439 100644
--- a/src/commands/info/guildInfo.ts
+++ b/src/commands/info/guildInfo.ts
@@ -66,7 +66,7 @@ export default class GuildInfoCommand extends BushCommand {
let guild: ArgType<'guild' | 'snowflake'> | GuildPreview = args.guild ?? message.guild!;
if (typeof guild === 'string') {
- const preview = await client.fetchGuildPreview(`${args.guild}` as Snowflake).catch(() => undefined);
+ const preview = await this.client.fetchGuildPreview(`${args.guild}` as Snowflake).catch(() => undefined);
if (preview) guild = preview;
else return await message.util.reply(`${emojis.error} That guild is not discoverable or does not exist.`);
}
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts
index 051fce5..1a19969 100644
--- a/src/commands/info/help.ts
+++ b/src/commands/info/help.ts
@@ -4,7 +4,6 @@ import {
colors,
format,
invite,
- prefix,
type ArgType,
type CommandMessage,
type OptArgType,
@@ -68,7 +67,7 @@ export default class HelpCommand extends BushCommand {
const row = this.addLinks(message);
const command = args.command
? typeof args.command === 'string'
- ? client.commandHandler.findCommand(args.command) ?? null
+ ? this.client.commandHandler.findCommand(args.command) ?? null
: args.command
: null;
@@ -82,7 +81,7 @@ export default class HelpCommand extends BushCommand {
}
private helpAll(message: CommandMessage | SlashMessage, args: HelpArgs, row: ActionRowBuilder<ButtonBuilder>) {
- const prefix_ = prefix(message);
+ const prefix_ = this.client.utils.prefix(message);
const embed = new EmbedBuilder()
.setColor(colors.default)
.setTimestamp()
@@ -211,7 +210,7 @@ export default class HelpCommand extends BushCommand {
if (command.restrictedGuilds?.length)
restrictions.push(
`__Restricted Servers__: ${command.restrictedGuilds
- .map((g) => format.inlineCode(client.guilds.cache.find((g1) => g1.id === g)?.name ?? 'Unknown'))
+ .map((g) => format.inlineCode(this.client.guilds.cache.find((g1) => g1.id === g)?.name ?? 'Unknown'))
.join(' ')}`
);
if (restrictions.length) embed.addFields([{ name: 'ยป Restrictions', value: restrictions.join('\n') }]);
@@ -221,12 +220,12 @@ export default class HelpCommand extends BushCommand {
private addLinks(message: CommandMessage | SlashMessage) {
const row = new ActionRowBuilder<ButtonBuilder>();
- if (!client.config.isDevelopment && !client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) {
+ if (!this.client.config.isDevelopment && !this.client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) {
row.addComponents([new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: invite(this.client) })]);
}
- if (!client.guilds.cache.get(client.config.supportGuild.id)?.members.cache.has(message.author.id)) {
+ if (!this.client.guilds.cache.get(this.client.config.supportGuild.id)?.members.cache.has(message.author.id)) {
row.addComponents([
- new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: client.config.supportGuild.invite })
+ new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: this.client.config.supportGuild.invite })
]);
}
if (packageDotJSON?.repository)
diff --git a/src/commands/info/links.ts b/src/commands/info/links.ts
index a7ff30e..41e5c4d 100644
--- a/src/commands/info/links.ts
+++ b/src/commands/info/links.ts
@@ -21,11 +21,11 @@ export default class LinksCommand extends BushCommand {
public override async exec(message: CommandMessage | SlashMessage) {
const buttonRow = new ActionRowBuilder<ButtonBuilder>();
- if (!client.config.isDevelopment || message.author.isOwner()) {
+ if (!this.client.config.isDevelopment || message.author.isOwner()) {
buttonRow.addComponents([new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: invite(this.client) })]);
}
buttonRow.addComponents([
- new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: client.config.supportGuild.invite }),
+ new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: this.client.config.supportGuild.invite }),
new ButtonBuilder({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository })
]);
return await message.util.reply({ content: 'Here are some useful links:', components: [buttonRow] });
diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts
index e87ca1f..0063f4c 100644
--- a/src/commands/info/pronouns.ts
+++ b/src/commands/info/pronouns.ts
@@ -2,7 +2,6 @@ import {
AllowedMentions,
BushCommand,
clientSendAndPermCheck,
- getPronounsOf,
type CommandMessage,
type OptArgType,
type SlashMessage
@@ -40,7 +39,7 @@ export default class PronounsCommand extends BushCommand {
if (message.util.isSlashMessage(message)) await message.interaction.deferReply();
- const pronouns = await getPronounsOf(user);
+ const pronouns = await this.client.utils.getPronounsOf(user);
if (!pronouns) {
return await message.util.reply({
content: `${author ? 'You do' : `${escapeMarkdown(user.tag)} does`} not appear to have any pronouns set. Please${
diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts
index a28f4c5..dba1378 100644
--- a/src/commands/info/snowflake.ts
+++ b/src/commands/info/snowflake.ts
@@ -16,10 +16,7 @@ import {
PermissionFlagsBits,
SnowflakeUtil,
type DeconstructedSnowflake,
- type Guild,
- type Role,
- type Snowflake,
- type User
+ type Snowflake
} from 'discord.js';
export default class SnowflakeCommand extends BushCommand {
@@ -51,8 +48,8 @@ export default class SnowflakeCommand extends BushCommand {
const snowflakeEmbed = new EmbedBuilder().setTitle('Unknown :snowflake:').setColor(colors.default);
// Channel
- if (client.channels.cache.has(snowflake)) {
- const channel = client.channels.resolve(snowflake)!;
+ if (this.client.channels.cache.has(snowflake)) {
+ const channel = this.client.channels.resolve(snowflake)!;
const channelInfo = [`**Type:** ${BushChannelType[channel.type] ?? ChannelType[channel.type]}`];
if (channel.type === ChannelType.DM) {
channelInfo.push(
@@ -77,11 +74,11 @@ export default class SnowflakeCommand extends BushCommand {
}
// Guild
- if (client.guilds.cache.has(snowflake)) {
- const guild: Guild = client.guilds.cache.get(snowflake)!;
+ if (this.client.guilds.cache.has(snowflake)) {
+ const guild = this.client.guilds.cache.get(snowflake)!;
const guildInfo = stripIndent`
**Name:** ${escapeMarkdown(guild.name)}
- **Owner:** ${escapeMarkdown(client.users.cache.get(guild.ownerId)?.tag ?? 'ยฏ\\_(ใƒ„)_/ยฏ')} (${guild.ownerId})
+ **Owner:** ${escapeMarkdown(this.client.users.cache.get(guild.ownerId)?.tag ?? 'ยฏ\\_(ใƒ„)_/ยฏ')} (${guild.ownerId})
**Members:** ${guild.memberCount?.toLocaleString()}`;
if (guild.icon) snowflakeEmbed.setThumbnail(guild.iconURL({ size: 2048 })!);
snowflakeEmbed.addFields([{ name: 'ยป Server Info', value: guildInfo }]);
@@ -89,9 +86,9 @@ export default class SnowflakeCommand extends BushCommand {
}
// User
- const fetchedUser = await client.users.fetch(`${snowflake}`).catch(() => undefined);
- if (client.users.cache.has(snowflake) || fetchedUser) {
- const user: User = (client.users.cache.get(snowflake) ?? fetchedUser)!;
+ const fetchedUser = await this.client.users.fetch(`${snowflake}`).catch(() => undefined);
+ if (this.client.users.cache.has(snowflake) || fetchedUser) {
+ const user = (this.client.users.cache.get(snowflake) ?? fetchedUser)!;
const userInfo = stripIndent`
**Name:** <@${user.id}> (${escapeMarkdown(user.tag)})`;
if (user.avatar) snowflakeEmbed.setThumbnail(user.avatarURL({ size: 2048 })!);
@@ -100,8 +97,8 @@ export default class SnowflakeCommand extends BushCommand {
}
// Emoji
- if (client.emojis.cache.has(snowflake)) {
- const emoji = client.emojis.cache.get(snowflake)!;
+ if (this.client.emojis.cache.has(snowflake)) {
+ const emoji = this.client.emojis.cache.get(snowflake)!;
const emojiInfo = stripIndent`
**Name:** ${escapeMarkdown(emoji.name ?? 'ยฏ\\_(ใƒ„)_/ยฏ')}
**Animated:** ${emoji.animated}`;
@@ -112,7 +109,7 @@ export default class SnowflakeCommand extends BushCommand {
// Role
if (message.guild && message.guild.roles.cache.has(snowflake)) {
- const role: Role = message.guild.roles.cache.get(snowflake)!;
+ const role = message.guild.roles.cache.get(snowflake)!;
const roleInfo = stripIndent`
**Name:** <@&${role.id}> (${escapeMarkdown(role.name)})
**Members:** ${role.members.size}
diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts
index a39e28a..73a0422 100644
--- a/src/commands/info/userInfo.ts
+++ b/src/commands/info/userInfo.ts
@@ -4,8 +4,6 @@ import {
clientSendAndPermCheck,
colors,
emojis,
- getPronounsOf,
- getShared,
mappings,
oxford,
sleep,
@@ -63,7 +61,7 @@ export default class UserInfoCommand extends BushCommand {
? message.author
: typeof args.user === 'object'
? args.user
- : await client.users.fetch(`${args.user}`).catch(() => undefined);
+ : await this.client.users.fetch(`${args.user}`).catch(() => undefined);
if (user === undefined) return message.util.reply(`${emojis.error} Invalid user.`);
const member = message.guild ? await message.guild.members.fetch(user.id).catch(() => undefined) : undefined;
await user.fetch(true); // gets banner info and accent color
@@ -75,7 +73,7 @@ export default class UserInfoCommand extends BushCommand {
public static async makeUserInfoEmbed(user: User, member?: GuildMember, guild?: Guild | null) {
const emojis = [];
- const superUsers = getShared('superUsers');
+ const superUsers = user.client.utils.getShared('superUsers');
const userEmbed = new EmbedBuilder()
.setTitle(escapeMarkdown(user.tag))
@@ -85,7 +83,7 @@ export default class UserInfoCommand extends BushCommand {
.setColor(member?.displayColor ?? colors.default);
// Flags
- if (client.config.owners.includes(user.id)) emojis.push(mappings.otherEmojis.Developer);
+ if (user.client.config.owners.includes(user.id)) emojis.push(mappings.otherEmojis.Developer);
if (superUsers.includes(user.id)) emojis.push(mappings.otherEmojis.Superuser);
const flags = user.flags?.toArray();
if (flags) {
@@ -143,7 +141,7 @@ export default class UserInfoCommand extends BushCommand {
if (user.accentColor !== null) generalInfo.push(`**Accent Color:** ${user.hexAccentColor}`);
if (user.banner) generalInfo.push(`**Banner:** [link](${user.bannerURL({ extension: 'png', size: 4096 })})`);
- const pronouns = await Promise.race([getPronounsOf(user), sleep(2 * Time.Second)]); // cut off request after 2 seconds
+ const pronouns = await Promise.race([user.client.utils.getPronounsOf(user), sleep(2 * Time.Second)]); // cut off request after 2 seconds
if (pronouns && typeof pronouns === 'string' && pronouns !== 'Unspecified') generalInfo.push(`**Pronouns:** ${pronouns}`);
@@ -211,7 +209,7 @@ export default class UserInfoCommand extends BushCommand {
}
embed.setFooter({
text: member.user.tag,
- iconURL: client.emojis.cache.get(statusEmojis[member?.presence.status])?.url ?? undefined
+ iconURL: member.client.emojis.cache.get(statusEmojis[member?.presence.status])?.url ?? undefined
});
}
@@ -258,7 +256,9 @@ export default class UserInfoCommand extends BushCommand {
public static async generateBotField(embed: EmbedBuilder, user: User, title = 'ยป Bot Information') {
if (!user.bot) return;
- const applicationInfo = (await client.rest.get(`/applications/${user.id}/rpc`).catch(() => null)) as APIApplication | null;
+ const applicationInfo = (await user.client.rest
+ .get(`/applications/${user.id}/rpc`)
+ .catch(() => null)) as APIApplication | null;
if (!applicationInfo) return;
const flags = new ApplicationFlagsBitField(applicationInfo.flags);
diff --git a/src/commands/leveling/leaderboard.ts b/src/commands/leveling/leaderboard.ts
index d81d88b..7eef990 100644
--- a/src/commands/leveling/leaderboard.ts
+++ b/src/commands/leveling/leaderboard.ts
@@ -5,7 +5,6 @@ import {
clientSendAndPermCheck,
emojis,
Level,
- prefix,
type CommandMessage,
type OptArgType,
type SlashMessage
@@ -46,7 +45,7 @@ export default class LeaderboardCommand extends BushCommand {
return await message.util.reply(
`${emojis.error} This command can only be run in servers with the leveling feature enabled.${
message.member?.permissions.has(PermissionFlagsBits.ManageGuild)
- ? ` You can toggle features using the \`${prefix(message)}features\` command.`
+ ? ` You can toggle features using the \`${this.client.utils.prefix(message)}features\` command.`
: ''
}`
);
diff --git a/src/commands/leveling/level.ts b/src/commands/leveling/level.ts
index df3e5b2..7888695 100644
--- a/src/commands/leveling/level.ts
+++ b/src/commands/leveling/level.ts
@@ -5,7 +5,6 @@ import {
clientSendAndPermCheck,
emojis,
Level,
- prefix,
type CommandMessage,
type OptArgType,
type SlashMessage
@@ -54,7 +53,7 @@ export default class LevelCommand extends BushCommand {
return await message.util.reply(
`${emojis.error} This command can only be run in servers with the leveling feature enabled.${
message.member?.permissions.has(PermissionFlagsBits.ManageGuild)
- ? ` You can toggle features using the \`${prefix(message)}features\` command.`
+ ? ` You can toggle features using the \`${this.client.utils.prefix(message)}features\` command.`
: ''
}`
);
diff --git a/src/commands/moderation/_activePunishments.ts b/src/commands/moderation/_activePunishments.ts
index 80cecf2..06e33f2 100644
--- a/src/commands/moderation/_activePunishments.ts
+++ b/src/commands/moderation/_activePunishments.ts
@@ -1,4 +1,14 @@
-// import { BushCommand, ModLog, ModLogModel, OptArgType, type CommandMessage, type SlashMessage } from '#lib';
+// import {
+// BushCommand,
+// clientSendAndPermCheck,
+// emojis,
+// ModLog,
+// ModLogModel,
+// OptArgType,
+// userGuildPermCheck,
+// type CommandMessage,
+// type SlashMessage
+// } from '#lib';
// import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
// import { FindOptions, Op } from 'sequelize';
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index e301fb2..598fcaa 100644
--- a/src/commands/moderation/ban.ts
+++ b/src/commands/moderation/ban.ts
@@ -7,7 +7,6 @@ import {
emojis,
format,
Moderation,
- resolveNonCachedUser,
type ArgType,
type CommandMessage,
type OptArgType,
@@ -91,7 +90,8 @@ export default class BanCommand extends BushCommand {
args.days ??= message.util.parsed?.alias === 'dban' ? 1 : 0;
const member = message.guild.members.cache.get(typeof args.user === 'string' ? args.user : args.user.id);
- const user = member?.user ?? (await resolveNonCachedUser(typeof args.user === 'string' ? args.user : args.user.id));
+ const user =
+ member?.user ?? (await this.client.utils.resolveNonCachedUser(typeof args.user === 'string' ? args.user : args.user.id));
if (!user) return message.util.reply(`${emojis.error} Invalid user.`);
const useForce = args.force && message.author.isOwner();
diff --git a/src/commands/moderation/evidence.ts b/src/commands/moderation/evidence.ts
index 3c9e726..f480844 100644
--- a/src/commands/moderation/evidence.ts
+++ b/src/commands/moderation/evidence.ts
@@ -122,7 +122,7 @@ export default class EvidenceCommand extends BushCommand {
entry.evidence = _evidence.trim();
await entry.save();
- client.emit('bushUpdateModlog', message.member!, entry.id, 'evidence', oldEntry, entry.evidence);
+ this.client.emit('bushUpdateModlog', message.member!, entry.id, 'evidence', oldEntry, entry.evidence);
return message.util.reply(`${emojis.success} Successfully updated the evidence for case ${format.input(entry.id)}.`);
}
diff --git a/src/commands/moderation/hideCase.ts b/src/commands/moderation/hideCase.ts
index 0cc3de4..6724d3c 100644
--- a/src/commands/moderation/hideCase.ts
+++ b/src/commands/moderation/hideCase.ts
@@ -47,7 +47,7 @@ export default class HideCaseCommand extends BushCommand {
entry.hidden = !entry.hidden;
await entry.save();
- client.emit('bushUpdateModlog', message.member!, entry.id, 'hidden', oldEntry, entry.hidden);
+ this.client.emit('bushUpdateModlog', message.member!, entry.id, 'hidden', oldEntry, entry.hidden);
return await message.util.reply(`${emojis.success} CaseID ${format.input(caseID)} is ${action}.`);
}
diff --git a/src/commands/moderation/massBan.ts b/src/commands/moderation/massBan.ts
index ab9fbc8..0db5263 100644
--- a/src/commands/moderation/massBan.ts
+++ b/src/commands/moderation/massBan.ts
@@ -96,7 +96,7 @@ export default class MassBanCommand extends BushCommand {
const res = await Promise.all(promises);
const map = new Collection(res.map((r, i) => [ids[i], r]));
- client.emit('massBan', message.member!, message.guild!, args.reason ? args.reason.trim() : 'No reason provided.', map);
+ this.client.emit('massBan', message.member!, message.guild!, args.reason ? args.reason.trim() : 'No reason provided.', map);
const success = (res: BanResponse): boolean => [banResponse.SUCCESS, banResponse.DM_ERROR].includes(res as any);
diff --git a/src/commands/moderation/massEvidence.ts b/src/commands/moderation/massEvidence.ts
index ffe85d2..6547203 100644
--- a/src/commands/moderation/massEvidence.ts
+++ b/src/commands/moderation/massEvidence.ts
@@ -93,7 +93,7 @@ export default class MassEvidenceCommand extends BushCommand {
return `${emojis.success} ${id} - ${case_.id}`;
});
- client.emit('massEvidence', message.member!, message.guild, evidence, lines);
+ this.client.emit('massEvidence', message.member!, message.guild, evidence, lines);
const embeds = overflowEmbed(
{
diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts
index 2c0e33a..2bcc54d 100644
--- a/src/commands/moderation/modlog.ts
+++ b/src/commands/moderation/modlog.ts
@@ -8,7 +8,6 @@ import {
emojis,
humanizeDuration,
ModLog,
- resolveUserAsync,
timestamp,
userGuildPermCheck,
type ArgType,
@@ -61,7 +60,7 @@ export default class ModlogCommand extends BushCommand {
) {
assert(message.inGuild());
- const foundUser = search instanceof User ? search : await resolveUserAsync(search);
+ const foundUser = search instanceof User ? search : await this.client.utils.resolveUserAsync(search);
if (foundUser) {
const logs = await ModLog.findAll({
where: {
diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts
index 7ad023a..12b94d6 100644
--- a/src/commands/moderation/mute.ts
+++ b/src/commands/moderation/mute.ts
@@ -7,7 +7,6 @@ import {
format,
Moderation,
muteResponse,
- prefix,
userGuildPermCheck,
type ArgType,
type CommandMessage,
@@ -93,7 +92,7 @@ export default class MuteCommand extends BushCommand {
});
const responseMessage = (): string => {
- const prefix_ = prefix(message);
+ const prefix_ = this.client.utils.prefix(message);
const victim = format.input(member.user.tag);
switch (responseCode) {
case muteResponse.MISSING_PERMISSIONS:
diff --git a/src/commands/moderation/purge.ts b/src/commands/moderation/purge.ts
index acf3897..ed5d49d 100644
--- a/src/commands/moderation/purge.ts
+++ b/src/commands/moderation/purge.ts
@@ -83,7 +83,7 @@ export default class PurgeCommand extends BushCommand {
const purged = await message.channel!.bulkDelete(messages, true).catch(() => null);
if (!purged) return message.util.reply(`${emojis.error} Failed to purge messages.`).catch(() => null);
else {
- client.emit('bushPurge', message.author, message.guild, message.channel!, messages);
+ this.client.emit('bushPurge', message.author, message.guild, message.channel!, messages);
await message.util.send(`${emojis.success} Successfully purged **${purged.size}** messages.`);
/* .then(async (purgeMessage) => {
if (!message.util.isSlashMessage(message)) {
diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts
index 9ac13ce..08497c7 100644
--- a/src/commands/moderation/unmute.ts
+++ b/src/commands/moderation/unmute.ts
@@ -5,7 +5,6 @@ import {
emojis,
format,
Moderation,
- prefix,
unmuteResponse,
userGuildPermCheck,
type ArgType,
@@ -84,7 +83,7 @@ export default class UnmuteCommand extends BushCommand {
});
const responseMessage = (): string => {
- const prefix_ = prefix(message);
+ const prefix_ = this.client.utils.prefix(message);
const victim = format.input(member.user.tag);
switch (responseCode) {
case unmuteResponse.MISSING_PERMISSIONS:
diff --git a/src/commands/moulberry-bush/giveawayPing.ts b/src/commands/moulberry-bush/giveawayPing.ts
index 0cadd6a..d93e0c9 100644
--- a/src/commands/moulberry-bush/giveawayPing.ts
+++ b/src/commands/moulberry-bush/giveawayPing.ts
@@ -1,4 +1,5 @@
import { AllowedMentions, BushCommand, clientSendAndPermCheck, emojis, type CommandMessage } from '#lib';
+import assert from 'assert';
import { PermissionFlagsBits } from 'discord.js';
export default class GiveawayPingCommand extends BushCommand {
@@ -29,6 +30,8 @@ export default class GiveawayPingCommand extends BushCommand {
}
public override async exec(message: CommandMessage) {
+ assert(message.inGuild());
+
if (!message.member!.permissions.has(PermissionFlagsBits.ManageGuild) && !message.member!.user.isOwner())
await message.util.reply(`${emojis.error} You are missing the **ManageGuild** permission.`);
@@ -41,21 +44,21 @@ export default class GiveawayPingCommand extends BushCommand {
});
//! Broken
- /* const webhooks = await (message.channel as TextChannel | NewsChannel).fetchWebhooks();
- let webhookClient: WebhookClient;
- if (webhooks.size < 1) {
- const webhook = await (message.channel as TextChannel | NewsChannel).createWebhook('Giveaway ping webhook');
- webhookClient = new WebhookClient(webhook.id, webhook.token);
- } else {
- const webhook = webhooks.first();
- webhookClient = new WebhookClient(webhook.id, webhook.token);
- }
- return await webhookClient.send({
- content:
- '๐ŸŽ‰ <@&767782793261875210> Giveaway.\n\n<:mad:783046135392239626> Spamming, line breaking, gibberish etc. disqualifies you from winning. We can and will ban you from giveaways. Winners will all be checked and rerolled if needed.',
- username: `${message.member.nickname || message.author.username}`,
- avatarURL: message.author.avatarURL(),
- allowedMentions: AllowedMentions.roles()
- }); */
+ // const webhooks = await message.channel.fetchWebhooks();
+ // let webhookClient: WebhookClient;
+ // if (webhooks.size < 1) {
+ // const webhook = await message.channel.createWebhook('Giveaway ping webhook');
+ // webhookClient = new WebhookClient(webhook.id, webhook.token);
+ // } else {
+ // const webhook = webhooks.first();
+ // webhookClient = new WebhookClient(webhook.id, webhook.token);
+ // }
+ // return await webhookClient.send({
+ // content:
+ // '๐ŸŽ‰ <@&767782793261875210> Giveaway.\n\n<:mad:783046135392239626> Spamming, line breaking, gibberish etc. disqualifies you from winning. We can and will ban you from giveaways. Winners will all be checked and rerolled if needed.',
+ // username: `${message.member?.nickname ?? message.author.username}`,
+ // avatarURL: message.author.avatarURL(),
+ // allowedMentions: AllowedMentions.roles()
+ // });
}
}
diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts
index 06c1ad2..47e45f9 100644
--- a/src/commands/moulberry-bush/report.ts
+++ b/src/commands/moulberry-bush/report.ts
@@ -112,7 +112,7 @@ export default class ReportCommand extends BushCommand {
await ReportMessage.react(emojis.check);
await ReportMessage.react(emojis.cross);
} catch {
- void client.console.warn('ReportCommand', 'Could not react to report message.');
+ void this.client.console.warn('ReportCommand', 'Could not react to report message.');
}
});
return await message.util.reply('Successfully made a report.');
diff --git a/src/commands/utilities/_poll.ts b/src/commands/utilities/_poll.ts
index fdf6381..1ceb13a 100644
--- a/src/commands/utilities/_poll.ts
+++ b/src/commands/utilities/_poll.ts
@@ -1,4 +1,4 @@
-// import { BushCommand, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
+// import { BushCommand, clientSendAndPermCheck, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
// import { ApplicationCommandOptionType, ComponentType } from 'discord.js';
// export default class PollCommand extends BushCommand {
diff --git a/src/commands/utilities/activity.ts b/src/commands/utilities/activity.ts
index dfbccfb..e5c2cdd 100644
--- a/src/commands/utilities/activity.ts
+++ b/src/commands/utilities/activity.ts
@@ -171,7 +171,7 @@ export default class ActivityCommand extends BushCommand {
: activityTypeCaster(message, args.activity);
let response: string;
- const invite: any = await client.rest
+ const invite: any = await this.client.rest
.post(`/channels/${channel.id}/invites`, {
body: {
validate: null,
diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts
index 75d63a1..2204fe6 100644
--- a/src/commands/utilities/calculator.ts
+++ b/src/commands/utilities/calculator.ts
@@ -4,7 +4,6 @@ import {
clientSendAndPermCheck,
colors,
emojis,
- inspectCleanRedactCodeblock,
type CommandMessage,
type SlashMessage
} from '#lib';
@@ -43,7 +42,7 @@ export default class CalculatorCommand extends BushCommand {
const decodedEmbed = new EmbedBuilder().addFields([
{
name: '๐Ÿ“ฅ Input',
- value: await inspectCleanRedactCodeblock(args.expression, 'mma')
+ value: await this.client.utils.inspectCleanRedactCodeblock(args.expression, 'mma')
}
]);
try {
@@ -51,12 +50,19 @@ export default class CalculatorCommand extends BushCommand {
decodedEmbed
.setTitle(`${emojis.successFull} Successfully Calculated Expression`)
.setColor(colors.success)
- .addFields([{ name: '๐Ÿ“ค Output', value: await inspectCleanRedactCodeblock(calculated.toString(), 'mma') }]);
+ .addFields([
+ { name: '๐Ÿ“ค Output', value: await this.client.utils.inspectCleanRedactCodeblock(calculated.toString(), 'mma') }
+ ]);
} catch (error) {
decodedEmbed
.setTitle(`${emojis.errorFull} Unable to Calculate Expression`)
.setColor(colors.error)
- .addFields([{ name: `๐Ÿ“ค Error`, value: await inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') }]);
+ .addFields([
+ {
+ name: `๐Ÿ“ค Error`,
+ value: await this.client.utils.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js')
+ }
+ ]);
}
return await message.util.reply({ embeds: [decodedEmbed], allowedMentions: AllowedMentions.none() });
}
diff --git a/src/commands/utilities/decode.ts b/src/commands/utilities/decode.ts
index cc742c8..6aabeac 100644
--- a/src/commands/utilities/decode.ts
+++ b/src/commands/utilities/decode.ts
@@ -5,7 +5,6 @@ import {
clientSendAndPermCheck,
colors,
formatError,
- inspectCleanRedactCodeblock,
type CommandMessage,
type SlashMessage
} from '#lib';
@@ -64,15 +63,17 @@ export default class DecodeCommand extends BushCommand {
const encodeOrDecode = capitalize(message?.util?.parsed?.alias ?? 'decoded');
const decodedEmbed = new EmbedBuilder()
.setTitle(`${encodeOrDecode} Information`)
- .addFields([{ name: '๐Ÿ“ฅ Input', value: await inspectCleanRedactCodeblock(data) }]);
+ .addFields([{ name: '๐Ÿ“ฅ Input', value: await this.client.utils.inspectCleanRedactCodeblock(data) }]);
try {
const decoded = Buffer.from(data, from).toString(to);
- decodedEmbed.setColor(colors.success).addFields([{ name: '๐Ÿ“ค Output', value: await inspectCleanRedactCodeblock(decoded) }]);
+ decodedEmbed
+ .setColor(colors.success)
+ .addFields([{ name: '๐Ÿ“ค Output', value: await this.client.utils.inspectCleanRedactCodeblock(decoded) }]);
} catch (error) {
decodedEmbed.setColor(colors.error).addFields([
{
name: `๐Ÿ“ค Error ${encodeOrDecode.slice(1)}ing`,
- value: await inspectCleanRedactCodeblock(formatError(error))
+ value: await this.client.utils.inspectCleanRedactCodeblock(formatError(error))
}
]);
}
diff --git a/src/commands/utilities/highlight-add.ts b/src/commands/utilities/highlight-add.ts
index 9624a7e..3547c90 100644
--- a/src/commands/utilities/highlight-add.ts
+++ b/src/commands/utilities/highlight-add.ts
@@ -59,7 +59,7 @@ export default class HighlightAddCommand extends BushCommand {
}
}
- const res = await client.highlightManager.addHighlight(message.guild.id, message.author.id, {
+ const res = await this.client.highlightManager.addHighlight(message.guild.id, message.author.id, {
word: args.word,
regex: args.regex
});
diff --git a/src/commands/utilities/highlight-clear.ts b/src/commands/utilities/highlight-clear.ts
index df9f387..9e1ed62 100644
--- a/src/commands/utilities/highlight-clear.ts
+++ b/src/commands/utilities/highlight-clear.ts
@@ -23,7 +23,7 @@ export default class HighlightClearCommand extends BushCommand {
const confirm = await ConfirmationPrompt.send(message, { content: `Are you sure you want to clear your highlight list?` });
if (!confirm) return await message.util.reply(`${emojis.warn} You decided not to clear your highlight list.`);
- const success = await client.highlightManager.removeAllHighlights(message.guild.id, message.author.id);
+ const success = await this.client.highlightManager.removeAllHighlights(message.guild.id, message.author.id);
if (!success) return await message.util.reply(`${emojis.error} There was an error clearing your highlight list.`);
return await message.util.reply(`${emojis.success} Successfully cleared your highlight list.`);
diff --git a/src/commands/utilities/highlight-matches.ts b/src/commands/utilities/highlight-matches.ts
index b458550..7bf94fd 100644
--- a/src/commands/utilities/highlight-matches.ts
+++ b/src/commands/utilities/highlight-matches.ts
@@ -34,7 +34,7 @@ export default class HighlightMatchesCommand extends BushCommand {
public override async exec(message: CommandMessage | SlashMessage, args: { phrase: ArgType<'string'> }) {
assert(message.inGuild());
- const res = await client.highlightManager.checkPhrase(message.guild.id, message.author.id, args.phrase);
+ const res = await this.client.highlightManager.checkPhrase(message.guild.id, message.author.id, args.phrase);
if (!res.size) return await message.util.reply(`${emojis.error} You are not highlighting any words`);
diff --git a/src/commands/utilities/highlight-remove.ts b/src/commands/utilities/highlight-remove.ts
index bb1300a..4dddff6 100644
--- a/src/commands/utilities/highlight-remove.ts
+++ b/src/commands/utilities/highlight-remove.ts
@@ -31,7 +31,7 @@ export default class HighlightRemoveCommand extends BushCommand {
public override async exec(message: CommandMessage | SlashMessage, args: { word: ArgType<'string'> }) {
assert(message.inGuild());
- const res = await client.highlightManager.removeHighlight(message.guild.id, message.author.id, args.word);
+ const res = await this.client.highlightManager.removeHighlight(message.guild.id, message.author.id, args.word);
if (typeof res === 'string')
return await message.util.reply({ content: `${emojis.error} ${res}`, allowedMentions: AllowedMentions.none() });
diff --git a/src/commands/utilities/highlight-show.ts b/src/commands/utilities/highlight-show.ts
index d966f3a..0558005 100644
--- a/src/commands/utilities/highlight-show.ts
+++ b/src/commands/utilities/highlight-show.ts
@@ -23,7 +23,7 @@ export default class HighlightShowCommand extends BushCommand {
where: { guild: message.guild.id, user: message.author.id }
});
- void client.highlightManager.syncCache();
+ void this.client.highlightManager.syncCache();
if (!highlight.words.length) return message.util.reply(`${emojis.error} You are not highlighting any words.`);
diff --git a/src/commands/utilities/viewRaw.ts b/src/commands/utilities/viewRaw.ts
index 8114cef..057d86d 100644
--- a/src/commands/utilities/viewRaw.ts
+++ b/src/commands/utilities/viewRaw.ts
@@ -2,7 +2,6 @@ import {
Arg,
BushCommand,
clientSendAndPermCheck,
- codeblock,
colors,
emojis,
inspect,
@@ -114,6 +113,6 @@ export default class ViewRawCommand extends BushCommand {
.setTimestamp(message.createdTimestamp)
.setColor(message.member?.roles?.color?.color ?? colors.default)
.setTitle('Raw Message Information')
- .setDescription(await codeblock(content, 2048, lang));
+ .setDescription(await message.client.utils.codeblock(content, 2048, lang));
}
}
diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts
index b682c85..baf764f 100644
--- a/src/commands/utilities/wolframAlpha.ts
+++ b/src/commands/utilities/wolframAlpha.ts
@@ -4,8 +4,6 @@ import {
clientSendAndPermCheck,
colors,
emojis,
- inspectCleanRedactCodeblock,
- uploadImageToImgur,
type ArgType,
type CommandMessage,
type SlashMessage
@@ -57,12 +55,12 @@ export default class WolframAlphaCommand extends BushCommand {
if (message.util.isSlashMessage(message)) await message.interaction.deferReply();
args.image && void message.util.reply({ content: `${emojis.loading} Loading...`, embeds: [] });
- const waApi = WolframAlphaAPI(client.config.credentials.wolframAlphaAppId);
+ const waApi = WolframAlphaAPI(this.client.config.credentials.wolframAlphaAppId);
const decodedEmbed = new EmbedBuilder().addFields([
{
name: '๐Ÿ“ฅ Input',
- value: await inspectCleanRedactCodeblock(args.expression)
+ value: await this.client.utils.inspectCleanRedactCodeblock(args.expression)
}
]);
const sendOptions: MessageOptions = { content: null, allowedMentions: AllowedMentions.none() };
@@ -73,16 +71,23 @@ export default class WolframAlphaCommand extends BushCommand {
decodedEmbed.setTitle(`${emojis.successFull} Successfully Queried Expression`).setColor(colors.success);
if (args.image) {
- decodedEmbed.setImage(await uploadImageToImgur(calculated.split(',')[1]));
+ decodedEmbed.setImage(await this.client.utils.uploadImageToImgur(calculated.split(',')[1]));
decodedEmbed.addFields([{ name: '๐Ÿ“ค Output', value: 'โ€‹' }]);
} else {
- decodedEmbed.addFields([{ name: '๐Ÿ“ค Output', value: await inspectCleanRedactCodeblock(calculated.toString()) }]);
+ decodedEmbed.addFields([
+ { name: '๐Ÿ“ค Output', value: await this.client.utils.inspectCleanRedactCodeblock(calculated.toString()) }
+ ]);
}
} catch (error) {
decodedEmbed
.setTitle(`${emojis.errorFull} Unable to Query Expression`)
.setColor(colors.error)
- .addFields([{ name: `๐Ÿ“ค Error`, value: await inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') }]);
+ .addFields([
+ {
+ name: `๐Ÿ“ค Error`,
+ value: await this.client.utils.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js')
+ }
+ ]);
}
sendOptions.embeds = [decodedEmbed];