aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands/admin/channelPermissions.ts2
-rw-r--r--src/commands/config/autoPublishChannel.ts4
-rw-r--r--src/commands/config/blacklist.ts16
-rw-r--r--src/commands/config/disable.ts16
-rw-r--r--src/commands/config/muteRole.ts2
-rw-r--r--src/commands/config/prefix.ts8
-rw-r--r--src/commands/config/punishmentFooter.ts8
-rw-r--r--src/commands/config/welcomeChannel.ts8
-rw-r--r--src/commands/dev/__template.ts2
-rw-r--r--src/commands/dev/_testDuration.ts2
-rw-r--r--src/commands/dev/eval.ts10
-rw-r--r--src/commands/dev/reload.ts8
-rw-r--r--src/commands/dev/say.ts4
-rw-r--r--src/commands/dev/servers.ts4
-rw-r--r--src/commands/dev/setLevel.ts2
-rw-r--r--src/commands/dev/sh.ts22
-rw-r--r--src/commands/dev/superUser.ts16
-rw-r--r--src/commands/dev/test.ts6
-rw-r--r--src/commands/info/avatar.ts2
-rw-r--r--src/commands/info/botInfo.ts10
-rw-r--r--src/commands/info/guildInfo.ts6
-rw-r--r--src/commands/info/help.ts22
-rw-r--r--src/commands/info/icon.ts2
-rw-r--r--src/commands/info/invite.ts2
-rw-r--r--src/commands/info/ping.ts4
-rw-r--r--src/commands/info/snowflakeInfo.ts2
-rw-r--r--src/commands/info/userInfo.ts11
-rw-r--r--src/commands/moderation/ban.ts18
-rw-r--r--src/commands/moderation/kick.ts15
-rw-r--r--src/commands/moderation/lockdown.ts4
-rw-r--r--src/commands/moderation/modlog.ts19
-rw-r--r--src/commands/moderation/mute.ts29
-rw-r--r--src/commands/moderation/removeReactionEmoji.ts8
-rw-r--r--src/commands/moderation/role.ts20
-rw-r--r--src/commands/moderation/slowmode.ts12
-rw-r--r--src/commands/moderation/unban.ts14
-rw-r--r--src/commands/moderation/unmute.ts8
-rw-r--r--src/commands/moderation/warn.ts10
-rw-r--r--src/commands/moulberry-bush/capePerms.ts20
-rw-r--r--src/commands/moulberry-bush/giveawayPing.ts2
-rw-r--r--src/commands/moulberry-bush/report.ts14
-rw-r--r--src/commands/skyblock-reborn/chooseColorCommand.ts10
-rw-r--r--src/commands/utilities/serverStatus.ts14
-rw-r--r--src/commands/utilities/uuid.ts6
-rw-r--r--src/commands/utilities/viewraw.ts6
-rw-r--r--src/commands/utilities/whoHasRole.ts6
-rw-r--r--src/lib/extensions/discord.js/BushGuild.ts4
-rw-r--r--src/lib/extensions/discord.js/BushGuildMember.ts28
-rw-r--r--src/lib/utils/BushLogger.ts14
-rw-r--r--src/lib/utils/Config.ts6
-rw-r--r--src/listeners/client/interactionCreate.ts2
-rw-r--r--src/listeners/commands/commandBlocked.ts18
-rw-r--r--src/listeners/commands/commandError.ts10
-rw-r--r--src/listeners/commands/commandMissingPermissions.ts12
-rw-r--r--src/listeners/commands/slashBlocked.ts18
-rw-r--r--src/listeners/commands/slashCommandError.ts10
-rw-r--r--src/listeners/commands/slashMissingPermissions.ts12
-rw-r--r--src/listeners/message/automodCreate.ts2
-rw-r--r--src/listeners/message/automodUpdate.ts2
-rw-r--r--src/listeners/other/promiseRejection.ts4
-rw-r--r--src/listeners/other/uncaughtException.ts4
61 files changed, 278 insertions, 304 deletions
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts
index 249789d..00d37c3 100644
--- a/src/commands/admin/channelPermissions.ts
+++ b/src/commands/admin/channelPermissions.ts
@@ -89,7 +89,7 @@ export default class ChannelPermissionsCommand extends BushCommand {
paginate.push(new MessageEmbed().setDescription(failure.substring(i, Math.min(failure.length, i + 2000))));
}
const normalMessage = `Finished changing perms! Failed channels:`;
- this.client.util.buttonPaginate(message, paginate, normalMessage);
+ util.buttonPaginate(message, paginate, normalMessage);
} else {
await message.util.reply({ content: `Finished changing perms! Failed channels:`, embeds: [{ description: failure }] });
}
diff --git a/src/commands/config/autoPublishChannel.ts b/src/commands/config/autoPublishChannel.ts
index a2692e2..8fa987b 100644
--- a/src/commands/config/autoPublishChannel.ts
+++ b/src/commands/config/autoPublishChannel.ts
@@ -40,14 +40,14 @@ export default class AutoPublishChannelCommand extends BushCommand {
public async exec(message: BushMessage, { channel }: { channel: Channel }): Promise<unknown> {
const autoPublishChannels = await message.guild.getSetting('autoPublishChannels');
- const newValue = this.client.util.addOrRemoveFromArray(
+ const newValue = util.addOrRemoveFromArray(
autoPublishChannels.includes(channel.id) ? 'remove' : 'add',
autoPublishChannels,
channel.id
);
await message.guild.setSetting('autoPublishChannels', newValue);
return await message.util.reply({
- content: `${this.client.util.emojis.success} Successfully ${
+ content: `${util.emojis.success} Successfully ${
autoPublishChannels.includes(channel.id) ? 'disabled' : 'enabled'
} auto publishing in <#${channel.id}>.`,
allowedMentions: AllowedMentions.none()
diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts
index 5696c40..33bff35 100644
--- a/src/commands/config/blacklist.ts
+++ b/src/commands/config/blacklist.ts
@@ -72,7 +72,7 @@ export default class BlacklistCommand extends BushCommand {
? (await Argument.cast('channel', this.client.commandHandler.resolver, message as BushMessage, args.target)) ??
(await Argument.cast('user', this.client.commandHandler.resolver, message as BushMessage, args.target))
: args.target;
- if (!target) return await message.util.reply(`${this.client.util.emojis.error} Choose a valid channel or user.`);
+ if (!target) return await message.util.reply(`${util.emojis.error} Choose a valid channel or user.`);
const targetID = target.id;
if (global) {
@@ -81,7 +81,7 @@ export default class BlacklistCommand extends BushCommand {
const blacklistedChannels = (await Global.findByPk(this.client.config.environment)).blacklistedChannels;
action = blacklistedUsers.includes(targetID) || blacklistedChannels.includes(targetID) ? 'unblacklist' : 'blacklist';
}
- const success = await this.client.util
+ const success = await util
.insertOrRemoveFromGlobal(
action === 'blacklist' ? 'add' : 'remove',
target instanceof User ? 'blacklistedUsers' : 'blacklistedChannels',
@@ -90,14 +90,12 @@ export default class BlacklistCommand extends BushCommand {
.catch(() => false);
if (!success)
return await message.util.reply({
- content: `${this.client.util.emojis.error} There was an error globally **${action}ing** ${
- target?.tag ?? target.name
- }.`,
+ content: `${util.emojis.error} There was an error globally **${action}ing** ${target?.tag ?? target.name}.`,
allowedMentions: AllowedMentions.none()
});
else
return await message.util.reply({
- content: `${this.client.util.emojis.success} Successfully **${action}ed** ${target?.tag ?? target.name} globally.`,
+ content: `${util.emojis.success} Successfully **${action}ed** ${target?.tag ?? target.name} globally.`,
allowedMentions: AllowedMentions.none()
});
// guild disable
@@ -107,7 +105,7 @@ export default class BlacklistCommand extends BushCommand {
if (action === 'toggle') {
action = blacklistedChannels.includes(targetID) ?? blacklistedUsers.includes(targetID) ? 'unblacklist' : 'blacklist';
}
- const newValue = this.client.util.addOrRemoveFromArray(
+ const newValue = util.addOrRemoveFromArray(
action === 'blacklist' ? 'add' : 'remove',
target instanceof User ? blacklistedUsers : blacklistedChannels,
targetID
@@ -117,12 +115,12 @@ export default class BlacklistCommand extends BushCommand {
.catch(() => false);
if (!success)
return await message.util.reply({
- content: `${this.client.util.emojis.error} There was an error **${action}ing** ${target?.tag ?? target.name}.`,
+ content: `${util.emojis.error} There was an error **${action}ing** ${target?.tag ?? target.name}.`,
allowedMentions: AllowedMentions.none()
});
else
return await message.util.reply({
- content: `${this.client.util.emojis.success} Successfully **${action}ed** ${target?.tag ?? target.name}.`,
+ content: `${util.emojis.success} Successfully **${action}ed** ${target?.tag ?? target.name}.`,
allowedMentions: AllowedMentions.none()
});
}
diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts
index 00d2561..27e7311 100644
--- a/src/commands/config/disable.ts
+++ b/src/commands/config/disable.ts
@@ -75,12 +75,12 @@ export default class DisableCommand extends BushCommand {
const disabledCommands = (await Global.findByPk(this.client.config.environment)).disabledCommands;
action = disabledCommands.includes(commandID) ? 'disable' : 'enable';
}
- const success = await this.client.util
+ const success = await util
.insertOrRemoveFromGlobal(action === 'disable' ? 'remove' : 'add', 'disabledCommands', commandID)
.catch(() => false);
if (!success)
return await message.util.reply({
- content: `${this.client.util.emojis.error} There was an error globally **${action.substr(
+ content: `${util.emojis.error} There was an error globally **${action.substr(
0,
action.length - 2
)}ing** the **${commandID}** command.`,
@@ -88,7 +88,7 @@ export default class DisableCommand extends BushCommand {
});
else
return await message.util.reply({
- content: `${this.client.util.emojis.success} Successfully **${action.substr(
+ content: `${util.emojis.success} Successfully **${action.substr(
0,
action.length - 2
)}ed** the **${commandID}** command globally.`,
@@ -101,15 +101,11 @@ export default class DisableCommand extends BushCommand {
if (action === 'toggle') {
action = disabledCommands.includes(commandID) ? 'disable' : 'enable';
}
- const newValue = this.client.util.addOrRemoveFromArray(
- action === 'disable' ? 'remove' : 'add',
- disabledCommands,
- commandID
- );
+ const newValue = util.addOrRemoveFromArray(action === 'disable' ? 'remove' : 'add', disabledCommands, commandID);
const success = await message.guild.setSetting('disabledCommands', newValue).catch(() => false);
if (!success)
return await message.util.reply({
- content: `${this.client.util.emojis.error} There was an error **${action.substr(
+ content: `${util.emojis.error} There was an error **${action.substr(
0,
action.length - 2
)}ing** the **${commandID}** command.`,
@@ -117,7 +113,7 @@ export default class DisableCommand extends BushCommand {
});
else
return await message.util.reply({
- content: `${this.client.util.emojis.success} Successfully **${action.substr(
+ content: `${util.emojis.success} Successfully **${action.substr(
0,
action.length - 2
)}ed** the **${commandID}** command.`,
diff --git a/src/commands/config/muteRole.ts b/src/commands/config/muteRole.ts
index 9074a1d..b6e8a81 100644
--- a/src/commands/config/muteRole.ts
+++ b/src/commands/config/muteRole.ts
@@ -40,7 +40,7 @@ export default class MuteRoleCommand extends BushCommand {
async exec(message: BushMessage | BushSlashMessage, args: { role: Role }): Promise<void> {
await message.guild.setSetting('muteRole', args.role.id);
await message.util.send({
- content: `${this.client.util.emojis.success} Changed the server's mute role to <@&${args.role.id}>.`,
+ content: `${util.emojis.success} Changed the server's mute role to <@&${args.role.id}>.`,
allowedMentions: AllowedMentions.none()
});
}
diff --git a/src/commands/config/prefix.ts b/src/commands/config/prefix.ts
index 380442b..26ae5c4 100644
--- a/src/commands/config/prefix.ts
+++ b/src/commands/config/prefix.ts
@@ -41,14 +41,14 @@ export default class PrefixCommand extends BushCommand {
await message.guild.setSetting('prefix', args.prefix ?? this.client.config.prefix);
if (args.prefix) {
return await message.util.send({
- content: `${this.client.util.emojis.success} changed the server's prefix ${
- oldPrefix ? `from \`${oldPrefix}\`` : ''
- } to \`${args.prefix}\`.`,
+ content: `${util.emojis.success} changed the server's prefix ${oldPrefix ? `from \`${oldPrefix}\`` : ''} to \`${
+ args.prefix
+ }\`.`,
allowedMentions: AllowedMentions.none()
});
} else {
return await message.util.send({
- content: `${this.client.util.emojis.success} reset the server's prefix to \`${this.client.config.prefix}\`.`,
+ content: `${util.emojis.success} reset the server's prefix to \`${this.client.config.prefix}\`.`,
allowedMentions: AllowedMentions.none()
});
}
diff --git a/src/commands/config/punishmentFooter.ts b/src/commands/config/punishmentFooter.ts
index 6b2759a..eeac6c1 100644
--- a/src/commands/config/punishmentFooter.ts
+++ b/src/commands/config/punishmentFooter.ts
@@ -42,11 +42,11 @@ export default class PunishmentFooterCommand extends BushCommand {
await message.guild.setSetting('punishmentEnding', args.ending || null);
if (args.ending)
return await message.util.send({
- content: `${
- this.client.util.emojis.success
- } Changed the server's punishment footer to \n\`\`\`${Util.cleanCodeBlockContent(args.ending)}\`\`\`.`,
+ content: `${util.emojis.success} Changed the server's punishment footer to \n\`\`\`${Util.cleanCodeBlockContent(
+ args.ending
+ )}\`\`\`.`,
allowedMentions: AllowedMentions.none()
});
- else return await message.util.send(`${this.client.util.emojis.success} Removed he server's punishment footer.`);
+ else return await message.util.send(`${util.emojis.success} Removed he server's punishment footer.`);
}
}
diff --git a/src/commands/config/welcomeChannel.ts b/src/commands/config/welcomeChannel.ts
index 488a0a9..3db9e74 100644
--- a/src/commands/config/welcomeChannel.ts
+++ b/src/commands/config/welcomeChannel.ts
@@ -41,12 +41,12 @@ export default class WelcomeChannelCommand extends BushCommand {
await message.guild.setSetting('welcomeChannel', args.channel.id ?? undefined);
if (args.channel) {
return await message.util.send(
- `${this.client.util.emojis.success} changed the server's welcome channel ${
- oldChannel ? `from <#${oldChannel}>` : ''
- } to <#${args.channel.id}>.`
+ `${util.emojis.success} changed the server's welcome channel ${oldChannel ? `from <#${oldChannel}>` : ''} to <#${
+ args.channel.id
+ }>.`
);
} else {
- return await message.util.send(`${this.client.util.emojis.success} removed the server's welcome channel.`);
+ return await message.util.send(`${util.emojis.success} removed the server's welcome channel.`);
}
}
}
diff --git a/src/commands/dev/__template.ts b/src/commands/dev/__template.ts
index ffc67ae..1e65457 100644
--- a/src/commands/dev/__template.ts
+++ b/src/commands/dev/__template.ts
@@ -56,6 +56,6 @@ export default class TemplateCommand extends BushCommand {
});
}
public async exec(message: BushMessage | BushSlashMessage): Promise<unknown> {
- return await message.util.reply(`${this.client.util.emojis.error} Do not use the template command.`);
+ return await message.util.reply(`${util.emojis.error} Do not use the template command.`);
}
}
diff --git a/src/commands/dev/_testDuration.ts b/src/commands/dev/_testDuration.ts
index 3ad9aff..0591518 100644
--- a/src/commands/dev/_testDuration.ts
+++ b/src/commands/dev/_testDuration.ts
@@ -44,7 +44,7 @@
// ): Promise<unknown> {
// const rawDuration = reason.duration;
// const text = reason.contentWithoutTime;
-// const humanizedDuration = this.client.util.humanizeDuration(rawDuration);
+// const humanizedDuration = util.humanizeDuration(rawDuration);
// return await message.util.reply(stripIndents`
// **rawDuration:** ${rawDuration}
// **text:** ${text}
diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts
index ecac5f0..3966499 100644
--- a/src/commands/dev/eval.ts
+++ b/src/commands/dev/eval.ts
@@ -57,7 +57,7 @@ export default class EvalCommand extends BushCommand {
}
): Promise<unknown> {
if (!message.author.isOwner())
- return await message.util.reply(`${this.client.util.emojis.error} Only my developers can run this command.`);
+ return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`);
if (message.util.isSlash) {
await (message as BushSlashMessage).interaction.defer({ ephemeral: args.silent });
}
@@ -73,7 +73,7 @@ export default class EvalCommand extends BushCommand {
const badPhrases = ['delete', 'destroy'];
if (badPhrases.some((p) => code[code.lang].includes(p)) && !args.sudo) {
- return await message.util.send(`${this.client.util.emojis.error} This eval was blocked by smooth brain protection™.`);
+ return await message.util.send(`${util.emojis.error} This eval was blocked by smooth brain protection™.`);
}
/* eslint-disable @typescript-eslint/no-unused-vars */
@@ -87,9 +87,9 @@ export default class EvalCommand extends BushCommand {
members = message.guild?.members,
roles = message.guild?.roles,
client = this.client,
- emojis = this.client.util.emojis,
- colors = this.client.util.colors,
- util = this.client.util,
+ emojis = util.emojis,
+ colors = util.colors,
+ util = util,
{ ActivePunishment, Global, Guild, Level, ModLog, StickyRole } = await import('@lib'),
{
ButtonInteraction,
diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts
index 9501314..c930118 100644
--- a/src/commands/dev/reload.ts
+++ b/src/commands/dev/reload.ts
@@ -33,21 +33,19 @@ export default class ReloadCommand extends BushCommand {
public async exec(message: BushMessage | BushSlashMessage, { fast }: { fast: boolean }): Promise<unknown> {
if (!message.author.isOwner())
- return await message.util.reply(`${this.client.util.emojis.error} Only my developers can run this command.`);
+ return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`);
let output: { stdout: string; stderr: string };
try {
const s = new Date();
- output = await this.client.util.shell(`yarn build-${fast ? 'esbuild' : 'tsc'}`);
+ output = await util.shell(`yarn build-${fast ? 'esbuild' : 'tsc'}`);
this.client.commandHandler.reloadAll();
this.client.listenerHandler.reloadAll();
this.client.inhibitorHandler.reloadAll();
return message.util.send(`🔁 Successfully reloaded! (${new Date().getTime() - s.getTime()}ms)`);
} catch (e) {
if (output) await this.client.logger.error('reloadCommand', output);
- return message.util.send(
- `An error occurred while reloading:\n${await this.client.util.codeblock(e?.stack || e, 2048 - 34, 'js')}`
- );
+ return message.util.send(`An error occurred while reloading:\n${await util.codeblock(e?.stack || e, 2048 - 34, 'js')}`);
}
}
}
diff --git a/src/commands/dev/say.ts b/src/commands/dev/say.ts
index 9f16e9c..62ec96a 100644
--- a/src/commands/dev/say.ts
+++ b/src/commands/dev/say.ts
@@ -28,7 +28,7 @@ export default class SayCommand extends BushCommand {
public async exec(message: BushMessage, { say }: { say: string }): Promise<unknown> {
if (!message.author.isOwner())
- return await message.util.reply(`${this.client.util.emojis.error} Only my developers can run this command.`);
+ return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`);
if (message.deletable) {
await message.delete();
@@ -39,7 +39,7 @@ export default class SayCommand extends BushCommand {
public async execSlash(message: AkairoMessage, { content }: { content: string }): Promise<unknown> {
if (!this.client.config.owners.includes(message.author.id)) {
return await message.interaction.reply({
- content: `${this.client.util.emojis.error} Only my developers can run this command.`,
+ content: `${util.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 3986451..c1bfdb7 100644
--- a/src/commands/dev/servers.ts
+++ b/src/commands/dev/servers.ts
@@ -38,11 +38,11 @@ export default class ServersCommand extends BushCommand {
false
)
.setTitle(`Server List [${this.client.guilds.cache.size}]`)
- .setColor(this.client.util.colors.default);
+ .setColor(util.colors.default);
});
embeds.push(embed);
});
- return await this.client.util.buttonPaginate(message, embeds);
+ return await util.buttonPaginate(message, embeds);
}
}
diff --git a/src/commands/dev/setLevel.ts b/src/commands/dev/setLevel.ts
index 4ec4c08..4d08345 100644
--- a/src/commands/dev/setLevel.ts
+++ b/src/commands/dev/setLevel.ts
@@ -50,7 +50,7 @@ export default class SetLevelCommand extends BushCommand {
async exec(message: BushMessage | BushSlashMessage, { user, level }: { user: User; level: number }): Promise<unknown> {
if (!message.author.isOwner())
- return await message.util.reply(`${this.client.util.emojis.error} Only my developers can run this command.`);
+ return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`);
const [levelEntry] = await Level.findOrBuild({
where: {
diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts
index d53e500..acbbfdc 100644
--- a/src/commands/dev/sh.ts
+++ b/src/commands/dev/sh.ts
@@ -39,16 +39,16 @@ export default class ShCommand extends BushCommand {
public async exec(message: BushMessage | BushSlashMessage, { command }: { command: string }): Promise<unknown> {
if (!this.client.config.owners.includes(message.author.id))
- return await message.util.reply(`${this.client.util.emojis.error} Only my developers can run this command.`);
+ return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`);
const input = clean(command);
const embed = new MessageEmbed()
- .setColor(this.client.util.colors.gray)
+ .setColor(util.colors.gray)
.setFooter(message.author.tag, message.author.avatarURL({ dynamic: true }))
.setTimestamp()
.setTitle('Shell Command')
- .addField('📥 Input', await this.client.util.codeblock(input, 1024, 'sh'))
- .addField('Running', this.client.util.emojis.loading);
+ .addField('📥 Input', await util.codeblock(input, 1024, 'sh'))
+ .addField('Running', util.emojis.loading);
await message.util.reply({ embeds: [embed] });
@@ -65,19 +65,19 @@ export default class ShCommand extends BushCommand {
const stderr = strip(clean(output.stderr));
embed
- .setTitle(`${this.client.util.emojis.successFull} Executed command successfully.`)
- .setColor(this.client.util.colors.success)
+ .setTitle(`${util.emojis.successFull} Executed command successfully.`)
+ .setColor(util.colors.success)
.spliceFields(1, 1);
- if (stdout) embed.addField('📤 stdout', await this.client.util.codeblock(stdout, 1024, 'json'));
- if (stderr) embed.addField('📤 stderr', await this.client.util.codeblock(stderr, 1024, 'json'));
+ if (stdout) embed.addField('📤 stdout', await util.codeblock(stdout, 1024, 'json'));
+ if (stderr) embed.addField('📤 stderr', await util.codeblock(stderr, 1024, 'json'));
} catch (e) {
embed
- .setTitle(`${this.client.util.emojis.errorFull} An error occurred while executing.`)
- .setColor(this.client.util.colors.error)
+ .setTitle(`${util.emojis.errorFull} An error occurred while executing.`)
+ .setColor(util.colors.error)
.spliceFields(1, 1);
- embed.addField('📤 Output', await this.client.util.codeblock(e?.stack, 1024, 'js'));
+ embed.addField('📤 Output', await util.codeblock(e?.stack, 1024, 'js'));
}
await message.util.edit({ embeds: [embed] });
}
diff --git a/src/commands/dev/superUser.ts b/src/commands/dev/superUser.ts
index e06d064..cc1519f 100644
--- a/src/commands/dev/superUser.ts
+++ b/src/commands/dev/superUser.ts
@@ -41,30 +41,28 @@ export default class SuperUserCommand extends BushCommand {
}
public async exec(message: BushMessage | BushSlashMessage, args: { action: 'add' | 'remove'; user: User }): Promise<unknown> {
if (!message.author.isOwner())
- return await message.util.reply(`${this.client.util.emojis.error} Only my developers can run this command.`);
+ return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`);
const superUsers = (await Global.findByPk(this.client.config.environment)).superUsers;
let success;
if (args.action === 'add') {
if (superUsers.includes(args.user.id)) {
- return message.util.reply(`${this.client.util.emojis.warn} \`${args.user.tag}\` is already a superuser.`);
+ return message.util.reply(`${util.emojis.warn} \`${args.user.tag}\` is already a superuser.`);
}
- success = await this.client.util.insertOrRemoveFromGlobal('add', 'superUsers', args.user.id).catch(() => false);
+ success = await util.insertOrRemoveFromGlobal('add', 'superUsers', args.user.id).catch(() => false);
} else {
if (!superUsers.includes(args.user.id)) {
- return message.util.reply(`${this.client.util.emojis.warn} \`${args.user.tag}\` is not superuser.`);
+ return message.util.reply(`${util.emojis.warn} \`${args.user.tag}\` is not superuser.`);
}
- success = await this.client.util.insertOrRemoveFromGlobal('remove', 'superUsers', args.user.id).catch(() => false);
+ success = await util.insertOrRemoveFromGlobal('remove', 'superUsers', args.user.id).catch(() => false);
}
if (success) {
const responses = [args.action == 'remove' ? '' : 'made', args.action == 'remove' ? 'is no longer' : ''];
- return message.util.reply(
- `${this.client.util.emojis.success} ${responses[0]} \`${args.user.tag}\` ${responses[1]} a superuser.`
- );
+ return message.util.reply(`${util.emojis.success} ${responses[0]} \`${args.user.tag}\` ${responses[1]} a superuser.`);
} else {
const response = [args.action == 'remove' ? `removing` : 'making', args.action == 'remove' ? `from` : 'to'];
return message.util.reply(
- `${this.client.util.emojis.error} There was an error ${response[0]} \`${args.user.tag}\` ${response[1]} the superuser list.`
+ `${util.emojis.error} There was an error ${response[0]} \`${args.user.tag}\` ${response[1]} the superuser list.`
);
}
}
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index 858e34b..f7edda2 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -90,7 +90,7 @@ export default class TestCommand extends BushCommand {
for (let i = 1; i <= 5; i++) {
embeds.push(new MessageEmbed().setDescription(i.toString()));
}
- return await this.client.util.buttonPaginate(message, embeds);
+ return await util.buttonPaginate(message, embeds);
} else if (['lots of embeds'].includes(args?.feature?.toLowerCase())) {
const description = 'This is a description.';
const author = { name: 'This is a author', iconURL: message.author.avatarURL({ dynamic: true }) };
@@ -99,7 +99,7 @@ export default class TestCommand extends BushCommand {
for (let i = 0; i < 25; i++) {
fields.push({ name: 'Field ' + i, value: 'Field Value ' + i });
}
- const c = this.client.util.colors;
+ const c = util.colors;
const o = { description, author, footer, fields };
const embeds = [
@@ -142,7 +142,7 @@ export default class TestCommand extends BushCommand {
globalCommands.forEach(async (command) => await command.delete());
return await message.util.reply(
- `${this.client.util.emojis.success} Removed **${/* guildCommandCount */ guildCommands.size}** guild commands and **${
+ `${util.emojis.success} Removed **${/* guildCommandCount */ guildCommands.size}** guild commands and **${
globalCommands.size
}** global commands.`
);
diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts
index 3d1776f..dc10f7d 100644
--- a/src/commands/info/avatar.ts
+++ b/src/commands/info/avatar.ts
@@ -42,7 +42,7 @@ export default class AvatarCommand extends BushCommand {
const embed = new MessageEmbed()
.setTimestamp()
- .setColor(this.client.util.colors.default)
+ .setColor(util.colors.default)
.setTitle(user.tag)
.setImage(user.avatarURL({ size: 2048, format: 'png', dynamic: true }));
diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts
index 9d8ab4c..29ed29a 100644
--- a/src/commands/info/botInfo.ts
+++ b/src/commands/info/botInfo.ts
@@ -18,13 +18,13 @@ export default class BotInfoCommand extends BushCommand {
}
public async exec(message: BushMessage | BushSlashMessage): Promise<void> {
- const developers = (await this.client.util.mapIDs(this.client.config.owners)).map((u) => u?.tag).join('\n');
- const currentCommit = (await this.client.util.shell('git rev-parse HEAD')).stdout.replace('\n', '');
- let repoUrl = (await this.client.util.shell('git remote get-url origin')).stdout.replace('\n', '');
+ const developers = (await util.mapIDs(this.client.config.owners)).map((u) => u?.tag).join('\n');
+ const currentCommit = (await util.shell('git rev-parse HEAD')).stdout.replace('\n', '');
+ let repoUrl = (await util.shell('git remote get-url origin')).stdout.replace('\n', '');
repoUrl = repoUrl.substring(0, repoUrl.length - 4);
const embed = new MessageEmbed()
.setTitle('Bot Info:')
- .addField('**Uptime**', this.client.util.humanizeDuration(this.client.uptime), true)
+ .addField('**Uptime**', util.humanizeDuration(this.client.uptime), true)
.addField('**Servers**', this.client.guilds.cache.size.toLocaleString(), true)
.addField('**Users**', this.client.users.cache.size.toLocaleString(), true)
.addField('**Discord.js Version**', discordJSVersion, true)
@@ -36,7 +36,7 @@ export default class BotInfoCommand extends BushCommand {
.addField('**Current Commit**', `[${currentCommit.substring(0, 7)}](${repoUrl}/commit/${currentCommit})`, true)
.addField('**Developers**', developers, true)
.setTimestamp()
- .setColor(this.client.util.colors.default);
+ .setColor(util.colors.default);
await message.util.reply({ embeds: [embed] });
}
}
diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts
index a3e7405..2e541f3 100644
--- a/src/commands/info/guildInfo.ts
+++ b/src/commands/info/guildInfo.ts
@@ -42,7 +42,7 @@ export default class GuildInfoCommand extends BushCommand {
public async exec(message: BushMessage | BushSlashMessage, args: { guild: Guild | bigint | GuildPreview }): Promise<unknown> {
if (!args?.guild && !message.guild) {
return await message.util.reply(
- `${this.client.util.emojis.error} You must either provide an server to provide info about or run this command in a server.`
+ `${util.emojis.error} You must either provide an server to provide info about or run this command in a server.`
);
}
let isPreview = false;
@@ -52,7 +52,7 @@ export default class GuildInfoCommand extends BushCommand {
args.guild = preview;
isPreview = true;
} else {
- return await message.util.reply(`${this.client.util.emojis.error} That guild is not discoverable or does not exist.`);
+ return await message.util.reply(`${util.emojis.error} That guild is not discoverable or does not exist.`);
}
}
const guild: Guild | GuildPreview = (args?.guild as Guild | GuildPreview) || (message.guild as Guild);
@@ -154,7 +154,7 @@ export default class GuildInfoCommand extends BushCommand {
const guildInfoEmbed = new MessageEmbed()
.setTitle(guild.name)
- .setColor(this.client.util.colors.default)
+ .setColor(util.colors.default)
.addField('» About', guildAbout.join('\n'));
const guildIcon = guild.iconURL({ size: 2048, format: 'png', dynamic: true });
if (guildIcon) {
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts
index 3c75645..a644755 100644
--- a/src/commands/info/help.ts
+++ b/src/commands/info/help.ts
@@ -61,11 +61,11 @@ export default class HelpCommand extends BushCommand {
}
if (!this.client.guilds.cache.get(this.client.config.supportGuild.id).members.cache.has(message.author.id)) {
row.addComponents(
- new MessageButton({
- style: 'LINK',
- label: 'Support Server',
- url: this.client.config.supportGuild.invite
- })
+ new MessageButton({
+ style: 'LINK',
+ label: 'Support Server',
+ url: this.client.config.supportGuild.invite
+ })
);
}
row.addComponents(
@@ -74,8 +74,8 @@ export default class HelpCommand extends BushCommand {
label: 'GitHub',
url: packageDotJSON.repository
})
- )
-
+ );
+
const isOwner = this.client.isOwner(message.author);
const isSuperUser = this.client.isSuperUser(message.author);
const command = args.command
@@ -85,7 +85,7 @@ export default class HelpCommand extends BushCommand {
: null;
if (!isOwner) args.showHidden = false;
if (!command || command.completelyHide) {
- const embed = new MessageEmbed().setColor(this.client.util.colors.default).setTimestamp();
+ const embed = new MessageEmbed().setColor(util.colors.default).setTimestamp();
if (message.guild) {
embed.setFooter(`For more information about a command use ${prefix}help <command>`);
}
@@ -114,11 +114,11 @@ export default class HelpCommand extends BushCommand {
}
const embed = new MessageEmbed()
- .setColor(this.client.util.colors.default)
- .setTitle(`\`${command.description?.usage || `${this.client.util.emojis.error} This command does not have usages.`}\``)
+ .setColor(util.colors.default)
+ .setTitle(`\`${command.description?.usage || `${util.emojis.error} This command does not have usages.`}\``)
.addField(
'Description',
- `${command.description?.content || `${this.client.util.emojis.error} This command does not have a description.`} ${
+ `${command.description?.content || `${util.emojis.error} This command does not have a description.`} ${
command.ownerOnly ? '\n__Developer Only__' : ''
} ${command.superUserOnly ? '\n__Super User Only__' : ''}`
);
diff --git a/src/commands/info/icon.ts b/src/commands/info/icon.ts
index bd1cdf4..598cd14 100644
--- a/src/commands/info/icon.ts
+++ b/src/commands/info/icon.ts
@@ -20,7 +20,7 @@ export default class IconCommand extends BushCommand {
async exec(message: BushMessage | BushSlashMessage): Promise<void> {
const embed = new MessageEmbed()
.setTimestamp()
- .setColor(this.client.util.colors.default)
+ .setColor(util.colors.default)
.setImage(
message.guild?.iconURL({
size: 2048,
diff --git a/src/commands/info/invite.ts b/src/commands/info/invite.ts
index 79251dc..1f65cdc 100644
--- a/src/commands/info/invite.ts
+++ b/src/commands/info/invite.ts
@@ -20,7 +20,7 @@ export default class InviteCommand extends BushCommand {
public async exec(message: BushMessage | BushSlashMessage): Promise<unknown> {
if (this.client.config.isDevelopment)
- return await message.util.reply(`${this.client.util.emojis.error} The dev bot cannot be invited.`);
+ return await message.util.reply(`${util.emojis.error} The dev bot cannot be invited.`);
const ButtonRow = new MessageActionRow().addComponents(
new MessageButton({
style: 'LINK',
diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts
index d1f406d..36f3bc7 100644
--- a/src/commands/info/ping.ts
+++ b/src/commands/info/ping.ts
@@ -27,7 +27,7 @@ export default class PingCommand extends BushCommand {
.addField('Bot Latency', botLatency, true)
.addField('API Latency', apiLatency, true)
.setFooter(message.author.username, message.author.displayAvatarURL({ dynamic: true }))
- .setColor(this.client.util.colors.default)
+ .setColor(util.colors.default)
.setTimestamp();
await sentMessage.edit({
content: null,
@@ -46,7 +46,7 @@ export default class PingCommand extends BushCommand {
.addField('Bot Latency', botLatency, true)
.addField('API Latency', apiLatency, true)
.setFooter(message.interaction.user.username, message.interaction.user.displayAvatarURL({ dynamic: true }))
- .setColor(this.client.util.colors.default)
+ .setColor(util.colors.default)
.setTimestamp();
await message.interaction.editReply({
content: null,
diff --git a/src/commands/info/snowflakeInfo.ts b/src/commands/info/snowflakeInfo.ts
index e234cc2..b32245c 100644
--- a/src/commands/info/snowflakeInfo.ts
+++ b/src/commands/info/snowflakeInfo.ts
@@ -54,7 +54,7 @@ export default class SnowflakeInfoCommand extends BushCommand {
}
public async exec(message: BushMessage | BushSlashMessage, args: { snowflake: bigint }): Promise<unknown> {
const snowflake = `${args.snowflake}` as Snowflake;
- const snowflakeEmbed = new MessageEmbed().setTitle('Unknown :snowflake:').setColor(this.client.util.colors.default);
+ const snowflakeEmbed = new MessageEmbed().setTitle('Unknown :snowflake:').setColor(util.colors.default);
// Channel
if (this.client.channels.cache.has(snowflake)) {
diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts
index 7172c75..5cfc6f0 100644
--- a/src/commands/info/userInfo.ts
+++ b/src/commands/info/userInfo.ts
@@ -109,9 +109,7 @@ export default class UserInfoCommand extends BushCommand {
serverUserInfo.push(`**General Deletions:** 1`);
if (user.nickname) serverUserInfo.push(`**Nickname** ${user.nickname}`);
if (serverUserInfo.length)
- userEmbed
- .addField('» Server Info', serverUserInfo.join('\n'))
- .setColor(user.displayColor || this.client.util.colors.default);
+ userEmbed.addField('» Server Info', serverUserInfo.join('\n')).setColor(user.displayColor || util.colors.default);
// User Presence Info
if (user.presence?.status || user.presence?.clientStatus || user.presence?.activities) {
@@ -130,12 +128,9 @@ export default class UserInfoCommand extends BushCommand {
if (user.presence.clientStatus) devices = Object.keys(user.presence.clientStatus);
const presenceInfo = [];
if (user.presence.status) presenceInfo.push(`**Status:** ${user.presence.status}`);
- if (devices)
- presenceInfo.push(`**${devices.length - 1 ? 'Devices' : 'Device'}:** ${this.client.util.oxford(devices, 'and', '')}`);
+ if (devices) presenceInfo.push(`**${devices.length - 1 ? 'Devices' : 'Device'}:** ${util.oxford(devices, 'and', '')}`);
if (activitiesNames.length)
- presenceInfo.push(
- `**Activit${activitiesNames.length - 1 ? 'ies' : 'y'}:** ${this.client.util.oxford(activitiesNames, 'and', '')}`
- );
+ presenceInfo.push(`**Activit${activitiesNames.length - 1 ? 'ies' : 'y'}:** ${util.oxford(activitiesNames, 'and', '')}`);
if (customStatus) presenceInfo.push(`**Custom Status:** ${customStatus}`);
userEmbed.addField('» Presence', presenceInfo.join('\n'));
}
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index 874d5ed..27a0ffc 100644
--- a/src/commands/moderation/ban.ts
+++ b/src/commands/moderation/ban.ts
@@ -5,7 +5,7 @@ import { User } from 'discord.js';
export default class BanCommand extends BushCommand {
public constructor() {
super('ban', {
- aliases: ['ban'],
+ aliases: ['ban', 'forceban'],
category: 'moderation',
description: {
content: 'Ban a member from the server.',
@@ -91,14 +91,14 @@ export default class BanCommand extends BushCommand {
): Promise<unknown> {
const member = message.guild.members.cache.get(user.id) as BushGuildMember;
const useForce = force && message.author.isOwner();
- const canModerateResponse = this.client.util.moderationPermissionCheck(message.member, member, 'ban', true, useForce);
+ const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'ban', true, useForce);
if (canModerateResponse !== true) {
return message.util.reply(canModerateResponse);
}
if (!Number.isInteger(days) || days < 0 || days > 7) {
- return message.util.reply(`${this.client.util.emojis.error} The delete days must be an integer between 0 and 7.`);
+ return message.util.reply(`${util.emojis.error} The delete days must be an integer between 0 and 7.`);
}
let time: number;
@@ -120,17 +120,17 @@ export default class BanCommand extends BushCommand {
const responseMessage = () => {
switch (responseCode) {
case 'missing permissions':
- return `${this.client.util.emojis.error} Could not ban **${member.user.tag}** because I do not have permissions`;
+ return `${util.emojis.error} Could not ban **${member.user.tag}** because I do not have permissions`;
case 'error banning':
- return `${this.client.util.emojis.error} An error occurred while trying to ban **${member.user.tag}**.`;
+ return `${util.emojis.error} An error occurred while trying to ban **${member.user.tag}**.`;
case 'error creating ban entry':
- return `${this.client.util.emojis.error} While banning **${member.user.tag}**, there was an error creating a ban entry, please report this to my developers.`;
+ return `${util.emojis.error} While banning **${member.user.tag}**, there was an error creating a ban entry, please report this to my developers.`;
case 'error creating modlog entry':
- return `${this.client.util.emojis.error} While banning **${member.user.tag}**, there was an error creating a modlog entry, please report this to my developers.`;
+ return `${util.emojis.error} While banning **${member.user.tag}**, there was an error creating a modlog entry, please report this to my developers.`;
case 'failed to dm':
- return `${this.client.util.emojis.warn} Banned **${member.user.tag}** however I could not send them a dm.`;
+ return `${util.emojis.warn} Banned **${member.user.tag}** however I could not send them a dm.`;
case 'success':
- return `${this.client.util.emojis.success} Successfully banned **${member.user.tag}**.`;
+ return `${util.emojis.success} Successfully banned **${member.user.tag}**.`;
}
};
return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts
index 74ace94..bc7d9d2 100644
--- a/src/commands/moderation/kick.ts
+++ b/src/commands/moderation/kick.ts
@@ -60,8 +60,11 @@ export default class KickCommand extends BushCommand {
{ user, reason, force }: { user: BushUser; reason?: string; force: boolean }
): Promise<unknown> {
const member = message.guild.members.cache.get(user.id) as BushGuildMember;
+
+ if (!member) message.util.reply(`${util.emojis.error} You cannot kick members that are not in the server.`);
+
const useForce = force && message.author.isOwner();
- const canModerateResponse = this.client.util.moderationPermissionCheck(message.member, member, 'kick', true, useForce);
+ const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'kick', true, useForce);
if (canModerateResponse !== true) {
return message.util.reply(canModerateResponse);
@@ -75,15 +78,15 @@ export default class KickCommand extends BushCommand {
const responseMessage = () => {
switch (responseCode) {
case 'missing permissions':
- return `${this.client.util.emojis.error} Could not kick **${member.user.tag}** because I am missing the \`Kick Members\` permission.`;
+ return `${util.emojis.error} Could not kick **${member.user.tag}** because I am missing the \`Kick Members\` permission.`;
case 'error kicking':
- return `${this.client.util.emojis.error} An error occurred while trying to kick **${member.user.tag}**.`;
+ return `${util.emojis.error} An error occurred while trying to kick **${member.user.tag}**.`;
case 'error creating modlog entry':
- return `${this.client.util.emojis.error} While muting **${member.user.tag}**, there was an error creating a modlog entry, please report this to my developers.`;
+ return `${util.emojis.error} While muting **${member.user.tag}**, there was an error creating a modlog entry, please report this to my developers.`;
case 'failed to dm':
- return `${this.client.util.emojis.warn} Kicked **${member.user.tag}** however I could not send them a dm.`;
+ return `${util.emojis.warn} Kicked **${member.user.tag}** however I could not send them a dm.`;
case 'success':
- return `${this.client.util.emojis.success} Successfully kicked **${member.user.tag}**.`;
+ return `${util.emojis.success} Successfully kicked **${member.user.tag}**.`;
}
};
return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
diff --git a/src/commands/moderation/lockdown.ts b/src/commands/moderation/lockdown.ts
index e67d110..4eaeceb 100644
--- a/src/commands/moderation/lockdown.ts
+++ b/src/commands/moderation/lockdown.ts
@@ -35,8 +35,8 @@ export default class LockdownCommand extends BushCommand {
return await message.util.reply('no');
if (!all) {
if (!['GUILD_TEXT', 'GUILD_NEWS'].includes(message.channel.type))
- return message.util.reply(`${this.client.util.emojis.error} You can only lock down text and announcement channels.`);
- const lockdownSuccess = await this.client.util.lockdownChannel({
+ return message.util.reply(`${util.emojis.error} You can only lock down text and announcement channels.`);
+ const lockdownSuccess = await util.lockdownChannel({
channel: message.channel as BushTextChannel | BushNewsChannel,
moderator: message.author
});
diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts
index e3da45f..c55b9a3 100644
--- a/src/commands/moderation/modlog.ts
+++ b/src/commands/moderation/modlog.ts
@@ -42,13 +42,13 @@ export default class ModlogCommand extends BushCommand {
`**User**: <@!${log.user}> (${log.user})`,
`**Moderator**: <@!${log.moderator}> (${log.moderator})`
];
- if (log.duration) modLog.push(`**Duration**: ${this.client.util.humanizeDuration(log.duration)}`);
+ if (log.duration) modLog.push(`**Duration**: ${util.humanizeDuration(log.duration)}`);
modLog.push(`**Reason**: ${log.reason || 'No Reason Specified.'}`);
return modLog.join(`\n`);
}
async exec(message: BushMessage | BushSlashMessage, { search }: { search: BushUser | string }): Promise<unknown> {
- const foundUser = search instanceof User ? search : await this.client.util.resolveUserAsync(search);
+ const foundUser = search instanceof User ? search : await util.resolveUserAsync(search);
if (foundUser) {
const logs = await ModLog.findAll({
where: {
@@ -57,31 +57,30 @@ export default class ModlogCommand extends BushCommand {
},
order: [['createdAt', 'ASC']]
});
- if (!logs.length)
- return message.util.reply(`${this.client.util.emojis.error} **${foundUser.tag}** does not have any modlogs.`);
+ if (!logs.length) return message.util.reply(`${util.emojis.error} **${foundUser.tag}** does not have any modlogs.`);
const niceLogs: string[] = [];
for (const log of logs) {
niceLogs.push(this.generateModlogInfo(log));
}
- const chunked: string[][] = this.client.util.chunk(niceLogs, 3);
+ const chunked: string[][] = util.chunk(niceLogs, 3);
const embedPages = chunked.map(
(chunk) =>
new MessageEmbed({
title: `${foundUser.tag}'s Mod Logs`,
description: chunk.join('\n**―――――――――――――――――――――――――――**\n'),
- color: this.client.util.colors.default
+ color: util.colors.default
})
);
- return await this.client.util.buttonPaginate(message, embedPages, '', true);
+ return await util.buttonPaginate(message, embedPages, '', true);
} else if (search) {
const entry = await ModLog.findByPk(search as string);
- if (!entry) return message.util.send(`${this.client.util.emojis.error} That modlog does not exist.`);
+ if (!entry) return message.util.send(`${util.emojis.error} That modlog does not exist.`);
const embed = new MessageEmbed({
title: `Case ${entry.id}`,
description: this.generateModlogInfo(entry),
- color: this.client.util.colors.default
+ color: util.colors.default
});
- return await this.client.util.buttonPaginate(message, [embed]);
+ return await util.buttonPaginate(message, [embed]);
}
}
}
diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts
index 2004eb8..0b10ee1 100644
--- a/src/commands/moderation/mute.ts
+++ b/src/commands/moderation/mute.ts
@@ -60,10 +60,11 @@ export default class MuteCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
{ user, reason, force }: { user: BushUser; reason?: { duration: number; contentWithoutTime: string }; force: boolean }
): Promise<unknown> {
- const error = this.client.util.emojis.error;
const member = message.guild.members.cache.get(user.id) as BushGuildMember;
+ if (!member) message.util.reply(`${util.emojis.error} You cannot kick members that are not in the server.`);
+
const useForce = force && message.author.isOwner();
- const canModerateResponse = this.client.util.moderationPermissionCheck(message.member, member, 'mute', true, useForce);
+ const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'mute', true, useForce);
const victimBoldTag = `**${member.user.tag}**`;
if (canModerateResponse !== true) {
@@ -85,29 +86,29 @@ export default class MuteCommand extends BushCommand {
duration: time
});
- const responseMessage = () => {
- const prefix = message.guild.getSetting('prefix');
+ const responseMessage = async () => {
+ const prefix = await message.guild.getSetting('prefix');
switch (responseCode) {
case 'missing permissions':
- return `${error} Could not mute ${victimBoldTag} because I am missing the \`Manage Roles\` permission.`;
+ return `${util.emojis.error} Could not mute ${victimBoldTag} because I am missing the \`Manage Roles\` permission.`;
case 'no mute role':
- return `${error} Could not mute ${victimBoldTag}, you must set a mute role with \`${prefix}muterole\`.`;
+ return `${util.emojis.error} Could not mute ${victimBoldTag}, you must set a mute role with \`${prefix}muterole\`.`;
case 'invalid mute role':
- return `${error} Could not mute ${victimBoldTag} because the current mute role no longer exists. Please set a new mute role with \`${prefix}muterole\`.`;
+ return `${util.emojis.error} Could not mute ${victimBoldTag} because the current mute role no longer exists. Please set a new mute role with \`${prefix}muterole\`.`;
case 'mute role not manageable':
- return `${error} Could not mute ${victimBoldTag} because I cannot assign the current mute role, either change the role's position or set a new mute role with \`${prefix}muterole\`.`;
+ return `${util.emojis.error} Could not mute ${victimBoldTag} because I cannot assign the current mute role, either change the role's position or set a new mute role with \`${prefix}muterole\`.`;
case 'error giving mute role':
- return `${error} Could not mute ${victimBoldTag}, there was an error assigning them the mute role.`;
+ return `${util.emojis.error} Could not mute ${victimBoldTag}, there was an error assigning them the mute role.`;
case 'error creating modlog entry':
- return `${error} There was an error creating a modlog entry, please report this to my developers.`;
+ return `${util.emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
case 'error creating mute entry':
- return `${error} There was an error creating a punishment entry, please report this to my developers.`;
+ return `${util.emojis.error} There was an error creating a punishment entry, please report this to my developers.`;
case 'failed to dm':
- return `${this.client.util.emojis.warn} Muted **${member.user.tag}** however I could not send them a dm.`;
+ return `${util.emojis.warn} Muted **${member.user.tag}** however I could not send them a dm.`;
case 'success':
- return `${this.client.util.emojis.success} Successfully muted **${member.user.tag}**.`;
+ return `${util.emojis.success} Successfully muted **${member.user.tag}**.`;
}
};
- return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
+ return await message.util.reply({ content: await responseMessage(), allowedMentions: AllowedMentions.none() });
}
}
diff --git a/src/commands/moderation/removeReactionEmoji.ts b/src/commands/moderation/removeReactionEmoji.ts
index b0079c6..cb1be04 100644
--- a/src/commands/moderation/removeReactionEmoji.ts
+++ b/src/commands/moderation/removeReactionEmoji.ts
@@ -49,13 +49,13 @@ export default class RemoveReactionEmojiCommand extends BushCommand {
.catch(() => {});
if (success) {
return await message.util.reply(
- `${this.client.util.emojis.success} Removed all reactions of \`${
- id ? emojiID : emoji
- }\` from the message with the id of \`${messageToRemoveFrom.id}\`.`
+ `${util.emojis.success} Removed all reactions of \`${id ? emojiID : emoji}\` from the message with the id of \`${
+ messageToRemoveFrom.id
+ }\`.`
);
} else {
return await message.util.reply(
- `${this.client.util.emojis.error} There was an error removing all reactions of \`${
+ `${util.emojis.error} There was an error removing all reactions of \`${
id ? emojiID : emoji
}\` from the message with the id of \`${messageToRemoveFrom.id}\`.`
);
diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts
index 3470ab9..63fb3a2 100644
--- a/src/commands/moderation/role.ts
+++ b/src/commands/moderation/role.ts
@@ -103,7 +103,7 @@ export default class RoleCommand extends BushCommand {
}
if (!mappedRole || !mappings.roleWhitelist[mappedRole.name]) {
return await message.util.reply({
- content: `${this.client.util.emojis.error} <@&${role.id}> is not whitelisted, and you do not have manage roles permission.`,
+ content: `${util.emojis.error} <@&${role.id}> is not whitelisted, and you do not have manage roles permission.`,
allowedMentions: AllowedMentions.none()
});
}
@@ -115,7 +115,7 @@ export default class RoleCommand extends BushCommand {
});
if (!message.member.roles.cache.some((role) => allowedRoles.includes(role.id))) {
return await message.util.reply({
- content: `${this.client.util.emojis.error} <@&${role.id}> is whitelisted, but you do not have any of the roles required to manage it.`,
+ content: `${util.emojis.error} <@&${role.id}> is whitelisted, but you do not have any of the roles required to manage it.`,
allowedMentions: AllowedMentions.none()
});
}
@@ -131,25 +131,25 @@ export default class RoleCommand extends BushCommand {
const responseMessage = () => {
switch (responseCode) {
case 'user hierarchy':
- return `${this.client.util.emojis.error} <@&${role.id}> is higher or equal to your highest role.`;
+ return `${util.emojis.error} <@&${role.id}> is higher or equal to your highest role.`;
case 'role managed':
- return `${this.client.util.emojis.error} <@&${role.id}> is managed by an integration and cannot be managed.`;
+ return `${util.emojis.error} <@&${role.id}> is managed by an integration and cannot be managed.`;
case 'client hierarchy':
- return `${this.client.util.emojis.error} <@&${role.id}> is higher or equal to my highest role.`;
+ return `${util.emojis.error} <@&${role.id}> is higher or equal to my highest role.`;
case 'error creating modlog entry':
- return `${this.client.util.emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
+ return `${util.emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
case 'error creating role entry' || 'error removing role entry':
- return `${this.client.util.emojis.error} There was an error ${
+ return `${util.emojis.error} There was an error ${
action === 'add' ? 'creating' : 'removing'
} a punishment entry, please report this to my developers.`;
case 'error adding role' || 'error removing role':
- return `${this.client.util.emojis.error} An error occurred while trying to ${action} <@&${role.id}> ${
+ return `${util.emojis.error} An error occurred while trying to ${action} <@&${role.id}> ${
action === 'add' ? 'to' : 'from'
} **${user.user.tag}**.`;
case 'success':
- return `${this.client.util.emojis.success} Successfully ${action === 'add' ? 'added' : 'removed'} <@&${role.id}> ${
+ return `${util.emojis.success} Successfully ${action === 'add' ? 'added' : 'removed'} <@&${role.id}> ${
action === 'add' ? 'to' : 'from'
- } **${user.user.tag}**${duration ? ` for ${this.client.util.humanizeDuration(duration)}` : ''}.`;
+ } **${user.user.tag}**${duration ? ` for ${util.humanizeDuration(duration)}` : ''}.`;
}
};
diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts
index 8384562..019e545 100644
--- a/src/commands/moderation/slowmode.ts
+++ b/src/commands/moderation/slowmode.ts
@@ -54,10 +54,10 @@ export default class SlowModeCommand extends BushCommand {
{ length, channel }: { length: number | 'off' | 'none' | 'disable'; channel: TextChannel | ThreadChannel }
): Promise<unknown> {
if (message.channel.type === 'DM')
- return await message.util.reply(`${this.client.util.emojis.error} This command cannot be run in dms.`);
+ return await message.util.reply(`${util.emojis.error} This command cannot be run in dms.`);
if (!channel) channel = message.channel as ThreadChannel | TextChannel;
if (!(channel instanceof TextChannel) || !(channel instanceof ThreadChannel))
- return await message.util.reply(`${this.client.util.emojis.error} <#${channel.id}> is not a text or thread channel.`);
+ return await message.util.reply(`${util.emojis.error} <#${channel.id}> is not a text or thread channel.`);
if (length) {
length =
typeof length === 'string' && !['off', 'none', 'disable'].includes(length)
@@ -73,14 +73,12 @@ export default class SlowModeCommand extends BushCommand {
.catch(() => {});
if (!setSlowmode)
return await message.util.reply(
- `${this.client.util.emojis.error} There was an error changing the slowmode of <#${
- (channel as ThreadChannel | TextChannel).id
- }>.`
+ `${util.emojis.error} There was an error changing the slowmode of <#${(channel as ThreadChannel | TextChannel).id}>.`
);
else
return await message.util.reply(
- `${this.client.util.emojis.success} Successfully changed the slowmode of ${channel} ${
- length2 ? `to \`${this.client.util.humanizeDuration(length2)}` : '`off'
+ `${util.emojis.success} Successfully changed the slowmode of ${channel} ${
+ length2 ? `to \`${util.humanizeDuration(length2)}` : '`off'
}\`.`
);
}
diff --git a/src/commands/moderation/unban.ts b/src/commands/moderation/unban.ts
index 0de2489..26878d9 100644
--- a/src/commands/moderation/unban.ts
+++ b/src/commands/moderation/unban.ts
@@ -53,7 +53,7 @@ export default class UnbanCommand extends BushCommand {
}
async exec(message: BushMessage | BushSlashMessage, { user, reason }: { user: User; reason?: string }): Promise<unknown> {
if (!(user instanceof User)) {
- user = this.client.util.resolveUser(user, this.client.users.cache);
+ user = util.resolveUser(user, this.client.users.cache);
}
const responseCode = await message.guild.unban({
user,
@@ -64,17 +64,17 @@ export default class UnbanCommand extends BushCommand {
const responseMessage = () => {
switch (responseCode) {
case 'missing permissions':
- return `${this.client.util.emojis.error} Could not unban **${user.tag}** because I do not have permissions`;
+ return `${util.emojis.error} Could not unban **${user.tag}** because I do not have permissions`;
case 'error unbanning':
- return `${this.client.util.emojis.error} An error occurred while trying to unban **${user.tag}**.`;
+ return `${util.emojis.error} An error occurred while trying to unban **${user.tag}**.`;
case 'error removing ban entry':
- return `${this.client.util.emojis.error} While unbanning **${user.tag}**, there was an error removing their ban entry, please report this to my developers.`;
+ return `${util.emojis.error} While unbanning **${user.tag}**, there was an error removing their ban entry, please report this to my developers.`;
case 'error creating modlog entry':
- return `${this.client.util.emojis.error} While unbanning **${user.tag}**, there was an error creating a modlog entry, please report this to my developers.`;
+ return `${util.emojis.error} While unbanning **${user.tag}**, there was an error creating a modlog entry, please report this to my developers.`;
case 'user not banned':
- return `${this.client.util.emojis.warn} **${user.tag}** but I tried to unban them anyways.`;
+ return `${util.emojis.warn} **${user.tag}** but I tried to unban them anyways.`;
case 'success':
- return `${this.client.util.emojis.success} Successfully unbanned **${user.tag}**.`;
+ return `${util.emojis.success} Successfully unbanned **${user.tag}**.`;
}
};
return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts
index 277ca91..807cf2c 100644
--- a/src/commands/moderation/unmute.ts
+++ b/src/commands/moderation/unmute.ts
@@ -51,9 +51,9 @@ export default class UnmuteCommand extends BushCommand {
});
}
async exec(message: BushMessage | BushSlashMessage, { user, reason }: { user: BushUser; reason?: string }): Promise<unknown> {
- const error = this.client.util.emojis.error;
+ const error = util.emojis.error;
const member = message.guild.members.cache.get(user.id) as BushGuildMember;
- const canModerateResponse = this.client.util.moderationPermissionCheck(message.member, member, 'unmute');
+ const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'unmute');
const victimBoldTag = `**${member.user.tag}**`;
if (canModerateResponse !== true) {
@@ -83,9 +83,9 @@ export default class UnmuteCommand extends BushCommand {
case 'error removing mute entry':
return `${error} While muting ${victimBoldTag}, there was an error removing their mute entry, please report this to my developers.`;
case 'failed to dm':
- return `${this.client.util.emojis.warn} unmuted **${member.user.tag}** however I could not send them a dm.`;
+ return `${util.emojis.warn} unmuted **${member.user.tag}** however I could not send them a dm.`;
case 'success':
- return `${this.client.util.emojis.success} Successfully unmuted **${member.user.tag}**.`;
+ return `${util.emojis.success} Successfully unmuted **${member.user.tag}**.`;
}
};
return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts
index d5bf009..c5b4f43 100644
--- a/src/commands/moderation/warn.ts
+++ b/src/commands/moderation/warn.ts
@@ -61,7 +61,7 @@ export default class WarnCommand extends BushCommand {
): Promise<unknown> {
const member = message.guild.members.cache.get(user.id) as BushGuildMember;
const useForce = force && message.author.isOwner();
- const canModerateResponse = this.client.util.moderationPermissionCheck(message.member, member, 'warn', true, useForce);
+ const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'warn', true, useForce);
const victimBoldTag = `**${member.user.tag}**`;
if (canModerateResponse !== true) {
@@ -76,19 +76,17 @@ export default class WarnCommand extends BushCommand {
switch (response) {
case 'error creating modlog entry':
return message.util.reply(
- `${this.client.util.emojis.error} While warning ${victimBoldTag}, there was an error creating a modlog entry, please report this to my developers.`
+ `${util.emojis.error} While warning ${victimBoldTag}, there was an error creating a modlog entry, please report this to my developers.`
);
case 'failed to dm':
return message.util.reply(
- `${this.client.util.emojis.warn} **${member.user.tag}** has been warned for the ${this.client.util.ordinal(
+ `${util.emojis.warn} **${member.user.tag}** has been warned for the ${util.ordinal(
caseNum
)} time, however I could not send them a dm.`
);
case 'success':
return message.util.reply(
- `${this.client.util.emojis.success} Successfully warned **${member.user.tag}** for the ${this.client.util.ordinal(
- caseNum
- )} time.`
+ `${util.emojis.success} Successfully warned **${member.user.tag}** for the ${util.ordinal(caseNum)} time.`
);
}
}
diff --git a/src/commands/moulberry-bush/capePerms.ts b/src/commands/moulberry-bush/capePerms.ts
index 08b42ff..d613217 100644
--- a/src/commands/moulberry-bush/capePerms.ts
+++ b/src/commands/moulberry-bush/capePerms.ts
@@ -52,11 +52,9 @@ export default class CapePermissionsCommand extends BushCommand {
let capeperms: Capeperms, uuid: string;
try {
- uuid = await this.client.util.findUUID(args.ign);
+ uuid = await util.findUUID(args.ign);
} catch (e) {
- return await message.util.reply(
- `${this.client.util.emojis.error} \`${args.ign}\` doesn't appear to be a valid username.`
- );
+ return await message.util.reply(`${util.emojis.error} \`${args.ign}\` doesn't appear to be a valid username.`);
}
try {
@@ -65,9 +63,7 @@ export default class CapePermissionsCommand extends BushCommand {
capeperms = null;
}
if (capeperms == null) {
- return await message.util.reply(
- `${this.client.util.emojis.error} There was an error finding cape perms for \`${args.ign}\`.`
- );
+ return await message.util.reply(`${util.emojis.error} There was an error finding cape perms for \`${args.ign}\`.`);
} else {
if (capeperms?.perms) {
let index = null;
@@ -80,19 +76,15 @@ export default class CapePermissionsCommand extends BushCommand {
continue;
}
if (index == null)
- return await message.util.reply(
- `${this.client.util.emojis.error} \`${args.ign}\` does not appear to have any capes.`
- );
+ return await message.util.reply(`${util.emojis.error} \`${args.ign}\` does not appear to have any capes.`);
const userPerm: string[] = capeperms.perms[index].perms;
const embed = new MessageEmbed()
.setTitle(`${args.ign}'s Capes`)
.setDescription(userPerm.join('\n'))
- .setColor(this.client.util.colors.default);
+ .setColor(util.colors.default);
await message.util.reply({ embeds: [embed] });
} else {
- return await message.util.reply(
- `${this.client.util.emojis.error} There was an error finding cape perms for ${args.ign}.`
- );
+ return await message.util.reply(`${util.emojis.error} There was an error finding cape perms for ${args.ign}.`);
}
}
}
diff --git a/src/commands/moulberry-bush/giveawayPing.ts b/src/commands/moulberry-bush/giveawayPing.ts
index 93373b0..269c33f 100644
--- a/src/commands/moulberry-bush/giveawayPing.ts
+++ b/src/commands/moulberry-bush/giveawayPing.ts
@@ -25,7 +25,7 @@ export default class GiveawayPingCommand extends BushCommand {
public async exec(message: BushMessage): Promise<unknown> {
if (!message.member.permissions.has('MANAGE_GUILD'))
- await message.util.reply(`${this.client.util.emojis.error} You are missing the \`manage server\` permission.`);
+ await message.util.reply(`${util.emojis.error} You are missing the \`manage server\` permission.`);
await message.delete().catch(() => {});
diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts
index ebc8f1d..11ef269 100644
--- a/src/commands/moulberry-bush/report.ts
+++ b/src/commands/moulberry-bush/report.ts
@@ -59,17 +59,15 @@ export default class ReportCommand extends BushCommand {
public async exec(message: BushMessage, { member, evidence }: { member: GuildMember; evidence: string }): Promise<unknown> {
if (message.guild.id != this.client.consts.mappings.guilds.bush)
- return await message.util.reply(`${this.client.util.emojis.error} This command can only be run in Moulberry's bush.`);
- if (!member) return await message.util.reply(`${this.client.util.emojis.error} Choose someone to report`);
+ return await message.util.reply(`${util.emojis.error} This command can only be run in Moulberry's bush.`);
+ if (!member) return await message.util.reply(`${util.emojis.error} Choose someone to report`);
if (member.user.id === '322862723090219008')
return await message.util.reply({
content: `Thank you for your report! We take these allegations very seriously and have reported <@${member.user.id}> to the FBI!`,
allowedMentions: AllowedMentions.none()
});
if (member.user.bot)
- return await message.util.reply(
- `${this.client.util.emojis.error} You cannot report a bot <:WeirdChamp:756283321301860382>.`
- );
+ return await message.util.reply(`${util.emojis.error} You cannot report a bot <:WeirdChamp:756283321301860382>.`);
//// if (!evidence) evidence = 'No Evidence.';
//todo: Add channel id to db instead of hard coding it & allow in any guild
@@ -79,7 +77,7 @@ export default class ReportCommand extends BushCommand {
.setTimestamp()
.setAuthor(`Report From: ${message.author.tag}`, message.author.avatarURL({ dynamic: true }))
.setTitle('New Report')
- .setColor(this.client.util.colors.red)
+ .setColor(util.colors.red)
.setDescription(evidence)
.addField(
'Reporter',
@@ -110,8 +108,8 @@ export default class ReportCommand extends BushCommand {
const reportChannel = <TextChannel>this.client.channels.cache.get('782972723654688848');
await reportChannel.send({ embeds: [reportEmbed] }).then(async (ReportMessage) => {
try {
- await ReportMessage.react(this.client.util.emojis.success);
- await ReportMessage.react(this.client.util.emojis.error);
+ await ReportMessage.react(util.emojis.success);
+ await ReportMessage.react(util.emojis.error);
} catch {
this.client.console.warn('ReportCommand', 'Could not react to report message.');
}
diff --git a/src/commands/skyblock-reborn/chooseColorCommand.ts b/src/commands/skyblock-reborn/chooseColorCommand.ts
index ce70419..f80d2ae 100644
--- a/src/commands/skyblock-reborn/chooseColorCommand.ts
+++ b/src/commands/skyblock-reborn/chooseColorCommand.ts
@@ -121,7 +121,7 @@ export default class ChooseColorCommand extends BushCommand {
public async exec(message: BushMessage | BushSlashMessage, args: { color: Role | RoleResolvable }): Promise<unknown> {
if (message.guild.id != this.client.consts.mappings.guilds.sbr) {
- return await message.util.reply(`${this.client.util.emojis.error} This command can only be run in Skyblock: Reborn.`);
+ return await message.util.reply(`${util.emojis.error} This command can only be run in Skyblock: Reborn.`);
}
const allowedRoles: Snowflake[] = [
'839317526395879449', //Server Booster
@@ -135,13 +135,13 @@ export default class ChooseColorCommand extends BushCommand {
message.guild.ownerId === message.author.id
)
) {
- const allowed = this.client.util.oxford(
+ const allowed = util.oxford(
allowedRoles.map((id) => `<@&${id}>s`),
'and',
''
);
return await message.util.reply({
- content: `${this.client.util.emojis.error} Only ${allowed} can use this command.`,
+ content: `${util.emojis.error} Only ${allowed} can use this command.`,
allowedMentions: AllowedMentions.none(),
ephemeral: true
});
@@ -154,7 +154,7 @@ export default class ChooseColorCommand extends BushCommand {
const colorID = message.util.isSlash ? (args.color as string) : (args.color as Role).id;
if (!roleColorMap.map((obj) => obj.value).includes(colorID)) {
return await message.util.reply({
- content: `${this.client.util.emojis.error} ${args.color} is not a whitelisted color role.`,
+ content: `${util.emojis.error} ${args.color} is not a whitelisted color role.`,
allowedMentions: AllowedMentions.none()
});
}
@@ -172,7 +172,7 @@ export default class ChooseColorCommand extends BushCommand {
}
message.util.reply({
- content: `${this.client.util.emojis.success} Assigned you the <@&${colorID}> role.`,
+ content: `${util.emojis.success} Assigned you the <@&${colorID}> role.`,
allowedMentions: AllowedMentions.none()
});
}
diff --git a/src/commands/utilities/serverStatus.ts b/src/commands/utilities/serverStatus.ts
index a20f0b2..b9d6136 100644
--- a/src/commands/utilities/serverStatus.ts
+++ b/src/commands/utilities/serverStatus.ts
@@ -22,24 +22,24 @@ export default class ServerStatusCommand extends BushCommand {
public async exec(message: BushMessage): Promise<void> {
const msgEmbed: MessageEmbed = new MessageEmbed()
.setTitle('Server status')
- .setDescription(`Checking server:\n${this.client.util.emojis.loading}`)
- .setColor(this.client.util.colors.default)
+ .setDescription(`Checking server:\n${util.emojis.loading}`)
+ .setColor(util.colors.default)
.setFooter('Checking https://moulberry.codes/lowestbin.json');
await message.util.reply({ embeds: [msgEmbed] });
let main;
try {
await got.get('https://moulberry.codes/lowestbin.json').json();
- main = this.client.util.emojis.success;
+ main = util.emojis.success;
} catch (e) {
- main = this.client.util.emojis.error;
+ main = util.emojis.error;
}
await message.util.edit({ embeds: [msgEmbed.setDescription(`Checking server:\n${main}`)] });
- if (main == this.client.util.emojis.success) {
+ if (main == util.emojis.success) {
await message.util.edit({
embeds: [
msgEmbed
.addField('Status', 'The server is online, all features related to prices will likely work.')
- .setColor(this.client.util.colors.success)
+ .setColor(util.colors.success)
]
});
} else {
@@ -50,7 +50,7 @@ export default class ServerStatusCommand extends BushCommand {
'Status',
"It appears Moulberry's server is offline, this means that everything related to prices will likely not work."
)
- .setColor(this.client.util.colors.error)
+ .setColor(util.colors.error)
]
});
}
diff --git a/src/commands/utilities/uuid.ts b/src/commands/utilities/uuid.ts
index 0b96ce1..7ff80d2 100644
--- a/src/commands/utilities/uuid.ts
+++ b/src/commands/utilities/uuid.ts
@@ -31,13 +31,13 @@ export default class UuidCommand extends BushCommand {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public async exec(message: BushMessage, { ign }: { ign: { match: any[]; matches: any[] } }): Promise<unknown> {
- if (!ign) return await message.util.reply(`${this.client.util.emojis.error} Please enter a valid ign.`);
+ if (!ign) return await message.util.reply(`${util.emojis.error} Please enter a valid ign.`);
const readableIGN = ign.match[0];
try {
- const uuid = await this.client.util.findUUID(readableIGN);
+ const uuid = await util.findUUID(readableIGN);
return await message.util.reply(`The uuid for \`${readableIGN}\` is \`${uuid}\``);
} catch (e) {
- return await message.util.reply(`${this.client.util.emojis.error} Could not find an uuid for \`${readableIGN}\`.`);
+ return await message.util.reply(`${util.emojis.error} Could not find an uuid for \`${readableIGN}\`.`);
}
}
}
diff --git a/src/commands/utilities/viewraw.ts b/src/commands/utilities/viewraw.ts
index 3658bde..ca5b2de 100644
--- a/src/commands/utilities/viewraw.ts
+++ b/src/commands/utilities/viewraw.ts
@@ -56,7 +56,7 @@ export default class ViewRawCommand extends BushCommand {
});
if (!newMessage) {
return await message.util.reply(
- `${this.client.util.emojis.error} There was an error fetching that message, try supplying a channel.`
+ `${util.emojis.error} There was an error fetching that message, try supplying a channel.`
);
}
} else {
@@ -66,9 +66,9 @@ export default class ViewRawCommand extends BushCommand {
const messageEmbed = new MessageEmbed()
.setFooter(newMessage.author.tag, newMessage.author.avatarURL({ dynamic: true }))
.setTimestamp(newMessage.createdTimestamp)
- .setColor(newMessage.member?.roles?.color?.color || this.client.util.colors.default)
+ .setColor(newMessage.member?.roles?.color?.color || util.colors.default)
.setTitle('Raw Message Information')
- .setDescription(await this.client.util.codeblock(content, 2048, 'js'));
+ .setDescription(await util.codeblock(content, 2048, 'js'));
return await message.util.reply({ embeds: [messageEmbed] });
}
diff --git a/src/commands/utilities/whoHasRole.ts b/src/commands/utilities/whoHasRole.ts
index 1828c95..42e8fd5 100644
--- a/src/commands/utilities/whoHasRole.ts
+++ b/src/commands/utilities/whoHasRole.ts
@@ -39,15 +39,15 @@ export default class WhoHasRoleCommand extends BushCommand {
public async exec(message: BushMessage | BushSlashMessage, args: { role: Role }): Promise<unknown> {
const roleMembers = args.role.members.map((member) => `${member.user} (${Util.escapeMarkdown(member.user.tag)})`);
- const chunkedRoleMembers = this.client.util.chunk(roleMembers, 30);
+ const chunkedRoleMembers = util.chunk(roleMembers, 30);
const embedPages = chunkedRoleMembers.map(
(chunk) =>
new MessageEmbed({
title: `${args.role.name}'s Members`,
description: chunk.join('\n'),
- color: this.client.util.colors.default
+ color: util.colors.default
})
);
- return await this.client.util.buttonPaginate(message, embedPages, null, true);
+ return await util.buttonPaginate(message, embedPages, null, true);
}
}
diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts
index 79f7c98..0e4891e 100644
--- a/src/lib/extensions/discord.js/BushGuild.ts
+++ b/src/lib/extensions/discord.js/BushGuild.ts
@@ -55,7 +55,7 @@ export class BushGuild extends Guild {
if (!unbanSuccess) return 'error unbanning';
// add modlog entry
- const modlog = await this.client.util
+ const modlog = await util
.createModLogEntry({
type: ModLogType.UNBAN,
user,
@@ -67,7 +67,7 @@ export class BushGuild extends Guild {
if (!modlog) return 'error creating modlog entry';
// remove punishment entry
- const removePunishmentEntrySuccess = await this.client.util
+ const removePunishmentEntrySuccess = await util
.removePunishmentEntry({
type: 'ban',
user,
diff --git a/src/lib/extensions/discord.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts
index 50875cc..c04c8f0 100644
--- a/src/lib/extensions/discord.js/BushGuildMember.ts
+++ b/src/lib/extensions/discord.js/BushGuildMember.ts
@@ -82,7 +82,7 @@ export class BushGuildMember extends GuildMember {
public async warn(options: BushPunishmentOptions): Promise<{ result: WarnResponse; caseNum: number }> {
const moderator = this.client.users.cache.get(this.client.users.resolveId(options.moderator || this.client.user));
// add modlog entry
- const result = await this.client.util
+ const result = await util
.createModLogEntry(
{
type: ModLogType.WARN,
@@ -119,7 +119,7 @@ export class BushGuildMember extends GuildMember {
const moderator = this.client.users.cache.get(this.client.users.resolveId(options.moderator || this.client.user));
if (options.addToModlog) {
- const { log: modlog } = await this.client.util
+ const { log: modlog } = await util
.createModLogEntry({
type: options.duration ? ModLogType.TEMP_PUNISHMENT_ROLE : ModLogType.PERM_PUNISHMENT_ROLE,
guild: this.guild,
@@ -130,7 +130,7 @@ export class BushGuildMember extends GuildMember {
.catch(() => null);
if (!modlog) return 'error creating modlog entry';
- const punishmentEntrySuccess = await this.client.util
+ const punishmentEntrySuccess = await util
.createPunishmentEntry({
type: 'role',
user: this,
@@ -156,7 +156,7 @@ export class BushGuildMember extends GuildMember {
const moderator = this.client.users.cache.get(this.client.users.resolveId(options.moderator || this.client.user));
if (options.addToModlog) {
- const { log: modlog } = await this.client.util
+ const { log: modlog } = await util
.createModLogEntry({
type: ModLogType.PERM_PUNISHMENT_ROLE,
guild: this.guild,
@@ -167,7 +167,7 @@ export class BushGuildMember extends GuildMember {
.catch(() => null);
if (!modlog) return 'error creating modlog entry';
- const punishmentEntrySuccess = await this.client.util
+ const punishmentEntrySuccess = await util
.removePunishmentEntry({
type: 'role',
user: this,
@@ -212,7 +212,7 @@ export class BushGuildMember extends GuildMember {
if (!muteSuccess) return 'error giving mute role';
// add modlog entry
- const { log: modlog } = await this.client.util
+ const { log: modlog } = await util
.createModLogEntry({
type: options.duration ? ModLogType.TEMP_MUTE : ModLogType.PERM_MUTE,
user: this,
@@ -225,7 +225,7 @@ export class BushGuildMember extends GuildMember {
if (!modlog) return 'error creating modlog entry';
// add punishment entry so they can be unmuted later
- const punishmentEntrySuccess = await this.client.util
+ const punishmentEntrySuccess = await util
.createPunishmentEntry({
type: 'mute',
user: this,
@@ -240,7 +240,7 @@ export class BushGuildMember extends GuildMember {
const ending = await this.guild.getSetting('punishmentEnding');
const dmSuccess = await this.send({
content: `You have been muted ${
- options.duration ? 'for ' + this.client.util.humanizeDuration(options.duration) : 'permanently'
+ options.duration ? 'for ' + util.humanizeDuration(options.duration) : 'permanently'
} in **${this.guild}** for **${options.reason || 'No reason provided'}**.${ending ? `\n\n${ending}` : ''}`
}).catch(() => null);
@@ -267,7 +267,7 @@ export class BushGuildMember extends GuildMember {
if (!muteSuccess) return 'error removing mute role';
//remove modlog entry
- const { log: modlog } = await this.client.util
+ const { log: modlog } = await util
.createModLogEntry({
type: ModLogType.UNMUTE,
user: this,
@@ -279,7 +279,7 @@ export class BushGuildMember extends GuildMember {
if (!modlog) return 'error creating modlog entry';
// remove mute entry
- const removePunishmentEntrySuccess = await this.client.util
+ const removePunishmentEntrySuccess = await util
.removePunishmentEntry({
type: 'mute',
user: this,
@@ -317,7 +317,7 @@ export class BushGuildMember extends GuildMember {
if (!kickSuccess) return 'error kicking';
// add modlog entry
- const { log: modlog } = await this.client.util
+ const { log: modlog } = await util
.createModLogEntry({
type: ModLogType.KICK,
user: this,
@@ -341,7 +341,7 @@ export class BushGuildMember extends GuildMember {
const ending = await this.guild.getSetting('punishmentEnding');
const dmSuccess = await this.send({
content: `You have been banned ${
- options.duration ? 'for ' + this.client.util.humanizeDuration(options.duration) : 'permanently'
+ options.duration ? 'for ' + util.humanizeDuration(options.duration) : 'permanently'
} from **${this.guild}** for **${options.reason || 'No reason provided'}**.${ending ? `\n\n${ending}` : ''}`
}).catch(() => null);
@@ -353,7 +353,7 @@ export class BushGuildMember extends GuildMember {
if (!banSuccess) return 'error banning';
// add modlog entry
- const { log: modlog } = await this.client.util
+ const { log: modlog } = await util
.createModLogEntry({
type: options.duration ? ModLogType.TEMP_BAN : ModLogType.PERM_BAN,
user: this,
@@ -366,7 +366,7 @@ export class BushGuildMember extends GuildMember {
if (!modlog) return 'error creating modlog entry';
// add punishment entry so they can be unbanned later
- const punishmentEntrySuccess = await this.client.util
+ const punishmentEntrySuccess = await util
.createPunishmentEntry({
type: 'ban',
user: this,
diff --git a/src/lib/utils/BushLogger.ts b/src/lib/utils/BushLogger.ts
index 98c3c04..3069dc8 100644
--- a/src/lib/utils/BushLogger.ts
+++ b/src/lib/utils/BushLogger.ts
@@ -70,13 +70,13 @@ export class BushLogger {
/** Sends a message to the log channel */
public async channelLog(message: BushSendMessageType): Promise<void> {
- const channel = await this.client.util.getConfigChannel('log');
+ const channel = await util.getConfigChannel('log');
await channel.send(message).catch(() => {});
}
/** Sends a message to the error channel */
public async channelError(message: BushSendMessageType): Promise<void> {
- const channel = await this.client.util.getConfigChannel('error');
+ const channel = await util.getConfigChannel('error');
await channel.send(message).catch(() => {});
}
@@ -116,7 +116,7 @@ export class BushLogger {
if (!sendChannel) return;
const embed = new MessageEmbed()
.setDescription(`**[${header}]** ${this.parseFormatting(this.stripColor(newContent), '', true)}`)
- .setColor(this.client.util.colors.gray)
+ .setColor(util.colors.gray)
.setTimestamp();
await this.channelLog({ embeds: [embed] });
}
@@ -137,7 +137,7 @@ export class BushLogger {
if (!sendChannel) return;
const embed = new MessageEmbed()
.setDescription(`**[${header}]** ${this.parseFormatting(this.stripColor(newContent), '', true)}`)
- .setColor(this.client.util.colors.info)
+ .setColor(util.colors.info)
.setTimestamp();
await this.channelLog({ embeds: [embed] });
}
@@ -159,7 +159,7 @@ export class BushLogger {
if (!sendChannel) return;
const embed = new MessageEmbed()
.setDescription(`**[${header}]** ${this.parseFormatting(this.stripColor(newContent), '', true)}`)
- .setColor(this.client.util.colors.warn)
+ .setColor(util.colors.warn)
.setTimestamp();
await this.channelLog({ embeds: [embed] });
}
@@ -180,7 +180,7 @@ export class BushLogger {
if (!sendChannel) return;
const embed = new MessageEmbed()
.setDescription(`**[${header}]** ${this.parseFormatting(this.stripColor(newContent), '', true)}`)
- .setColor(this.client.util.colors.error)
+ .setColor(util.colors.error)
.setTimestamp();
await this.channelError({ embeds: [embed] });
}
@@ -201,7 +201,7 @@ export class BushLogger {
if (!sendChannel) return;
const embed = new MessageEmbed()
.setDescription(`**[${header}]** ${this.parseFormatting(this.stripColor(newContent), '', true)}`)
- .setColor(this.client.util.colors.success)
+ .setColor(util.colors.success)
.setTimestamp();
await this.channelLog({ embeds: [embed] }).catch(() => {});
}
diff --git a/src/lib/utils/Config.ts b/src/lib/utils/Config.ts
index 65f43cb..663fe95 100644
--- a/src/lib/utils/Config.ts
+++ b/src/lib/utils/Config.ts
@@ -8,7 +8,7 @@ export interface ConfigOptions {
channels: { log: Snowflake; error: Snowflake; dm: Snowflake };
db: { host: string; port: number; username: string; password: string };
logging: { db: boolean; verbose: boolean; info: boolean };
- supportGuild: {id: Snowflake, invite: string}
+ supportGuild: { id: Snowflake; invite: string };
}
export class Config {
@@ -19,7 +19,7 @@ export class Config {
public channels: { log: Snowflake; error: Snowflake; dm: Snowflake };
public db: { host: string; port: number; username: string; password: string };
public logging: { db: boolean; verbose: boolean; info: boolean };
- public supportGuild: {id: Snowflake, invite: string}
+ public supportGuild: { id: Snowflake; invite: string };
public constructor(options: ConfigOptions) {
this.credentials = options.credentials;
@@ -29,7 +29,7 @@ export class Config {
this.channels = options.channels;
this.db = options.db;
this.logging = options.logging;
- this.supportGuild = options.supportGuild
+ this.supportGuild = options.supportGuild;
}
public get token(): string {
diff --git a/src/listeners/client/interactionCreate.ts b/src/listeners/client/interactionCreate.ts
index 0503f2e..77912d6 100644
--- a/src/listeners/client/interactionCreate.ts
+++ b/src/listeners/client/interactionCreate.ts
@@ -27,7 +27,7 @@ export default class InteractionCreateListener extends BushListener {
return await interaction.reply({
content: `You selected ${
Array.isArray(interaction.values)
- ? this.client.util.oxford(this.client.util.surroundArray(interaction.values, '`'), 'and', '')
+ ? util.oxford(util.surroundArray(interaction.values, '`'), 'and', '')
: `\`${interaction.values}\``
}.`,
ephemeral: true
diff --git a/src/listeners/commands/commandBlocked.ts b/src/listeners/commands/commandBlocked.ts
index e75610b..e495f52 100644
--- a/src/listeners/commands/commandBlocked.ts
+++ b/src/listeners/commands/commandBlocked.ts
@@ -19,22 +19,22 @@ export default class CommandBlockedListener extends BushListener {
switch (reason) {
case reasons.OWNER: {
return await message.util.reply({
- content: `${this.client.util.emojis.error} Only my developers can run the \`${message.util.parsed.command}\` command.`
+ content: `${util.emojis.error} Only my developers can run the \`${message.util.parsed.command}\` command.`
});
}
case reasons.SUPER_USER: {
return await message.util.reply({
- content: `${this.client.util.emojis.error} You must be a superuser to run the \`${message.util.parsed.command}\` command.`
+ content: `${util.emojis.error} You must be a superuser to run the \`${message.util.parsed.command}\` command.`
});
}
case reasons.DISABLED_GLOBAL: {
return await message.util.reply({
- content: `${this.client.util.emojis.error} My developers disabled the \`${message.util.parsed.command}\` command.`
+ content: `${util.emojis.error} My developers disabled the \`${message.util.parsed.command}\` command.`
});
}
case reasons.DISABLED_GUILD: {
return await message.util.reply({
- content: `${this.client.util.emojis.error} The \`${command.aliases[0]}\` command is currently disabled in \`${message.guild.name}\`.`
+ content: `${util.emojis.error} The \`${command.aliases[0]}\` command is currently disabled in \`${message.guild.name}\`.`
});
}
case reasons.CHANNEL_GLOBAL_BLACKLIST:
@@ -50,9 +50,9 @@ export default class CommandBlockedListener extends BushListener {
channels.forEach((c) => {
names.push(`<#${c}>`);
});
- const pretty = this.client.util.oxford(names, 'and', undefined);
+ const pretty = util.oxford(names, 'and', undefined);
return await message.util.reply({
- content: `${this.client.util.emojis.error} \`${command}\` can only be run in ${pretty}.`
+ content: `${util.emojis.error} \`${command}\` can only be run in ${pretty}.`
});
}
case reasons.RESTRICTED_GUILD: {
@@ -61,14 +61,14 @@ export default class CommandBlockedListener extends BushListener {
guilds.forEach((g) => {
names.push(`\`${this.client.guilds.cache.get(g).name}\``);
});
- const pretty = this.client.util.oxford(names, 'and', undefined);
+ const pretty = util.oxford(names, 'and', undefined);
return await message.util.reply({
- content: `${this.client.util.emojis.error} \`${command}\` can only be run in ${pretty}.`
+ content: `${util.emojis.error} \`${command}\` can only be run in ${pretty}.`
});
}
default: {
return await message.util.reply({
- content: `${this.client.util.emojis.error} Command blocked with reason \`${reason}\``
+ content: `${util.emojis.error} Command blocked with reason \`${reason}\``
});
}
}
diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts
index 6de764c..c34f52a 100644
--- a/src/listeners/commands/commandError.ts
+++ b/src/listeners/commands/commandError.ts
@@ -20,8 +20,8 @@ export default class CommandErrorListener extends BushListener {
**Channel:** ${message.channel} (${message.channel?.id})
**Message:** [link](${message.url})`
)
- .addField('Error', await this.client.util.codeblock(`${error?.stack || error}`, 1024, 'js'))
- .setColor(this.client.util.colors.error)
+ .addField('Error', await util.codeblock(`${error?.stack || error}`, 1024, 'js'))
+ .setColor(util.colors.error)
.setTimestamp();
await this.client.logger.channelError({ embeds: [errorEmbed] });
@@ -29,7 +29,7 @@ export default class CommandErrorListener extends BushListener {
if (!this.client.config.owners.includes(message.author.id)) {
const errorUserEmbed: MessageEmbed = new MessageEmbed()
.setTitle('A Command Error Occurred')
- .setColor(this.client.util.colors.error)
+ .setColor(util.colors.error)
.setTimestamp();
if (!command)
errorUserEmbed.setDescription(`Oh no! An error occurred. Please give the developers code \`${errorNo}\`.`);
@@ -44,9 +44,9 @@ export default class CommandErrorListener extends BushListener {
} else {
const errorDevEmbed = new MessageEmbed()
.setTitle('A Command Error Occurred')
- .setColor(this.client.util.colors.error)
+ .setColor(util.colors.error)
.setTimestamp()
- .setDescription(await this.client.util.codeblock(`${error?.stack || error}`, 2048, 'js'));
+ .setDescription(await util.codeblock(`${error?.stack || error}`, 2048, 'js'));
(await message.util?.send({ embeds: [errorDevEmbed] }).catch((e) => {
const channel = message.channel.type === 'DM' ? message.channel.recipient.tag : message.channel.name;
this.client.console.warn('CommandError', `Failed to send owner error stack in <<${channel}>>.` + e?.stack || e);
diff --git a/src/listeners/commands/commandMissingPermissions.ts b/src/listeners/commands/commandMissingPermissions.ts
index e06f8f8..1df54ab 100644
--- a/src/listeners/commands/commandMissingPermissions.ts
+++ b/src/listeners/commands/commandMissingPermissions.ts
@@ -19,8 +19,8 @@ export default class CommandMissingPermissionsListener extends BushListener {
}
});
- const discordFormat = this.client.util.oxford(this.client.util.surroundArray(niceMissing, '**'), 'and', '');
- const consoleFormat = this.client.util.oxford(this.client.util.surroundArray(niceMissing, '<<', '>>'), 'and', '');
+ const discordFormat = util.oxford(util.surroundArray(niceMissing, '**'), 'and', '');
+ const consoleFormat = util.oxford(util.surroundArray(niceMissing, '<<', '>>'), 'and', '');
this.client.console.info(
'CommandMissingPermissions',
`<<${message.author.tag}>> tried to run <<${
@@ -30,15 +30,15 @@ export default class CommandMissingPermissionsListener extends BushListener {
if (type == 'client') {
await message.util
.reply(
- `${this.client.util.emojis.error} I am missing the ${discordFormat} permission${
- missing.length ? 's' : ''
- } required for the \`${command?.id}\` command.`
+ `${util.emojis.error} I am missing the ${discordFormat} permission${missing.length ? 's' : ''} required for the \`${
+ command?.id
+ }\` command.`
)
.catch(() => {});
} else if (type == 'user') {
await message.util
.reply(
- `${this.client.util.emojis.error} You are missing the ${discordFormat} permission${
+ `${util.emojis.error} You are missing the ${discordFormat} permission${
missing.length ? 's' : ''
} required for the **${command?.id}** command.`
)
diff --git a/src/listeners/commands/slashBlocked.ts b/src/listeners/commands/slashBlocked.ts
index e59235e..7c26fb5 100644
--- a/src/listeners/commands/slashBlocked.ts
+++ b/src/listeners/commands/slashBlocked.ts
@@ -21,22 +21,22 @@ export default class SlashBlockedListener extends BushListener {
switch (reason) {
case reasons.OWNER: {
return await message.util.reply({
- content: `${this.client.util.emojis.error} Only my developers can run the \`${message.util.parsed.command}\` command.`
+ content: `${util.emojis.error} Only my developers can run the \`${message.util.parsed.command}\` command.`
});
}
case reasons.SUPER_USER: {
return await message.util.reply({
- content: `${this.client.util.emojis.error} You must be a superuser to run the \`${message.util.parsed.command}\` command.`
+ content: `${util.emojis.error} You must be a superuser to run the \`${message.util.parsed.command}\` command.`
});
}
case reasons.DISABLED_GLOBAL: {
return await message.util.reply({
- content: `${this.client.util.emojis.error} My developers disabled the \`${message.util.parsed.command}\` command.`
+ content: `${util.emojis.error} My developers disabled the \`${message.util.parsed.command}\` command.`
});
}
case reasons.DISABLED_GUILD: {
return await message.util.reply({
- content: `${this.client.util.emojis.error} The \`${command.aliases[0]}\` command is currently disabled in \`${message.guild.name}\`.`
+ content: `${util.emojis.error} The \`${command.aliases[0]}\` command is currently disabled in \`${message.guild.name}\`.`
});
}
case reasons.CHANNEL_GLOBAL_BLACKLIST:
@@ -52,9 +52,9 @@ export default class SlashBlockedListener extends BushListener {
channels.forEach((c) => {
names.push(`<#${c}>`);
});
- const pretty = this.client.util.oxford(names, 'and', undefined);
+ const pretty = util.oxford(names, 'and', undefined);
return await message.util.reply({
- content: `${this.client.util.emojis.error} \`${command}\` can only be run in ${pretty}.`
+ content: `${util.emojis.error} \`${command}\` can only be run in ${pretty}.`
});
}
case reasons.RESTRICTED_GUILD: {
@@ -63,14 +63,14 @@ export default class SlashBlockedListener extends BushListener {
guilds.forEach((g) => {
names.push(`\`${this.client.guilds.cache.get(g).name}\``);
});
- const pretty = this.client.util.oxford(names, 'and', undefined);
+ const pretty = util.oxford(names, 'and', undefined);
return await message.util.reply({
- content: `${this.client.util.emojis.error} \`${command}\` can only be run in ${pretty}.`
+ content: `${util.emojis.error} \`${command}\` can only be run in ${pretty}.`
});
}
default: {
return await message.util.reply({
- content: `${this.client.util.emojis.error} Command blocked with reason \`${reason}\``
+ content: `${util.emojis.error} Command blocked with reason \`${reason}\``
});
}
}
diff --git a/src/listeners/commands/slashCommandError.ts b/src/listeners/commands/slashCommandError.ts
index 03ba899..c66076d 100644
--- a/src/listeners/commands/slashCommandError.ts
+++ b/src/listeners/commands/slashCommandError.ts
@@ -20,8 +20,8 @@ export default class SlashCommandErrorListener extends BushListener {
**Channel:** ${message.channel || message.interaction.user?.tag} ${message.channel ? `(${message.channel?.id})` : ''}
**Message:** [link](https://discord.com/${message.guild?.id}/${message.channel?.id}/${message.id})`
)
- .addField('Error', await this.client.util.codeblock(`${error?.stack || error}`, 1024, 'js'))
- .setColor(this.client.util.colors.error)
+ .addField('Error', await util.codeblock(`${error?.stack || error}`, 1024, 'js'))
+ .setColor(util.colors.error)
.setTimestamp();
await this.client.logger.channelError({ embeds: [errorEmbed] });
@@ -30,7 +30,7 @@ export default class SlashCommandErrorListener extends BushListener {
if (!this.client.config.owners.includes(message.author.id)) {
const errorUserEmbed: MessageEmbed = new MessageEmbed()
.setTitle('A Slash Command Error Occurred')
- .setColor(this.client.util.colors.error)
+ .setColor(util.colors.error)
.setTimestamp();
if (!command)
errorUserEmbed.setDescription(`Oh no! An error occurred. Please give the developers code \`${errorNo}\`.`);
@@ -44,9 +44,9 @@ export default class SlashCommandErrorListener extends BushListener {
} else {
const errorDevEmbed = new MessageEmbed()
.setTitle('A Slash Command Error Occurred')
- .setColor(this.client.util.colors.error)
+ .setColor(util.colors.error)
.setTimestamp()
- .setDescription(await this.client.util.codeblock(`${error?.stack || error}`, 2048, 'js'));
+ .setDescription(await util.codeblock(`${error?.stack || error}`, 2048, 'js'));
(await message.util?.send({ embeds: [errorDevEmbed] }).catch((e) => {
this.client.console.warn('SlashError', `Failed to send owner error stack in <<${channel}>>.` + e?.stack || e);
})) ?? this.client.console.error('SlashError', `Failed to send user error embed.` + error?.stack || error, false);
diff --git a/src/listeners/commands/slashMissingPermissions.ts b/src/listeners/commands/slashMissingPermissions.ts
index a41dd8f..34786e1 100644
--- a/src/listeners/commands/slashMissingPermissions.ts
+++ b/src/listeners/commands/slashMissingPermissions.ts
@@ -19,8 +19,8 @@ export default class SlashMissingPermissionsListener extends BushListener {
}
});
- const discordFormat = this.client.util.oxford(this.client.util.surroundArray(niceMissing, '`'), 'and', '');
- const consoleFormat = this.client.util.oxford(this.client.util.surroundArray(niceMissing, '<<', '>>'), 'and', '');
+ const discordFormat = util.oxford(util.surroundArray(niceMissing, '`'), 'and', '');
+ const consoleFormat = util.oxford(util.surroundArray(niceMissing, '<<', '>>'), 'and', '');
this.client.console.info(
'CommandMissingPermissions',
`<<${message.author.tag}>> tried to run <<${
@@ -31,15 +31,15 @@ export default class SlashMissingPermissionsListener extends BushListener {
if (type == 'client') {
await message.util
.reply(
- `${this.client.util.emojis.error} I am missing the ${discordFormat} permission${
- missing.length ? 's' : ''
- } required for the \`${command?.id}\` command.`
+ `${util.emojis.error} I am missing the ${discordFormat} permission${missing.length ? 's' : ''} required for the \`${
+ command?.id
+ }\` command.`
)
.catch(() => {});
} else if (type == 'user') {
await message.util
.reply(
- `${this.client.util.emojis.error} You are missing the ${discordFormat} permission${
+ `${util.emojis.error} You are missing the ${discordFormat} permission${
missing.length ? 's' : ''
} required for the \`${command?.id}\` command.`
)
diff --git a/src/listeners/message/automodCreate.ts b/src/listeners/message/automodCreate.ts
index 9b7d0ec..b8057c5 100644
--- a/src/listeners/message/automodCreate.ts
+++ b/src/listeners/message/automodCreate.ts
@@ -11,6 +11,6 @@ export default class AutomodMessageCreateListener extends BushListener {
}
async exec(...[message]: ClientEvents['messageCreate']): Promise<void> {
- return await this.client.util.automod(message as BushMessage);
+ return await util.automod(message as BushMessage);
}
}
diff --git a/src/listeners/message/automodUpdate.ts b/src/listeners/message/automodUpdate.ts
index 37e00bf..9d17ef0 100644
--- a/src/listeners/message/automodUpdate.ts
+++ b/src/listeners/message/automodUpdate.ts
@@ -12,6 +12,6 @@ export default class AutomodMessageUpdateListener extends BushListener {
async exec(...[message]: ClientEvents['messageUpdate']): Promise<void> {
const fullMessage = message.partial ? await message.fetch() : (message as Message);
- return await this.client.util.automod(fullMessage as BushMessage);
+ return await util.automod(fullMessage as BushMessage);
}
}
diff --git a/src/listeners/other/promiseRejection.ts b/src/listeners/other/promiseRejection.ts
index 460d849..da6480c 100644
--- a/src/listeners/other/promiseRejection.ts
+++ b/src/listeners/other/promiseRejection.ts
@@ -14,8 +14,8 @@ export default class PromiseRejectionListener extends BushListener {
embeds: [
{
title: 'Unhandled promise rejection',
- fields: [{ name: 'error', value: await this.client.util.codeblock(`${error?.stack || error}`, 1024, 'js') }],
- color: this.client.util.colors.error
+ fields: [{ name: 'error', value: await util.codeblock(`${error?.stack || error}`, 1024, 'js') }],
+ color: util.colors.error
}
]
});
diff --git a/src/listeners/other/uncaughtException.ts b/src/listeners/other/uncaughtException.ts
index 91d0a56..1bb57c1 100644
--- a/src/listeners/other/uncaughtException.ts
+++ b/src/listeners/other/uncaughtException.ts
@@ -14,8 +14,8 @@ export default class UncaughtExceptionListener extends BushListener {
embeds: [
{
title: 'An uncaught exception occurred',
- fields: [{ name: 'error', value: await this.client.util.codeblock(`${error?.stack || error}`, 1024, 'js') }],
- color: this.client.util.colors.error
+ fields: [{ name: 'error', value: await util.codeblock(`${error?.stack || error}`, 1024, 'js') }],
+ color: util.colors.error
}
]
});