aboutsummaryrefslogtreecommitdiff
path: root/src/commands/dev
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/dev')
-rw-r--r--src/commands/dev/__template.ts14
-rw-r--r--src/commands/dev/debug.ts6
-rw-r--r--src/commands/dev/dm.ts8
-rw-r--r--src/commands/dev/eval.ts24
-rw-r--r--src/commands/dev/javascript.ts27
-rw-r--r--src/commands/dev/reload.ts22
-rw-r--r--src/commands/dev/say.ts17
-rw-r--r--src/commands/dev/servers.ts19
-rw-r--r--src/commands/dev/sh.ts42
-rw-r--r--src/commands/dev/superUser.ts30
-rw-r--r--src/commands/dev/syncAutomod.ts8
-rw-r--r--src/commands/dev/test.ts29
12 files changed, 154 insertions, 92 deletions
diff --git a/src/commands/dev/__template.ts b/src/commands/dev/__template.ts
index 7bcce32..df4d146 100644
--- a/src/commands/dev/__template.ts
+++ b/src/commands/dev/__template.ts
@@ -1,4 +1,12 @@
-import { BushCommand, type ArgType, type CommandMessage, type OptArgType, type SlashMessage } from '#lib';
+import {
+ BushCommand,
+ clientSendAndPermCheck,
+ emojis,
+ type ArgType,
+ type CommandMessage,
+ type OptArgType,
+ type SlashMessage
+} from '#lib';
import { ApplicationCommandOptionType } from 'discord.js';
export default class TemplateCommand extends BushCommand {
@@ -33,7 +41,7 @@ export default class TemplateCommand extends BushCommand {
ownerOnly: true,
channel: 'guild',
hidden: true,
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ clientPermissions: (m) => clientSendAndPermCheck(m),
userPermissions: []
});
}
@@ -42,7 +50,7 @@ export default class TemplateCommand extends BushCommand {
message: CommandMessage | SlashMessage,
args: { required_argument: ArgType<'string'>; optional_argument: OptArgType<'string'> }
) {
- return await message.util.reply(`${util.emojis.error} Do not use the template command.`);
+ return await message.util.reply(`${emojis.error} Do not use the template command.`);
args;
}
}
diff --git a/src/commands/dev/debug.ts b/src/commands/dev/debug.ts
index 682a93d..dd9109c 100644
--- a/src/commands/dev/debug.ts
+++ b/src/commands/dev/debug.ts
@@ -1,4 +1,4 @@
-// import { BushCommand, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
+// import { BushCommand, clientSendAndPermCheck, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
// import { ApplicationCommandOptionType, AutocompleteInteraction, ChatInputCommandInteraction } from 'discord.js';
// import Fuse from 'fuse.js';
@@ -24,7 +24,7 @@
// slash: true,
// slashGuilds: ['516977525906341928'],
// superUserOnly: true,
-// clientPermissions: (m) => util.clientSendAndPermCheck(m),
+// clientPermissions: (m) => clientSendAndPermCheck(m),
// userPermissions: []
// });
// }
@@ -52,7 +52,7 @@
// embeds: [{ description: 'And an embed' }]
// });
// } else {
-// return await message.util.reply(`${util.emojis.error} Invalid action.`);
+// return await message.util.reply(`${emojis.error} Invalid action.`);
// }
// }
diff --git a/src/commands/dev/dm.ts b/src/commands/dev/dm.ts
index 468fb20..f1e2bce 100644
--- a/src/commands/dev/dm.ts
+++ b/src/commands/dev/dm.ts
@@ -1,4 +1,4 @@
-import { BushCommand, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
+import { BushCommand, clientSendAndPermCheck, emojis, format, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
import { ApplicationCommandOptionType } from 'discord.js';
export default class DMCommand extends BushCommand {
@@ -31,7 +31,7 @@ export default class DMCommand extends BushCommand {
slash: false,
ownerOnly: true,
hidden: true,
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ clientPermissions: (m) => clientSendAndPermCheck(m),
userPermissions: []
});
}
@@ -43,8 +43,8 @@ export default class DMCommand extends BushCommand {
try {
await client.users.send(args.user.id, args.content);
} catch (e) {
- return message.util.reply(`${util.emojis.error} There was an error sending ${util.format.input(args.user.tag)} a dm.`);
+ return message.util.reply(`${emojis.error} There was an error sending ${format.input(args.user.tag)} a dm.`);
}
- return message.util.reply(`${util.emojis.success} Successfully sent ${util.format.input(args.user.tag)} a dm.`);
+ return message.util.reply(`${emojis.success} Successfully sent ${format.input(args.user.tag)} a dm.`);
}
}
diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts
index b8ee9e4..239a06a 100644
--- a/src/commands/dev/eval.ts
+++ b/src/commands/dev/eval.ts
@@ -1,11 +1,17 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import {
ActivePunishment,
+ assertAll,
BushCommand,
BushInspectOptions,
+ clientSendAndPermCheck,
CodeBlockLang,
+ colors,
+ emojis,
+ getMethods,
Global,
Guild,
+ inspectCleanRedactCodeblock,
Level,
ModLog,
Shared,
@@ -40,8 +46,7 @@ import {
PermissionFlagsBits,
PermissionsBitField,
ReactionCollector,
- SelectMenuComponent,
- Util
+ SelectMenuComponent
} from 'discord.js';
import got from 'got';
import path from 'path';
@@ -49,15 +54,13 @@ import ts from 'typescript';
import { fileURLToPath } from 'url';
import { promisify } from 'util';
const { transpile } = ts,
- emojis = util.emojis,
- colors = util.colors,
sh = promisify(exec),
SnowflakeUtil = new Snowflake_(1420070400000n),
__dirname = path.dirname(fileURLToPath(import.meta.url));
/* eslint-enable @typescript-eslint/no-unused-vars */
// prettier-ignore
-util.assertAll(ActivePunishment, BushCommand, Global, Guild, Level, ModLog, Shared, StickyRole, Snowflake_, Canvas, exec, ActionRow, ButtonComponent, ButtonInteraction, Collection, Collector, CommandInteraction, ContextMenuCommandInteraction, DMChannel, Embed, Emoji, Interaction, InteractionCollector, Message, Attachment, MessageCollector, OAuth2Scopes, PermissionFlagsBits, PermissionsBitField, ReactionCollector, SelectMenuComponent, Util, path, ts, fileURLToPath, promisify, assert, got, transpile, emojis, colors, sh, SnowflakeUtil, __dirname);
+assertAll(ActivePunishment, BushCommand, Global, Guild, Level, ModLog, Shared, StickyRole, Snowflake_, Canvas, exec, ActionRow, ButtonComponent, ButtonInteraction, Collection, Collector, CommandInteraction, ContextMenuCommandInteraction, DMChannel, Embed, Emoji, Interaction, InteractionCollector, Message, Attachment, MessageCollector, OAuth2Scopes, PermissionFlagsBits, PermissionsBitField, ReactionCollector, SelectMenuComponent, path, ts, fileURLToPath, promisify, assert, got, transpile, sh, SnowflakeUtil, __dirname);
export default class EvalCommand extends BushCommand {
public constructor() {
@@ -174,7 +177,7 @@ export default class EvalCommand extends BushCommand {
],
slash: true,
ownerOnly: true,
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ clientPermissions: (m) => clientSendAndPermCheck(m),
userPermissions: []
});
}
@@ -207,12 +210,11 @@ export default class EvalCommand extends BushCommand {
no_inspect_strings: ArgType<'flag'>;
}
) {
- if (!message.author.isOwner())
- return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`);
+ if (!message.author.isOwner()) return await message.util.reply(`${emojis.error} Only my developers can run this command.`);
if (message.util.isSlashMessage(message)) await message.interaction.deferReply({ ephemeral: silent });
if (!sudo && ['delete', 'destroy'].some((p) => argCode.includes(p))) {
- return await message.util.send(`${util.emojis.error} This eval was blocked by smooth brain protection™.`);
+ return await message.util.send(`${emojis.error} This eval was blocked by smooth brain protection™.`);
}
const isTypescript = typescript || argCode.includes('```ts');
@@ -308,12 +310,12 @@ export default class EvalCommand extends BushCommand {
private async codeblock(obj: any, language: CodeBlockLang, options: CodeBlockCustomOptions = {}) {
if (options.prototype) obj = Object.getPrototypeOf(obj);
- if (options.methods) obj = util.getMethods(obj);
+ if (options.methods) obj = getMethods(obj);
options.depth ??= 1;
options.getters ??= true;
- return util.inspectCleanRedactCodeblock(obj, language, options);
+ return inspectCleanRedactCodeblock(obj, language, options);
}
}
diff --git a/src/commands/dev/javascript.ts b/src/commands/dev/javascript.ts
index fd1894b..7c47f2f 100644
--- a/src/commands/dev/javascript.ts
+++ b/src/commands/dev/javascript.ts
@@ -1,4 +1,14 @@
-import { BushCommand, type ArgType, type CommandMessage, type OptArgType, type SlashMessage } from '#lib';
+import {
+ BushCommand,
+ clientSendAndPermCheck,
+ colors,
+ emojis,
+ inspectCleanRedactCodeblock,
+ type ArgType,
+ type CommandMessage,
+ type OptArgType,
+ type SlashMessage
+} from '#lib';
import assert from 'assert';
import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js';
import { VM } from 'vm2';
@@ -35,7 +45,7 @@ export default class JavascriptCommand extends BushCommand {
],
slash: true,
superUserOnly: true,
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ clientPermissions: (m) => clientSendAndPermCheck(m),
userPermissions: []
});
}
@@ -44,36 +54,35 @@ export default class JavascriptCommand extends BushCommand {
message: CommandMessage | SlashMessage,
args: { code: ArgType<'string'>; sel_depth: OptArgType<'integer'> }
) {
- if (!message.author.isSuperUser())
- return await message.util.reply(`${util.emojis.error} Only super users can run this command.`);
+ if (!message.author.isSuperUser()) return await message.util.reply(`${emojis.error} Only super users can run this command.`);
if (message.util.isSlashMessage(message)) {
await message.interaction.deferReply({ ephemeral: false });
}
const code = args.code.replace(/[“”]/g, '"').replace(/```*(?:js)?/g, '');
const embed = new EmbedBuilder();
- const input = await util.inspectCleanRedactCodeblock(code, 'js');
+ const input = await inspectCleanRedactCodeblock(code, 'js');
try {
const rawOutput = /^(9\s*?\+\s*?10)|(10\s*?\+\s*?9)$/.test(code)
? '21'
: new VM({ eval: true, wasm: true, timeout: 1_000, fixAsync: true }).run(`${code}`);
- const output = await util.inspectCleanRedactCodeblock(rawOutput, 'js', {
+ const output = await inspectCleanRedactCodeblock(rawOutput, 'js', {
depth: args.sel_depth ?? 0,
getters: true,
inspectStrings: true,
colors: false
});
- embed.setTitle(`${util.emojis.successFull} Successfully Evaluated Expression`).setColor(util.colors.success);
+ embed.setTitle(`${emojis.successFull} Successfully Evaluated Expression`).setColor(colors.success);
embed.addFields([
{ name: '📥 Input', value: input },
{ name: '📤 Output', value: output }
]);
} catch (e) {
- embed.setTitle(`${util.emojis.errorFull} Unable to Evaluate Expression`).setColor(util.colors.error);
+ embed.setTitle(`${emojis.errorFull} Unable to Evaluate Expression`).setColor(colors.error);
embed.addFields([
{ name: '📥 Input', value: input },
- { name: '📤 Error', value: await util.inspectCleanRedactCodeblock(e, 'js', { colors: false }) }
+ { name: '📤 Error', value: await inspectCleanRedactCodeblock(e, 'js', { colors: false }) }
]);
}
diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts
index 96c395f..8c2000f 100644
--- a/src/commands/dev/reload.ts
+++ b/src/commands/dev/reload.ts
@@ -1,4 +1,13 @@
-import { BushCommand, type CommandMessage, type SlashMessage } from '#lib';
+import {
+ BushCommand,
+ clientSendAndPermCheck,
+ codeblock,
+ emojis,
+ formatError,
+ shell,
+ type CommandMessage,
+ type SlashMessage
+} from '#lib';
export default class ReloadCommand extends BushCommand {
public constructor() {
@@ -22,19 +31,18 @@ export default class ReloadCommand extends BushCommand {
ownerOnly: true,
typing: true,
slash: true,
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ clientPermissions: (m) => clientSendAndPermCheck(m),
userPermissions: []
});
}
public override async exec(message: CommandMessage | SlashMessage /* args: { fast: ArgType<'flag'> } */) {
- if (!message.author.isOwner())
- return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`);
+ if (!message.author.isOwner()) return await message.util.reply(`${emojis.error} Only my developers can run this command.`);
let output: { stdout: string; stderr: string };
try {
const s = new Date();
- output = await util.shell(`yarn build:${/* args.fast ? 'esbuild' : */ 'tsc'}`);
+ output = await shell(`yarn build:${/* args.fast ? 'esbuild' : */ 'tsc'}`);
await Promise.all([
client.commandHandler.reloadAll(),
client.listenerHandler.reloadAll(),
@@ -46,9 +54,7 @@ export default class ReloadCommand extends BushCommand {
return message.util.send(`🔁 Successfully reloaded! (${new Date().getTime() - s.getTime()}ms)`);
} catch (e) {
if (output!) void client.logger.error('reloadCommand', output);
- return message.util.send(
- `An error occurred while reloading:\n${await util.codeblock(util.formatError(e), 2048 - 34, 'js', true)}`
- );
+ return message.util.send(`An error occurred while reloading:\n${await codeblock(formatError(e), 2048 - 34, 'js', true)}`);
}
}
}
diff --git a/src/commands/dev/say.ts b/src/commands/dev/say.ts
index a452126..6ec52a1 100644
--- a/src/commands/dev/say.ts
+++ b/src/commands/dev/say.ts
@@ -1,4 +1,12 @@
-import { AllowedMentions, BushCommand, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
+import {
+ AllowedMentions,
+ BushCommand,
+ clientSendAndPermCheck,
+ emojis,
+ type ArgType,
+ type CommandMessage,
+ type SlashMessage
+} from '#lib';
import { ApplicationCommandOptionType } from 'discord.js';
export default class SayCommand extends BushCommand {
@@ -21,15 +29,14 @@ export default class SayCommand extends BushCommand {
}
],
ownerOnly: true,
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ clientPermissions: (m) => clientSendAndPermCheck(m),
userPermissions: [],
slash: true
});
}
public override async exec(message: CommandMessage | SlashMessage, args: { content: ArgType<'string'> }) {
- if (!message.author.isOwner())
- return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`);
+ if (!message.author.isOwner()) return await message.util.reply(`${emojis.error} Only my developers can run this command.`);
await message.delete().catch(() => null);
await message.util.send({ content: args.content, allowedMentions: AllowedMentions.none() }).catch(() => null);
@@ -38,7 +45,7 @@ export default class SayCommand extends BushCommand {
public override async execSlash(message: SlashMessage, args: { content: string }) {
if (!client.config.owners.includes(message.author.id)) {
return await message.interaction.reply({
- content: `${util.emojis.error} Only my developers can run this command.`,
+ content: `${emojis.error} Only my developers can run this command.`,
ephemeral: true
});
}
diff --git a/src/commands/dev/servers.ts b/src/commands/dev/servers.ts
index e99bcda..28a4e5d 100644
--- a/src/commands/dev/servers.ts
+++ b/src/commands/dev/servers.ts
@@ -1,4 +1,13 @@
-import { BushCommand, ButtonPaginator, type CommandMessage, type SlashMessage } from '#lib';
+import {
+ BushCommand,
+ ButtonPaginator,
+ chunk,
+ clientSendAndPermCheck,
+ colors,
+ format,
+ type CommandMessage,
+ type SlashMessage
+} from '#lib';
import { stripIndent } from '#tags';
import { type APIEmbed, type Guild } from 'discord.js';
@@ -10,7 +19,7 @@ export default class ServersCommand extends BushCommand {
description: 'Displays all the severs the bot is in',
usage: ['servers'],
examples: ['servers'],
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ clientPermissions: (m) => clientSendAndPermCheck(m),
userPermissions: [],
ownerOnly: true
});
@@ -18,13 +27,13 @@ export default class ServersCommand extends BushCommand {
public override async exec(message: CommandMessage | SlashMessage) {
const guilds = [...client.guilds.cache.sort((a, b) => (a.memberCount < b.memberCount ? 1 : -1)).values()];
- const chunkedGuilds: Guild[][] = util.chunk(guilds, 10);
+ const chunkedGuilds: Guild[][] = chunk(guilds, 10);
const embeds: APIEmbed[] = chunkedGuilds.map((chunk) => {
return {
title: `Server List [\`${guilds.length.toLocaleString()}\`]`,
- color: util.colors.default,
+ color: colors.default,
fields: chunk.map((guild) => ({
- name: util.format.input(guild.name),
+ name: format.input(guild.name),
value: stripIndent`
**ID:** ${guild.id}
**Owner:** ${client.users.cache.has(guild.ownerId) ? client.users.cache.get(guild.ownerId)!.tag : guild.ownerId}
diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts
index 8c62f5d..f7c17bd 100644
--- a/src/commands/dev/sh.ts
+++ b/src/commands/dev/sh.ts
@@ -1,8 +1,18 @@
-import { ArgType, BushCommand, type CommandMessage, type SlashMessage } from '#lib';
+import {
+ ArgType,
+ BushCommand,
+ clientSendAndPermCheck,
+ codeblock,
+ colors,
+ emojis,
+ formatError,
+ type CommandMessage,
+ type SlashMessage
+} from '#lib';
import assert from 'assert';
import chalk from 'chalk';
import { exec } from 'child_process';
-import { ApplicationCommandOptionType, EmbedBuilder, Util } from 'discord.js';
+import { ApplicationCommandOptionType, cleanCodeBlockContent, EmbedBuilder } from 'discord.js';
import { promisify } from 'util';
assert(chalk);
@@ -11,7 +21,7 @@ const sh = promisify(exec);
const clean = (text: string | any) => {
chalk.toString;
if (typeof text === 'string') {
- return (text = Util.cleanCodeBlockContent(text));
+ return (text = cleanCodeBlockContent(text));
} else return text;
};
@@ -35,24 +45,24 @@ export default class ShCommand extends BushCommand {
}
],
ownerOnly: true,
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ clientPermissions: (m) => clientSendAndPermCheck(m),
userPermissions: []
});
}
public override async exec(message: CommandMessage | SlashMessage, args: { command: ArgType<'string'> }) {
if (!client.config.owners.includes(message.author.id))
- return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`);
+ return await message.util.reply(`${emojis.error} Only my developers can run this command.`);
const input = clean(args.command);
const embed = new EmbedBuilder()
- .setColor(util.colors.gray)
+ .setColor(colors.gray)
.setFooter({ text: message.author.tag, iconURL: message.author.avatarURL() ?? undefined })
.setTimestamp()
.setTitle('Shell Command')
.addFields([
- { name: '📥 Input', value: await util.codeblock(input, 1024, 'sh', true) },
- { name: 'Running', value: util.emojis.loading }
+ { name: '📥 Input', value: await codeblock(input, 1024, 'sh', true) },
+ { name: 'Running', value: emojis.loading }
]);
await message.util.reply({ embeds: [embed] });
@@ -69,20 +79,14 @@ export default class ShCommand extends BushCommand {
const stdout = /* strip( */ clean(output.stdout); /* ) */
const stderr = /* strip( */ clean(output.stderr); /* ) */
- embed
- .setTitle(`${util.emojis.successFull} Executed command successfully.`)
- .setColor(util.colors.success)
- .spliceFields(1, 1);
+ embed.setTitle(`${emojis.successFull} Executed command successfully.`).setColor(colors.success).spliceFields(1, 1);
- if (stdout) embed.addFields([{ name: '📤 stdout', value: await util.codeblock(stdout, 1024, 'ansi', true) }]);
- if (stderr) embed.addFields([{ name: '📤 stderr', value: await util.codeblock(stderr, 1024, 'ansi', true) }]);
+ if (stdout) embed.addFields([{ name: '📤 stdout', value: await codeblock(stdout, 1024, 'ansi', true) }]);
+ if (stderr) embed.addFields([{ name: '📤 stderr', value: await codeblock(stderr, 1024, 'ansi', true) }]);
} catch (e) {
- embed
- .setTitle(`${util.emojis.errorFull} An error occurred while executing.`)
- .setColor(util.colors.error)
- .spliceFields(1, 1);
+ embed.setTitle(`${emojis.errorFull} An error occurred while executing.`).setColor(colors.error).spliceFields(1, 1);
- embed.addFields([{ name: '📤 Output', value: await util.codeblock(util.formatError(e, true), 1024, 'ansi', true) }]);
+ embed.addFields([{ name: '📤 Output', value: await codeblock(formatError(e, true), 1024, 'ansi', true) }]);
}
await message.util.edit({ embeds: [embed] });
}
diff --git a/src/commands/dev/superUser.ts b/src/commands/dev/superUser.ts
index 6a2b745..3de04bf 100644
--- a/src/commands/dev/superUser.ts
+++ b/src/commands/dev/superUser.ts
@@ -1,4 +1,13 @@
-import { BushCommand, type ArgType, type CommandMessage } from '#lib';
+import {
+ BushCommand,
+ clientSendAndPermCheck,
+ emojis,
+ format,
+ getShared,
+ insertOrRemoveFromShared,
+ type ArgType,
+ type CommandMessage
+} from '#lib';
import { type ArgumentGeneratorReturn, type ArgumentTypeCasterReturn } from 'discord-akairo';
export default class SuperUserCommand extends BushCommand {
@@ -9,7 +18,7 @@ export default class SuperUserCommand extends BushCommand {
description: 'A command to manage superusers.',
usage: ['superuser <add/remove> <user>'],
examples: ['superuser add IRONM00N'],
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ clientPermissions: (m) => clientSendAndPermCheck(m),
userPermissions: [],
ownerOnly: true,
helpArgs: [
@@ -54,29 +63,28 @@ export default class SuperUserCommand extends BushCommand {
}
public override async exec(message: CommandMessage, args: { action: 'add' | 'remove'; user: ArgType<'user'> }) {
- if (!message.author.isOwner())
- return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`);
+ if (!message.author.isOwner()) return await message.util.reply(`${emojis.error} Only my developers can run this command.`);
- const superUsers: string[] = util.getShared('superUsers');
+ const superUsers: string[] = getShared('superUsers');
if (args.action === 'add' ? superUsers.includes(args.user.id) : !superUsers.includes(args.user.id))
return message.util.reply(
- `${util.emojis.warn} ${util.format.input(args.user.tag)} is ${args.action === 'add' ? 'already' : 'not'} a superuser.`
+ `${emojis.warn} ${format.input(args.user.tag)} is ${args.action === 'add' ? 'already' : 'not'} a superuser.`
);
- const success = await util.insertOrRemoveFromShared(args.action, 'superUsers', args.user.id).catch(() => false);
+ const success = await insertOrRemoveFromShared(args.action, 'superUsers', args.user.id).catch(() => false);
if (success) {
return await message.util.reply(
- `${util.emojis.success} ${args.action == 'remove' ? '' : 'made'} ${util.format.input(args.user.tag)} ${
+ `${emojis.success} ${args.action == 'remove' ? '' : 'made'} ${format.input(args.user.tag)} ${
args.action == 'remove' ? 'is no longer ' : ''
}a superuser.`
);
} else {
return await message.util.reply(
- `${util.emojis.error} There was an error ${args.action == 'remove' ? `removing` : 'making'} ${util.format.input(
- args.user.tag
- )} ${args.action == 'remove' ? `from` : 'to'} the superuser list.`
+ `${emojis.error} There was an error ${args.action == 'remove' ? `removing` : 'making'} ${format.input(args.user.tag)} ${
+ args.action == 'remove' ? `from` : 'to'
+ } the superuser list.`
);
}
}
diff --git a/src/commands/dev/syncAutomod.ts b/src/commands/dev/syncAutomod.ts
index 9954e70..c78e6c0 100644
--- a/src/commands/dev/syncAutomod.ts
+++ b/src/commands/dev/syncAutomod.ts
@@ -1,4 +1,4 @@
-import { BushCommand, Shared, type CommandMessage, type SlashMessage } from '#lib';
+import { BushCommand, clientSendAndPermCheck, emojis, Shared, type CommandMessage, type SlashMessage } from '#lib';
import got from 'got';
import typescript from 'typescript';
import { NodeVM } from 'vm2';
@@ -13,14 +13,14 @@ export default class SyncAutomodCommand extends BushCommand {
examples: ['sync-automod'],
slash: false,
hidden: true,
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ clientPermissions: (m) => clientSendAndPermCheck(m),
userPermissions: []
});
}
public override async exec(message: CommandMessage | SlashMessage) {
if (!message.author.isOwner() && message.author.id !== '497789163555389441')
- return await message.util.reply(`${util.emojis.error} Only a very select few may use this command.`);
+ return await message.util.reply(`${emojis.error} Only a very select few may use this command.`);
const badLinks = (await got.get('https://raw.githubusercontent.com/NotEnoughUpdates/bush-bot/master/src/lib/badlinks.ts'))
.body;
@@ -38,6 +38,6 @@ export default class SyncAutomodCommand extends BushCommand {
row.badWords = badWordsParsed;
await row.save();
- return await message.util.reply(`${util.emojis.success} Automod info synced.`);
+ return await message.util.reply(`${emojis.success} Automod info synced.`);
}
}
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index d54d544..9491d19 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -1,4 +1,13 @@
-import { BushCommand, ButtonPaginator, OptArgType, Shared, type CommandMessage } from '#lib';
+import {
+ BushCommand,
+ ButtonPaginator,
+ clientSendAndPermCheck,
+ colors,
+ emojis,
+ OptArgType,
+ Shared,
+ type CommandMessage
+} from '#lib';
import {
ActionRowBuilder,
ButtonBuilder,
@@ -33,7 +42,7 @@ export default class TestCommand extends BushCommand {
}
],
superUserOnly: true,
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ clientPermissions: (m) => clientSendAndPermCheck(m),
userPermissions: []
});
}
@@ -65,7 +74,7 @@ export default class TestCommand extends BushCommand {
const embed = new EmbedBuilder()
.addFields([{ name: 'Field Name', value: 'Field Content' }])
.setAuthor({ name: 'Author', iconURL: 'https://www.w3schools.com/w3css/img_snowtops.jpg', url: 'https://google.com/' })
- .setColor(message.member?.displayColor ?? util.colors.default)
+ .setColor(message.member?.displayColor ?? colors.default)
.setDescription('Description')
.setFooter({ text: 'Footer', iconURL: message.author.avatarURL() ?? undefined })
.setURL('https://duckduckgo.com/')
@@ -106,12 +115,12 @@ export default class TestCommand extends BushCommand {
const fields = Array(25)
.fill(0)
.map((_, i) => ({ name: `Field ${i}`, value: 'Field Value' }));
- const c = util.colors;
const o = { description, author, footer, fields, time: Date.now() };
- const colors = [c.red, c.orange, c.gold, c.yellow, c.green, c.darkGreen, c.aqua, c.blue, c.purple, c.pink];
+ const c = colors;
+ const embedColors = [c.red, c.orange, c.gold, c.yellow, c.green, c.darkGreen, c.aqua, c.blue, c.purple, c.pink];
- const embeds = colors.map((c, i) => ({ ...o, title: `Embed Title ${i}`, color: c }));
+ const embeds = embedColors.map((c, i) => ({ ...o, title: `Embed Title ${i}`, color: c }));
const ButtonRows: ActionRowBuilder<ButtonBuilder>[] = [];
for (let a = 1; a <= 5; a++) {
@@ -125,7 +134,7 @@ export default class TestCommand extends BushCommand {
}
return await message.util.reply({ content: 'this is content', components: ButtonRows, embeds });
} else if (['delete slash commands'].includes(args.feature?.toLowerCase())) {
- if (!message.guild) return await message.util.reply(`${util.emojis.error} This test can only be run in a guild.`);
+ if (!message.guild) return await message.util.reply(`${emojis.error} This test can only be run in a guild.`);
await client.guilds.fetch();
const promises: Promise<Collection<string, ApplicationCommand>>[] = [];
client.guilds.cache.each((guild) => {
@@ -136,16 +145,16 @@ export default class TestCommand extends BushCommand {
await client.application!.commands.fetch();
await client.application!.commands.set([]);
- return await message.util.reply(`${util.emojis.success} Removed guild commands and global commands.`);
+ return await message.util.reply(`${emojis.success} Removed guild commands and global commands.`);
} else if (['drop down', 'drop downs', 'select menu', 'select menus'].includes(args.feature?.toLowerCase())) {
- return message.util.reply(`${util.emojis.error} no`);
+ return message.util.reply(`${emojis.error} no`);
} else if (['sync automod'].includes(args.feature?.toLowerCase())) {
const row = (await Shared.findByPk(0))!;
row.badLinks = badLinksArray;
row.badLinksSecret = badLinksSecretArray;
row.badWords = badWords;
await row.save();
- return await message.util.reply(`${util.emojis.success} Synced automod.`);
+ return await message.util.reply(`${emojis.success} Synced automod.`);
} else if (['modal'].includes(args.feature?.toLowerCase())) {
const m = await message.util.reply({
content: 'Click for modal',