aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-26 18:45:31 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-26 18:45:31 -0400
commitcca0b7a03bcd61af12b7f9bff51276f6c70beeb3 (patch)
tree2b2adebc166ac033520e5b582773e63fbdc5ddb9
parent13ba1ad552047eb9386e91d542a975c4bef58b08 (diff)
downloadtanzanite-cca0b7a03bcd61af12b7f9bff51276f6c70beeb3.tar.gz
tanzanite-cca0b7a03bcd61af12b7f9bff51276f6c70beeb3.tar.bz2
tanzanite-cca0b7a03bcd61af12b7f9bff51276f6c70beeb3.zip
refactor: this.client.util -> util
-rw-r--r--.github/workflows/codeql-analysis.yml58
-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
62 files changed, 307 insertions, 333 deletions
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 2cabd9d..95aac9e 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -9,14 +9,14 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
-name: "CodeQL"
+name: 'CodeQL'
on:
push:
- branches: [ master ]
+ branches: [master]
pull_request:
# The branches below must be a subset of the branches above
- branches: [ master ]
+ branches: [master]
schedule:
- cron: '17 17 * * 5'
@@ -32,40 +32,40 @@ jobs:
strategy:
fail-fast: false
matrix:
- language: [ 'javascript' ]
+ language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- - name: Checkout repository
- uses: actions/checkout@v2
+ - name: Checkout repository
+ uses: actions/checkout@v2
- # Initializes the CodeQL tools for scanning.
- - name: Initialize CodeQL
- uses: github/codeql-action/init@v1
- with:
- languages: ${{ matrix.language }}
- # If you wish to specify custom queries, you can do so here or in a config file.
- # By default, queries listed here will override any specified in a config file.
- # Prefix the list here with "+" to use these queries and those in the config file.
- # queries: ./path/to/local/query, your-org/your-repo/queries@main
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v1
+ with:
+ languages: ${{ matrix.language }}
+ # If you wish to specify custom queries, you can do so here or in a config file.
+ # By default, queries listed here will override any specified in a config file.
+ # Prefix the list here with "+" to use these queries and those in the config file.
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
- # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
- # If this step fails, then you should remove it and run the build manually (see below)
- - name: Autobuild
- uses: github/codeql-action/autobuild@v1
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
+ # If this step fails, then you should remove it and run the build manually (see below)
+ - name: Autobuild
+ uses: github/codeql-action/autobuild@v1
- # ℹ️ Command-line programs to run using the OS shell.
- # 📚 https://git.io/JvXDl
+ # ℹ️ Command-line programs to run using the OS shell.
+ # 📚 https://git.io/JvXDl
- # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
- # and modify them (or add more) to build your code if your project
- # uses a compiled language
+ # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
+ # and modify them (or add more) to build your code if your project
+ # uses a compiled language
- #- run: |
- # make bootstrap
- # make release
+ #- run: |
+ # make bootstrap
+ # make release
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v1
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v1
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 {