aboutsummaryrefslogtreecommitdiff
path: root/src/commands/dev
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/dev')
-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
10 files changed, 36 insertions, 40 deletions
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.`
);