aboutsummaryrefslogtreecommitdiff
path: root/src/commands/dev
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-14 12:47:57 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-14 12:47:57 -0400
commit661e4c9935aeb8760dafc7ced4bbec6cc356a033 (patch)
treebb4c12bdef067d203f100e13e05ccb705b299834 /src/commands/dev
parenteaf592b72eb5b1d66aa2bde5151a8947570a506c (diff)
downloadtanzanite-661e4c9935aeb8760dafc7ced4bbec6cc356a033.tar.gz
tanzanite-661e4c9935aeb8760dafc7ced4bbec6cc356a033.tar.bz2
tanzanite-661e4c9935aeb8760dafc7ced4bbec6cc356a033.zip
remove the war crimes that I previously committed
- Remove custom typings and replace with declaration merging - Fix the typings for args - Replace all discord-api-types imports with discord.js imports - Fix discord.js breaking changes
Diffstat (limited to 'src/commands/dev')
-rw-r--r--src/commands/dev/__template.ts4
-rw-r--r--src/commands/dev/debug.ts4
-rw-r--r--src/commands/dev/dm.ts4
-rw-r--r--src/commands/dev/eval.ts30
-rw-r--r--src/commands/dev/javascript.ts9
-rw-r--r--src/commands/dev/reload.ts8
-rw-r--r--src/commands/dev/say.ts6
-rw-r--r--src/commands/dev/servers.ts7
-rw-r--r--src/commands/dev/sh.ts8
-rw-r--r--src/commands/dev/superUser.ts23
-rw-r--r--src/commands/dev/syncAutomod.ts4
-rw-r--r--src/commands/dev/test.ts300
12 files changed, 201 insertions, 206 deletions
diff --git a/src/commands/dev/__template.ts b/src/commands/dev/__template.ts
index ace8802..7bcce32 100644
--- a/src/commands/dev/__template.ts
+++ b/src/commands/dev/__template.ts
@@ -1,4 +1,4 @@
-import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage, type OptArgType } from '#lib';
+import { BushCommand, type ArgType, type CommandMessage, type OptArgType, type SlashMessage } from '#lib';
import { ApplicationCommandOptionType } from 'discord.js';
export default class TemplateCommand extends BushCommand {
@@ -39,7 +39,7 @@ export default class TemplateCommand extends BushCommand {
}
public override async exec(
- message: BushMessage | BushSlashMessage,
+ 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.`);
diff --git a/src/commands/dev/debug.ts b/src/commands/dev/debug.ts
index f8c614d..682a93d 100644
--- a/src/commands/dev/debug.ts
+++ b/src/commands/dev/debug.ts
@@ -1,4 +1,4 @@
-// import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+// import { BushCommand, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
// import { ApplicationCommandOptionType, AutocompleteInteraction, ChatInputCommandInteraction } from 'discord.js';
// import Fuse from 'fuse.js';
@@ -29,7 +29,7 @@
// });
// }
-// public override async exec(message: BushMessage | BushSlashMessage, args: { action: ArgType<'string'> }) {
+// public override async exec(message: CommandMessage | SlashMessage, args: { action: ArgType<'string'> }) {
// if (args.action === 'util.reply') {
// return await message.util.reply(`This is a util.reply`);
// } else if (args.action === 'util.reply-object') {
diff --git a/src/commands/dev/dm.ts b/src/commands/dev/dm.ts
index 0646f59..468fb20 100644
--- a/src/commands/dev/dm.ts
+++ b/src/commands/dev/dm.ts
@@ -1,4 +1,4 @@
-import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import { BushCommand, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
import { ApplicationCommandOptionType } from 'discord.js';
export default class DMCommand extends BushCommand {
@@ -37,7 +37,7 @@ export default class DMCommand extends BushCommand {
}
public override async exec(
- message: BushMessage | BushSlashMessage,
+ message: CommandMessage | SlashMessage,
args: { user: ArgType<'user'>; content: ArgType<'string'> }
) {
try {
diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts
index 8af280d..b8ee9e4 100644
--- a/src/commands/dev/eval.ts
+++ b/src/commands/dev/eval.ts
@@ -3,8 +3,6 @@ import {
ActivePunishment,
BushCommand,
BushInspectOptions,
- BushMessage,
- BushSlashMessage,
CodeBlockLang,
Global,
Guild,
@@ -12,7 +10,9 @@ import {
ModLog,
Shared,
StickyRole,
- type ArgType
+ type ArgType,
+ type CommandMessage,
+ type SlashMessage
} from '#lib';
import { Snowflake as Snowflake_ } from '@sapphire/snowflake';
import assert from 'assert';
@@ -57,7 +57,7 @@ const { transpile } = ts,
/* eslint-enable @typescript-eslint/no-unused-vars */
// prettier-ignore
-util.assertAll(ActivePunishment, BushCommand, BushMessage, BushSlashMessage, 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);
+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);
export default class EvalCommand extends BushCommand {
public constructor() {
@@ -180,7 +180,7 @@ export default class EvalCommand extends BushCommand {
}
public override async exec(
- message: BushMessage | BushSlashMessage,
+ message: CommandMessage | SlashMessage,
{
code: argCode,
sel_depth: selDepth,
@@ -196,15 +196,15 @@ export default class EvalCommand extends BushCommand {
}: {
code: ArgType<'string'>;
sel_depth: ArgType<'integer'>;
- sudo: ArgType<'boolean'>;
- silent: ArgType<'boolean'>;
- delete_msg: ArgType<'boolean'>;
- typescript: ArgType<'boolean'>;
- hidden: ArgType<'boolean'>;
- show_proto: ArgType<'boolean'>;
- show_methods: ArgType<'boolean'>;
- async: ArgType<'boolean'>;
- no_inspect_strings: ArgType<'boolean'>;
+ sudo: ArgType<'flag'>;
+ silent: ArgType<'flag'>;
+ delete_msg: ArgType<'flag'>;
+ typescript: ArgType<'flag'>;
+ hidden: ArgType<'flag'>;
+ show_proto: ArgType<'flag'>;
+ show_methods: ArgType<'flag'>;
+ async: ArgType<'flag'>;
+ no_inspect_strings: ArgType<'flag'>;
}
) {
if (!message.author.isOwner())
@@ -322,5 +322,3 @@ interface CodeBlockCustomOptions extends CodeBlockOptions {
prototype?: boolean;
methods?: boolean;
}
-
-/** @typedef {ActivePunishment|Global|Guild|Level|ModLog|StickyRole|ButtonInteraction|Collection|Collector|CommandInteraction|ContextMenuCommandInteraction|DMChannel|Emoji|Interaction|InteractionCollector|Message|ActionRow|Attachment|ButtonComponent|MessageCollector|SelectMenuComponent|ReactionCollector|Util|Canvas|Shared|PermissionsBitField|got} VSCodePleaseDontRemove */
diff --git a/src/commands/dev/javascript.ts b/src/commands/dev/javascript.ts
index be8fdce..fd1894b 100644
--- a/src/commands/dev/javascript.ts
+++ b/src/commands/dev/javascript.ts
@@ -1,4 +1,4 @@
-import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import { BushCommand, type ArgType, type CommandMessage, type OptArgType, type SlashMessage } from '#lib';
import assert from 'assert';
import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js';
import { VM } from 'vm2';
@@ -41,11 +41,8 @@ export default class JavascriptCommand extends BushCommand {
}
public override async exec(
- message: BushMessage | BushSlashMessage,
- args: {
- sel_depth: ArgType<'integer'>;
- code: string;
- }
+ 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.`);
diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts
index 17802b0..96c395f 100644
--- a/src/commands/dev/reload.ts
+++ b/src/commands/dev/reload.ts
@@ -1,4 +1,4 @@
-import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { BushCommand, type CommandMessage, type SlashMessage } from '#lib';
export default class ReloadCommand extends BushCommand {
public constructor() {
@@ -13,7 +13,7 @@ export default class ReloadCommand extends BushCommand {
// id: 'fast',
// description: 'Whether or not to use esbuild for fast compiling.',
// match: 'flag',
- // flag: '--fast',
+ // flag: ['--fast'],
// prompt: 'Would you like to use esbuild for fast compiling?',
// optional: true,
// slashType: ApplicationCommandOptionType.Boolean
@@ -27,14 +27,14 @@ export default class ReloadCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage | BushSlashMessage /* { fast }: { fast: boolean } */) {
+ 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.`);
let output: { stdout: string; stderr: string };
try {
const s = new Date();
- output = await util.shell(`yarn build:${/* fast ? 'esbuild' : */ 'tsc'}`);
+ output = await util.shell(`yarn build:${/* args.fast ? 'esbuild' : */ 'tsc'}`);
await Promise.all([
client.commandHandler.reloadAll(),
client.listenerHandler.reloadAll(),
diff --git a/src/commands/dev/say.ts b/src/commands/dev/say.ts
index bbada0c..a452126 100644
--- a/src/commands/dev/say.ts
+++ b/src/commands/dev/say.ts
@@ -1,4 +1,4 @@
-import { AllowedMentions, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { AllowedMentions, BushCommand, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
import { ApplicationCommandOptionType } from 'discord.js';
export default class SayCommand extends BushCommand {
@@ -27,7 +27,7 @@ export default class SayCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage | BushSlashMessage, args: { content: string }) {
+ 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.`);
@@ -35,7 +35,7 @@ export default class SayCommand extends BushCommand {
await message.util.send({ content: args.content, allowedMentions: AllowedMentions.none() }).catch(() => null);
}
- public override async execSlash(message: BushSlashMessage, args: { content: string }) {
+ 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.`,
diff --git a/src/commands/dev/servers.ts b/src/commands/dev/servers.ts
index 0701158..e99bcda 100644
--- a/src/commands/dev/servers.ts
+++ b/src/commands/dev/servers.ts
@@ -1,7 +1,6 @@
-import { BushCommand, ButtonPaginator, type BushMessage, type BushSlashMessage } from '#lib';
+import { BushCommand, ButtonPaginator, type CommandMessage, type SlashMessage } from '#lib';
import { stripIndent } from '#tags';
-import type { APIEmbed } from 'discord-api-types/v10';
-import type { Guild } from 'discord.js';
+import { type APIEmbed, type Guild } from 'discord.js';
export default class ServersCommand extends BushCommand {
public constructor() {
@@ -17,7 +16,7 @@ export default class ServersCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage | BushSlashMessage) {
+ 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 embeds: APIEmbed[] = chunkedGuilds.map((chunk) => {
diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts
index d47ecd2..8c62f5d 100644
--- a/src/commands/dev/sh.ts
+++ b/src/commands/dev/sh.ts
@@ -1,4 +1,4 @@
-import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { ArgType, BushCommand, type CommandMessage, type SlashMessage } from '#lib';
import assert from 'assert';
import chalk from 'chalk';
import { exec } from 'child_process';
@@ -40,10 +40,10 @@ export default class ShCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage | BushSlashMessage, { command }: { command: string }) {
+ 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.`);
- const input = clean(command);
+ const input = clean(args.command);
const embed = new EmbedBuilder()
.setColor(util.colors.gray)
@@ -65,7 +65,7 @@ export default class ShCommand extends BushCommand {
return abc.replace(new RegExp(pattern, 'g'), '');
} */
try {
- const output = await sh(command, { env: { ...process.env, FORCE_COLOR: 'true' } });
+ const output = await sh(args.command, { env: { ...process.env, FORCE_COLOR: 'true' } });
const stdout = /* strip( */ clean(output.stdout); /* ) */
const stderr = /* strip( */ clean(output.stderr); /* ) */
diff --git a/src/commands/dev/superUser.ts b/src/commands/dev/superUser.ts
index d62ac8e..6a2b745 100644
--- a/src/commands/dev/superUser.ts
+++ b/src/commands/dev/superUser.ts
@@ -1,6 +1,5 @@
-import { BushCommand, type ArgType, type BushMessage } from '#lib';
-import { ArgumentGeneratorReturn } from 'discord-akairo';
-import { ArgumentTypeCasterReturn } from 'discord-akairo/dist/src/struct/commands/arguments/Argument.js';
+import { BushCommand, type ArgType, type CommandMessage } from '#lib';
+import { type ArgumentGeneratorReturn, type ArgumentTypeCasterReturn } from 'discord-akairo';
export default class SuperUserCommand extends BushCommand {
public constructor() {
@@ -54,30 +53,30 @@ export default class SuperUserCommand extends BushCommand {
return { action, user };
}
- public override async exec(message: BushMessage, { action, user }: { action: 'add' | 'remove'; user: ArgType<'user'> }) {
+ 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.`);
const superUsers: string[] = util.getShared('superUsers');
- if (action === 'add' ? superUsers.includes(user.id) : !superUsers.includes(user.id))
+ if (args.action === 'add' ? superUsers.includes(args.user.id) : !superUsers.includes(args.user.id))
return message.util.reply(
- `${util.emojis.warn} ${util.format.input(user.tag)} is ${action === 'add' ? 'already' : 'not'} a superuser.`
+ `${util.emojis.warn} ${util.format.input(args.user.tag)} is ${args.action === 'add' ? 'already' : 'not'} a superuser.`
);
- const success = await util.insertOrRemoveFromShared(action, 'superUsers', user.id).catch(() => false);
+ const success = await util.insertOrRemoveFromShared(args.action, 'superUsers', args.user.id).catch(() => false);
if (success) {
return await message.util.reply(
- `${util.emojis.success} ${action == 'remove' ? '' : 'made'} ${util.format.input(user.tag)} ${
- action == 'remove' ? 'is no longer ' : ''
+ `${util.emojis.success} ${args.action == 'remove' ? '' : 'made'} ${util.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 ${action == 'remove' ? `removing` : 'making'} ${util.format.input(user.tag)} ${
- action == 'remove' ? `from` : 'to'
- } the superuser list.`
+ `${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.`
);
}
}
diff --git a/src/commands/dev/syncAutomod.ts b/src/commands/dev/syncAutomod.ts
index 4d4a6d7..9954e70 100644
--- a/src/commands/dev/syncAutomod.ts
+++ b/src/commands/dev/syncAutomod.ts
@@ -1,4 +1,4 @@
-import { BushCommand, Shared, type BushMessage, type BushSlashMessage } from '#lib';
+import { BushCommand, Shared, type CommandMessage, type SlashMessage } from '#lib';
import got from 'got';
import typescript from 'typescript';
import { NodeVM } from 'vm2';
@@ -18,7 +18,7 @@ export default class SyncAutomodCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage | BushSlashMessage) {
+ 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.`);
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index 2d7b1f8..d54d544 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -1,11 +1,11 @@
-import { BushCommand, ButtonPaginator, Shared, type BushMessage } from '#lib';
-import { Routes } from 'discord-api-types/rest/v9';
+import { BushCommand, ButtonPaginator, OptArgType, Shared, type CommandMessage } from '#lib';
import {
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
EmbedBuilder,
GatewayDispatchEvents,
+ Routes,
type ApplicationCommand,
type Collection
} from 'discord.js';
@@ -38,7 +38,7 @@ export default class TestCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage, args: { feature: string }) {
+ public override async exec(message: CommandMessage, args: { feature: OptArgType<'string'> }) {
const responses = [
'Yes master.',
'Test it your self bitch, I am hungry.',
@@ -51,166 +51,168 @@ export default class TestCommand extends BushCommand {
return await message.util.reply(responses[Math.floor(Math.random() * responses.length)]);
}
- if (['button', 'buttons'].includes(args.feature?.toLowerCase())) {
- const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents([
- new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'primaryButton', label: 'Primary' }),
- new ButtonBuilder({ style: ButtonStyle.Secondary, customId: 'secondaryButton', label: 'Secondary' }),
- new ButtonBuilder({ style: ButtonStyle.Success, customId: 'successButton', label: 'Success' }),
- new ButtonBuilder({ style: ButtonStyle.Danger, customId: 'dangerButton', label: 'Danger' }),
- new ButtonBuilder({ style: ButtonStyle.Link, label: 'Link', url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' })
- ]);
- return await message.util.reply({ content: 'buttons', components: [buttonRow] });
- } else if (['embed', 'button embed'].includes(args.feature?.toLowerCase())) {
- 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)
- .setDescription('Description')
- .setFooter({ text: 'Footer', iconURL: message.author.avatarURL() ?? undefined })
- .setURL('https://duckduckgo.com/')
- .setTimestamp()
- .setImage('https://media.sproutsocial.com/uploads/2017/02/10x-featured-social-media-image-size.png')
- .setThumbnail(
- 'https://images.unsplash.com/photo-1501183007986-d0d080b147f9?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2134&q=80'
- )
- .setTitle('Title');
+ if (args.feature) {
+ if (['button', 'buttons'].includes(args.feature?.toLowerCase())) {
+ const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents([
+ new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'primaryButton', label: 'Primary' }),
+ new ButtonBuilder({ style: ButtonStyle.Secondary, customId: 'secondaryButton', label: 'Secondary' }),
+ new ButtonBuilder({ style: ButtonStyle.Success, customId: 'successButton', label: 'Success' }),
+ new ButtonBuilder({ style: ButtonStyle.Danger, customId: 'dangerButton', label: 'Danger' }),
+ new ButtonBuilder({ style: ButtonStyle.Link, label: 'Link', url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' })
+ ]);
+ return await message.util.reply({ content: 'buttons', components: [buttonRow] });
+ } else if (['embed', 'button embed'].includes(args.feature?.toLowerCase())) {
+ 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)
+ .setDescription('Description')
+ .setFooter({ text: 'Footer', iconURL: message.author.avatarURL() ?? undefined })
+ .setURL('https://duckduckgo.com/')
+ .setTimestamp()
+ .setImage('https://media.sproutsocial.com/uploads/2017/02/10x-featured-social-media-image-size.png')
+ .setThumbnail(
+ 'https://images.unsplash.com/photo-1501183007986-d0d080b147f9?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2134&q=80'
+ )
+ .setTitle('Title');
- const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents([
- new ButtonBuilder({ style: ButtonStyle.Link, label: 'Link', url: 'https://google.com/' })
- ]);
- return await message.util.reply({ content: 'Test', embeds: [embed], components: [buttonRow] });
- } else if (['lots of buttons'].includes(args.feature?.toLowerCase())) {
- const buttonRows: ActionRowBuilder<ButtonBuilder>[] = [];
- for (let a = 1; a <= 5; a++) {
- const row = new ActionRowBuilder<ButtonBuilder>();
- for (let b = 1; b <= 5; b++) {
- const id = (a + 5 * (b - 1)).toString();
- const button = new ButtonBuilder({ style: ButtonStyle.Primary, customId: id, label: id });
- row.addComponents([button]);
+ const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents([
+ new ButtonBuilder({ style: ButtonStyle.Link, label: 'Link', url: 'https://google.com/' })
+ ]);
+ return await message.util.reply({ content: 'Test', embeds: [embed], components: [buttonRow] });
+ } else if (['lots of buttons'].includes(args.feature?.toLowerCase())) {
+ const buttonRows: ActionRowBuilder<ButtonBuilder>[] = [];
+ for (let a = 1; a <= 5; a++) {
+ const row = new ActionRowBuilder<ButtonBuilder>();
+ for (let b = 1; b <= 5; b++) {
+ const id = (a + 5 * (b - 1)).toString();
+ const button = new ButtonBuilder({ style: ButtonStyle.Primary, customId: id, label: id });
+ row.addComponents([button]);
+ }
+ buttonRows.push(row);
}
- buttonRows.push(row);
- }
- return await message.util.reply({ content: 'buttons', components: buttonRows });
- } else if (['paginate'].includes(args.feature?.toLowerCase())) {
- const embeds = [];
- for (let i = 1; i <= 5; i++) {
- embeds.push(new EmbedBuilder().setDescription(i.toString()));
- }
- return await ButtonPaginator.send(message, embeds);
- } else if (['lots of embeds'].includes(args.feature?.toLowerCase())) {
- const description = 'This is a description.';
- const _avatar = message.author.avatarURL() ?? undefined;
- const author = { name: 'This is a author', iconURL: _avatar };
- const footer = { text: 'This is a footer', iconURL: _avatar };
- 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() };
+ return await message.util.reply({ content: 'buttons', components: buttonRows });
+ } else if (['paginate'].includes(args.feature?.toLowerCase())) {
+ const embeds = [];
+ for (let i = 1; i <= 5; i++) {
+ embeds.push(new EmbedBuilder().setDescription(i.toString()));
+ }
+ return await ButtonPaginator.send(message, embeds);
+ } else if (['lots of embeds'].includes(args.feature?.toLowerCase())) {
+ const description = 'This is a description.';
+ const _avatar = message.author.avatarURL() ?? undefined;
+ const author = { name: 'This is a author', iconURL: _avatar };
+ const footer = { text: 'This is a footer', iconURL: _avatar };
+ 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 colors = [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 = colors.map((c, i) => ({ ...o, title: `Embed Title ${i}`, color: c }));
- const ButtonRows: ActionRowBuilder<ButtonBuilder>[] = [];
- for (let a = 1; a <= 5; a++) {
- const row = new ActionRowBuilder<ButtonBuilder>();
- for (let b = 1; b <= 5; b++) {
- const id = (a + 5 * (b - 1)).toString();
- const button = new ButtonBuilder({ style: ButtonStyle.Secondary, customId: id, label: id });
- row.addComponents([button]);
+ const ButtonRows: ActionRowBuilder<ButtonBuilder>[] = [];
+ for (let a = 1; a <= 5; a++) {
+ const row = new ActionRowBuilder<ButtonBuilder>();
+ for (let b = 1; b <= 5; b++) {
+ const id = (a + 5 * (b - 1)).toString();
+ const button = new ButtonBuilder({ style: ButtonStyle.Secondary, customId: id, label: id });
+ row.addComponents([button]);
+ }
+ ButtonRows.push(row);
}
- ButtonRows.push(row);
- }
- 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.`);
- await client.guilds.fetch();
- const promises: Promise<Collection<string, ApplicationCommand>>[] = [];
- client.guilds.cache.each((guild) => {
- promises.push(guild.commands.set([]));
- });
- await Promise.all(promises);
+ 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.`);
+ await client.guilds.fetch();
+ const promises: Promise<Collection<string, ApplicationCommand>>[] = [];
+ client.guilds.cache.each((guild) => {
+ promises.push(guild.commands.set([]));
+ });
+ await Promise.all(promises);
- await client.application!.commands.fetch();
- await client.application!.commands.set([]);
+ await client.application!.commands.fetch();
+ await client.application!.commands.set([]);
- return await message.util.reply(`${util.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`);
- } 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.`);
- } else if (['modal'].includes(args.feature?.toLowerCase())) {
- const m = await message.util.reply({
- content: 'Click for modal',
- components: [
- new ActionRowBuilder<ButtonBuilder>().addComponents([
- new ButtonBuilder({ style: ButtonStyle.Primary, label: 'Modal', customId: 'test;modal' })
- ])
- ]
- });
+ return await message.util.reply(`${util.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`);
+ } 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.`);
+ } else if (['modal'].includes(args.feature?.toLowerCase())) {
+ const m = await message.util.reply({
+ content: 'Click for modal',
+ components: [
+ new ActionRowBuilder<ButtonBuilder>().addComponents([
+ new ButtonBuilder({ style: ButtonStyle.Primary, label: 'Modal', customId: 'test;modal' })
+ ])
+ ]
+ });
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
- client.ws.on(GatewayDispatchEvents.InteractionCreate, async (i: any) => {
- if (i?.data?.custom_id !== 'test;modal' || i?.data?.component_type !== 2) return;
- if (i?.message?.id !== m.id) return;
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
+ client.ws.on(GatewayDispatchEvents.InteractionCreate, async (i: any) => {
+ if (i?.data?.custom_id !== 'test;modal' || i?.data?.component_type !== 2) return;
+ if (i?.message?.id !== m.id) return;
- const text = { type: 4, style: 1, min_length: 1, max_length: 4000, required: true };
+ const text = { type: 4, style: 1, min_length: 1, max_length: 4000, required: true };
- await this.client.rest.post(Routes.interactionCallback(i.id, i.token), {
- body: {
- type: 9,
- data: {
- custom_id: 'test;login',
- title: 'Login (real)',
- components: [
- {
- type: 1,
- components: [
- {
- ...text,
- custom_id: 'test;login;email',
- label: 'Email',
- placeholder: 'Email'
- }
- ]
- },
- {
- type: 1,
- components: [
- {
- ...text,
- custom_id: 'test;login;password',
- label: 'Password',
- placeholder: 'Password'
- }
- ]
- },
- {
- type: 1,
- components: [
- {
- ...text,
- custom_id: 'test;login;2fa',
- label: 'Enter Discord Auth Code',
- min_length: 6,
- max_length: 6,
- placeholder: '6-digit authentication code'
- }
- ]
- }
- ]
+ await this.client.rest.post(Routes.interactionCallback(i.id, i.token), {
+ body: {
+ type: 9,
+ data: {
+ custom_id: 'test;login',
+ title: 'Login (real)',
+ components: [
+ {
+ type: 1,
+ components: [
+ {
+ ...text,
+ custom_id: 'test;login;email',
+ label: 'Email',
+ placeholder: 'Email'
+ }
+ ]
+ },
+ {
+ type: 1,
+ components: [
+ {
+ ...text,
+ custom_id: 'test;login;password',
+ label: 'Password',
+ placeholder: 'Password'
+ }
+ ]
+ },
+ {
+ type: 1,
+ components: [
+ {
+ ...text,
+ custom_id: 'test;login;2fa',
+ label: 'Enter Discord Auth Code',
+ min_length: 6,
+ max_length: 6,
+ placeholder: '6-digit authentication code'
+ }
+ ]
+ }
+ ]
+ }
}
- }
+ });
});
- });
- return;
+ return;
+ }
}
return await message.util.reply(responses[Math.floor(Math.random() * responses.length)]);
}