aboutsummaryrefslogtreecommitdiff
path: root/src/commands/dev
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/dev')
-rw-r--r--src/commands/dev/eval.ts14
-rw-r--r--src/commands/dev/javascript.ts4
-rw-r--r--src/commands/dev/servers.ts2
-rw-r--r--src/commands/dev/sh.ts4
-rw-r--r--src/commands/dev/test.ts51
5 files changed, 40 insertions, 35 deletions
diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts
index 8742246..a32aa8e 100644
--- a/src/commands/dev/eval.ts
+++ b/src/commands/dev/eval.ts
@@ -21,6 +21,7 @@ import { exec } from 'child_process';
import {
ActionRow,
ApplicationCommandOptionType,
+ Attachment,
ButtonComponent,
ButtonInteraction,
Collection,
@@ -29,12 +30,14 @@ import {
ContextMenuCommandInteraction,
DMChannel,
Embed,
+ EmbedBuilder,
Emoji,
Interaction,
InteractionCollector,
Message,
- MessageAttachment,
MessageCollector,
+ OAuth2Scopes,
+ PermissionFlagsBits,
PermissionsBitField,
ReactionCollector,
SelectMenuComponent,
@@ -54,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, MessageAttachment, MessageCollector, PermissionsBitField, ReactionCollector, SelectMenuComponent, Util, path, ts, fileURLToPath, promisify, assert, got, transpile, emojis, colors, sh, SnowflakeUtil, __dirname);
+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);
export default class EvalCommand extends BushCommand {
public constructor() {
@@ -226,7 +229,10 @@ export default class EvalCommand extends BushCommand {
lang: isTypescript ? ('ts' as const) : ('js' as const)
};
- const embed = new Embed().setFooter({ text: message.author.tag, iconURL: message.author.displayAvatarURL() ?? undefined });
+ const embed = new EmbedBuilder().setFooter({
+ text: message.author.tag,
+ iconURL: message.author.displayAvatarURL() ?? undefined
+ });
let err = false;
let rawResult: any;
@@ -316,4 +322,4 @@ interface CodeBlockCustomOptions extends CodeBlockOptions {
methods?: boolean;
}
-/** @typedef {ActivePunishment|Global|Guild|Level|ModLog|StickyRole|ButtonInteraction|Collection|Collector|CommandInteraction|ContextMenuCommandInteraction|DMChannel|Emoji|Interaction|InteractionCollector|Message|ActionRow|MessageAttachment|ButtonComponent|MessageCollector|SelectMenuComponent|ReactionCollector|Util|Canvas|Shared|PermissionsBitField|got} VSCodePleaseDontRemove */
+/** @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 b0ba0c4..046d9ab 100644
--- a/src/commands/dev/javascript.ts
+++ b/src/commands/dev/javascript.ts
@@ -1,6 +1,6 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
import assert from 'assert';
-import { ApplicationCommandOptionType, Embed } from 'discord.js';
+import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js';
import { VM } from 'vm2';
assert(VM);
@@ -53,7 +53,7 @@ export default class JavascriptCommand extends BushCommand {
await message.interaction.deferReply({ ephemeral: false });
}
const code = args.code.replace(/[“”]/g, '"').replace(/```*(?:js)?/g, '');
- const embed = new Embed();
+ const embed = new EmbedBuilder();
const input = await util.inspectCleanRedactCodeblock(code, 'js');
try {
diff --git a/src/commands/dev/servers.ts b/src/commands/dev/servers.ts
index dddbac4..72fc7d7 100644
--- a/src/commands/dev/servers.ts
+++ b/src/commands/dev/servers.ts
@@ -1,5 +1,5 @@
import { BushCommand, ButtonPaginator, type BushMessage, type BushSlashMessage } from '#lib';
-import type { APIEmbed } from 'discord-api-types/v9';
+import type { APIEmbed } from 'discord-api-types/v10';
import type { Guild } from 'discord.js';
export default class ServersCommand extends BushCommand {
diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts
index 7134b6b..f3fe86b 100644
--- a/src/commands/dev/sh.ts
+++ b/src/commands/dev/sh.ts
@@ -2,7 +2,7 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import assert from 'assert';
import chalk from 'chalk';
import { exec } from 'child_process';
-import { ApplicationCommandOptionType, Embed, Util } from 'discord.js';
+import { ApplicationCommandOptionType, EmbedBuilder, Util } from 'discord.js';
import { promisify } from 'util';
assert(chalk);
@@ -45,7 +45,7 @@ export default class ShCommand extends BushCommand {
return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`);
const input = clean(command);
- const embed = new Embed()
+ const embed = new EmbedBuilder()
.setColor(util.colors.gray)
.setFooter({ text: message.author.tag, iconURL: message.author.avatarURL() ?? undefined })
.setTimestamp()
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index 3f9cd80..deca6f1 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -1,14 +1,13 @@
import { BushCommand, ButtonPaginator, Shared, type BushMessage } from '#lib';
import { Routes } from 'discord-api-types/rest/v9';
import {
- ActionRow,
- ButtonComponent,
+ ActionRowBuilder,
+ ButtonBuilder,
ButtonStyle,
- Embed,
+ EmbedBuilder,
GatewayDispatchEvents,
type ApplicationCommand,
- type Collection,
- type MessageActionRowComponent
+ type Collection
} from 'discord.js';
import badLinksSecretArray from '../../lib/badlinks-secret.js';
import badLinksArray from '../../lib/badlinks.js';
@@ -53,16 +52,16 @@ export default class TestCommand extends BushCommand {
}
if (['button', 'buttons'].includes(args?.feature?.toLowerCase())) {
- const ButtonRow = new ActionRow().addComponents(
- new ButtonComponent({ style: ButtonStyle.Primary, customId: 'primaryButton', label: 'Primary' }),
- new ButtonComponent({ style: ButtonStyle.Secondary, customId: 'secondaryButton', label: 'Secondary' }),
- new ButtonComponent({ style: ButtonStyle.Success, customId: 'successButton', label: 'Success' }),
- new ButtonComponent({ style: ButtonStyle.Danger, customId: 'dangerButton', label: 'Danger' }),
- new ButtonComponent({ style: ButtonStyle.Link, label: 'Link', url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' })
+ 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] });
+ return await message.util.reply({ content: 'buttons', components: [buttonRow] });
} else if (['embed', 'button embed'].includes(args?.feature?.toLowerCase())) {
- const embed = new Embed()
+ 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)
@@ -76,26 +75,26 @@ export default class TestCommand extends BushCommand {
)
.setTitle('Title');
- const buttonRow = new ActionRow().addComponents(
- new ButtonComponent({ style: ButtonStyle.Link, label: 'Link', url: 'https://google.com/' })
+ 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: ActionRow<MessageActionRowComponent>[] = [];
+ const buttonRows: ActionRowBuilder<ButtonBuilder>[] = [];
for (let a = 1; a <= 5; a++) {
- const row = new ActionRow();
+ const row = new ActionRowBuilder<ButtonBuilder>();
for (let b = 1; b <= 5; b++) {
const id = (a + 5 * (b - 1)).toString();
- const button = new ButtonComponent({ style: ButtonStyle.Primary, customId: id, label: id });
+ 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 });
+ 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 Embed().setDescription(i.toString()));
+ embeds.push(new EmbedBuilder().setDescription(i.toString()));
}
return await ButtonPaginator.send(message, embeds);
} else if (['lots of embeds'].includes(args?.feature?.toLowerCase())) {
@@ -113,12 +112,12 @@ export default class TestCommand extends BushCommand {
const embeds = colors.map((c, i) => ({ ...o, title: `Embed Title ${i}`, color: c }));
- const ButtonRows: ActionRow<MessageActionRowComponent>[] = [];
+ const ButtonRows: ActionRowBuilder<ButtonBuilder>[] = [];
for (let a = 1; a <= 5; a++) {
- const row = new ActionRow();
+ const row = new ActionRowBuilder<ButtonBuilder>();
for (let b = 1; b <= 5; b++) {
const id = (a + 5 * (b - 1)).toString();
- const button = new ButtonComponent({ style: ButtonStyle.Secondary, customId: id, label: id });
+ const button = new ButtonBuilder({ style: ButtonStyle.Secondary, customId: id, label: id });
row.addComponents(button);
}
ButtonRows.push(row);
@@ -150,8 +149,8 @@ export default class TestCommand extends BushCommand {
const m = await message.util.reply({
content: 'Click for modal',
components: [
- new ActionRow().addComponents(
- new ButtonComponent({ style: ButtonStyle.Primary, label: 'Modal', customId: 'test;modal' })
+ new ActionRowBuilder<ButtonBuilder>().addComponents(
+ new ButtonBuilder({ style: ButtonStyle.Primary, label: 'Modal', customId: 'test;modal' })
)
]
});