diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/config/config.ts | 2 | ||||
-rw-r--r-- | src/commands/config/features.ts | 29 | ||||
-rw-r--r-- | src/commands/dev/test.ts | 18 | ||||
-rw-r--r-- | src/commands/info/help.ts | 6 | ||||
-rw-r--r-- | src/commands/info/links.ts | 6 | ||||
-rw-r--r-- | src/lib/common/AutoMod.ts | 29 | ||||
-rw-r--r-- | src/lib/common/ButtonPaginator.ts | 55 | ||||
-rw-r--r-- | src/lib/common/ConfirmationPrompt.ts | 4 | ||||
-rw-r--r-- | src/lib/common/DeleteButton.ts | 11 | ||||
-rw-r--r-- | src/lib/common/util/Moderation.ts | 11 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClient.ts | 34 | ||||
-rw-r--r-- | src/lib/models/instance/Guild.ts | 83 | ||||
-rw-r--r-- | src/listeners/ws/INTERACTION_CREATE.ts | 25 |
13 files changed, 137 insertions, 176 deletions
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index f860b30..6cb493d 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -358,7 +358,7 @@ export default class ConfigCommand extends BushCommand { }; const components = new ActionRow().addComponents( - new ButtonComponent().setStyle(ButtonStyle.Primary).setCustomId('command_settingsBack').setLabel('Back') + new ButtonComponent({ style: ButtonStyle.Primary, customId: 'command_settingsBack', label: 'Back' }) ); settingsEmbed.setDescription( `${Formatters.italic(guildSettingsObj[setting].description)}\n\n**Type:** ${guildSettingsObj[setting].type}` diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts index c9aebd3..c022a3a 100644 --- a/src/commands/config/features.ts +++ b/src/commands/config/features.ts @@ -13,7 +13,6 @@ import { Embed, PermissionFlagsBits, SelectMenuComponent, - SelectMenuOption, type Message, type SelectMenuInteraction } from 'discord.js'; @@ -85,21 +84,19 @@ export default class FeaturesCommand extends BushCommand { public generateComponents(guildFeatures: GuildFeatures[], disable: boolean) { return new ActionRow().addComponents( - new SelectMenuComponent() - .setCustomId('command_selectFeature') - .setDisabled(disable) - .setMaxValues(1) - .setMinValues(1) - .setOptions( - ...guildFeatures - .filter((f) => guildFeaturesObj[f].notConfigurable !== false) - .map((f) => - new SelectMenuOption() - .setLabel(guildFeaturesObj[f].name) - .setValue(f) - .setDescription(guildFeaturesObj[f].description) - ) - ) + new SelectMenuComponent({ + customId: 'command_selectFeature', + disabled: disable, + maxValues: 1, + minValues: 1, + options: guildFeatures + .filter((f) => !guildFeaturesObj[f].hidden) + .map((f) => ({ + label: guildFeaturesObj[f].name, + value: f, + description: guildFeaturesObj[f].description + })) + }) ); } } diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index 7bab0a1..8c76ded 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -54,11 +54,11 @@ export default class TestCommand extends BushCommand { if (['button', 'buttons'].includes(args?.feature?.toLowerCase())) { const ButtonRow = new ActionRow().addComponents( - new ButtonComponent().setStyle(ButtonStyle.Primary).setCustomId('primaryButton').setLabel('Primary'), - new ButtonComponent().setStyle(ButtonStyle.Secondary).setCustomId('secondaryButton').setLabel('Secondary'), - new ButtonComponent().setStyle(ButtonStyle.Success).setCustomId('successButton').setLabel('Success'), - new ButtonComponent().setStyle(ButtonStyle.Danger).setCustomId('dangerButton').setLabel('Danger'), - new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('Link').setURL('https://www.youtube.com/watch?v=dQw4w9WgXcQ') + 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' }) ); return await message.util.reply({ content: 'buttons', components: [ButtonRow] }); } else if (['embed', 'button embed'].includes(args?.feature?.toLowerCase())) { @@ -77,7 +77,7 @@ export default class TestCommand extends BushCommand { .setTitle('Title'); const buttonRow = new ActionRow().addComponents( - new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('Link').setURL('https://google.com/') + new ButtonComponent({ 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())) { @@ -86,7 +86,7 @@ export default class TestCommand extends BushCommand { const row = new ActionRow(); for (let b = 1; b <= 5; b++) { const id = (a + 5 * (b - 1)).toString(); - const button = new ButtonComponent().setStyle(ButtonStyle.Primary).setCustomId(id).setLabel(id); + const button = new ButtonComponent({ style: ButtonStyle.Primary, customId: id, label: id }); row.addComponents(button); } ButtonRows.push(row); @@ -118,7 +118,7 @@ export default class TestCommand extends BushCommand { const row = new ActionRow(); for (let b = 1; b <= 5; b++) { const id = (a + 5 * (b - 1)).toString(); - const button = new ButtonComponent().setStyle(ButtonStyle.Secondary).setCustomId(id).setLabel(id); + const button = new ButtonComponent({ style: ButtonStyle.Secondary, customId: id, label: id }); row.addComponents(button); } ButtonRows.push(row); @@ -151,7 +151,7 @@ export default class TestCommand extends BushCommand { content: 'Click for modal', components: [ new ActionRow().addComponents( - new ButtonComponent().setStyle(ButtonStyle.Primary).setLabel('Modal').setCustomId('test;modal') + new ButtonComponent({ style: ButtonStyle.Primary, label: 'Modal', customId: 'test;modal' }) ) ] }); diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index 2383566..15c447a 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -143,15 +143,15 @@ export default class HelpCommand extends BushCommand { const row = new ActionRow(); if (!client.config.isDevelopment && !client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) { - row.addComponents(new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('Invite Me').setURL(util.invite)); + row.addComponents(new ButtonComponent({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite })); } if (!client.guilds.cache.get(client.config.supportGuild.id)?.members.cache.has(message.author.id)) { row.addComponents( - new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('Support Server').setURL(client.config.supportGuild.invite) + new ButtonComponent({ style: ButtonStyle.Link, label: 'Support Server', url: client.config.supportGuild.invite }) ); } if (packageDotJSON?.repository) - row.addComponents(new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('GitHub').setURL(packageDotJSON.repository)); + row.addComponents(new ButtonComponent({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository })); else void message.channel?.send('Error importing package.json, please report this to my developer.'); return row; diff --git a/src/commands/info/links.ts b/src/commands/info/links.ts index d91f1e7..e14195e 100644 --- a/src/commands/info/links.ts +++ b/src/commands/info/links.ts @@ -22,11 +22,11 @@ export default class LinksCommand extends BushCommand { public override async exec(message: BushMessage | BushSlashMessage) { const buttonRow = new ActionRow(); if (!client.config.isDevelopment || message.author.isOwner()) { - buttonRow.addComponents(new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('Invite Me').setURL(util.invite)); + buttonRow.addComponents(new ButtonComponent({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite })); } buttonRow.addComponents( - new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('Support Server').setURL(client.config.supportGuild.invite), - new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('GitHub').setURL(packageDotJSON.repository) + new ButtonComponent({ style: ButtonStyle.Link, label: 'Support Server', url: client.config.supportGuild.invite }), + new ButtonComponent({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository }) ); return await message.util.reply({ content: 'Here are some useful links:', components: [buttonRow] }); } diff --git a/src/lib/common/AutoMod.ts b/src/lib/common/AutoMod.ts index d043ef0..93d2f8f 100644 --- a/src/lib/common/AutoMod.ts +++ b/src/lib/common/AutoMod.ts @@ -162,17 +162,15 @@ export class AutoMod { .setColor(color) .setTimestamp() ], - components: - Severity.TEMP_MUTE >= 2 - ? [ - new ActionRow().addComponents( - new ButtonComponent() - .setStyle(ButtonStyle.Danger) - .setLabel('Ban User') - .setCustomId(`automod;ban;${this.message.author.id};everyone mention and scam phrase`) - ) - ] - : undefined + components: [ + new ActionRow().addComponents( + new ButtonComponent({ + style: ButtonStyle.Danger, + label: 'Ban User', + customId: `automod;ban;${this.message.author.id};everyone mention and scam phrase` + }) + ) + ] }); } } @@ -334,10 +332,11 @@ export class AutoMod { highestOffence.severity >= 2 ? [ new ActionRow().addComponents( - new ButtonComponent() - .setStyle(ButtonStyle.Danger) - .setLabel('Ban User') - .setCustomId(`automod;ban;${this.message.author.id};${highestOffence.reason}`) + new ButtonComponent({ + style: ButtonStyle.Danger, + label: 'Ban User', + customId: `automod;ban;${this.message.author.id};${highestOffence.reason}` + }) ) ] : undefined diff --git a/src/lib/common/ButtonPaginator.ts b/src/lib/common/ButtonPaginator.ts index a289855..15c07fa 100644 --- a/src/lib/common/ButtonPaginator.ts +++ b/src/lib/common/ButtonPaginator.ts @@ -172,31 +172,36 @@ export class ButtonPaginator { */ protected getPaginationRow(disableAll = false): ActionRow<ActionRowComponent> { return new ActionRow().addComponents( - new ButtonComponent() - .setStyle(ButtonStyle.Primary) - .setCustomId('paginate_beginning') - .setEmoji(PaginateEmojis.BEGINNING) - .setDisabled(disableAll || this.curPage === 0), - new ButtonComponent() - .setStyle(ButtonStyle.Primary) - .setCustomId('paginate_back') - .setEmoji(PaginateEmojis.BACK) - .setDisabled(disableAll || this.curPage === 0), - new ButtonComponent() - .setStyle(ButtonStyle.Primary) - .setCustomId('paginate_stop') - .setEmoji(PaginateEmojis.STOP) - .setDisabled(disableAll), - new ButtonComponent() - .setStyle(ButtonStyle.Primary) - .setCustomId('paginate_next') - .setEmoji(PaginateEmojis.FORWARD) - .setDisabled(disableAll || this.curPage === this.embeds.length - 1), - new ButtonComponent() - .setStyle(ButtonStyle.Primary) - .setCustomId('paginate_end') - .setEmoji(PaginateEmojis.END) - .setDisabled(disableAll || this.curPage === this.embeds.length - 1) + new ButtonComponent({ + style: ButtonStyle.Primary, + customId: 'paginate_beginning', + emoji: PaginateEmojis.BEGINNING, + disabled: disableAll || this.curPage === 0 + }), + new ButtonComponent({ + style: ButtonStyle.Primary, + customId: 'paginate_back', + emoji: PaginateEmojis.BACK, + disabled: disableAll || this.curPage === 0 + }), + new ButtonComponent({ + style: ButtonStyle.Primary, + customId: 'paginate_stop', + emoji: PaginateEmojis.STOP, + disabled: disableAll + }), + new ButtonComponent({ + style: ButtonStyle.Primary, + customId: 'paginate_next', + emoji: PaginateEmojis.FORWARD, + disabled: disableAll || this.curPage === this.numPages - 1 + }), + new ButtonComponent({ + style: ButtonStyle.Primary, + customId: 'paginate_end', + emoji: PaginateEmojis.END, + disabled: disableAll || this.curPage === this.numPages - 1 + }) ); } diff --git a/src/lib/common/ConfirmationPrompt.ts b/src/lib/common/ConfirmationPrompt.ts index b775640..4ff00ce 100644 --- a/src/lib/common/ConfirmationPrompt.ts +++ b/src/lib/common/ConfirmationPrompt.ts @@ -30,8 +30,8 @@ export class ConfirmationPrompt { protected async send(): Promise<boolean> { this.messageOptions.components = [ new ActionRow().addComponents( - new ButtonComponent().setStyle(ButtonStyle.Success).setCustomId('confirmationPrompt_confirm').setLabel('Yes'), - new ButtonComponent().setStyle(ButtonStyle.Danger).setCustomId('confirmationPrompt_cancel').setLabel('No') + new ButtonComponent({ style: ButtonStyle.Success, customId: 'confirmationPrompt_confirm', label: 'Yes' }), + new ButtonComponent({ style: ButtonStyle.Danger, customId: 'confirmationPrompt_cancel', label: 'No' }) ) ]; diff --git a/src/lib/common/DeleteButton.ts b/src/lib/common/DeleteButton.ts index cf3b416..0a9fd79 100644 --- a/src/lib/common/DeleteButton.ts +++ b/src/lib/common/DeleteButton.ts @@ -67,11 +67,12 @@ export class DeleteButton { protected updateComponents(edit = false, disable = false): void { this.messageOptions.components = [ new ActionRow().addComponents( - new ButtonComponent() - .setStyle(ButtonStyle.Primary) - .setCustomId('paginate__stop') - .setEmoji(PaginateEmojis.STOP) - .setDisabled(disable) + new ButtonComponent({ + style: ButtonStyle.Primary, + customId: 'paginate__stop', + emoji: PaginateEmojis.STOP, + disabled: disable + }) ) ]; if (edit) { diff --git a/src/lib/common/util/Moderation.ts b/src/lib/common/util/Moderation.ts index 365dbd5..afe220c 100644 --- a/src/lib/common/util/Moderation.ts +++ b/src/lib/common/util/Moderation.ts @@ -11,7 +11,7 @@ import { type ModLogType } from '#lib'; import assert from 'assert'; -import { ActionRow, ButtonComponent, ButtonStyle, ComponentType, Embed, PermissionFlagsBits, type Snowflake } from 'discord.js'; +import { ActionRow, ButtonComponent, ButtonStyle, Embed, PermissionFlagsBits, type Snowflake } from 'discord.js'; enum punishMap { 'warned' = 'warn', @@ -289,13 +289,12 @@ export class Moderation { new ActionRow({ components: [ new ButtonComponent({ - custom_id: `appeal;${this.punishmentToPresentTense(options.punishment)};${ - options.guild.id - };${client.users.resolveId(options.user)};${options.modlog}`, + customId: `appeal;${this.punishmentToPresentTense(options.punishment)};${options.guild.id};${client.users.resolveId( + options.user + )};${options.modlog}`, style: ButtonStyle.Primary, - type: ComponentType.Button, label: 'Appeal' - }) + }).toJSON() ] }) ]; diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index fa6dc53..1a748ed 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -10,7 +10,7 @@ import { roleWithDuration, snowflake } from '#args'; -import { +import type { BushBaseGuildEmojiManager, BushChannelManager, BushClientEvents, @@ -23,6 +23,7 @@ import { import { patch, type PatchedElements } from '@notenoughupdates/events-intercept'; import * as Sentry from '@sentry/node'; import { AkairoClient, ContextMenuCommandHandler, version as akairoVersion } from 'discord-akairo'; +import { GatewayIntentBits } from 'discord-api-types/v9'; import { ActivityType, Options, @@ -42,7 +43,6 @@ import { } from 'discord.js'; import EventEmitter from 'events'; import { google } from 'googleapis'; -import snakeCase from 'lodash.snakecase'; import path from 'path'; import readline from 'readline'; import type { Options as SequelizeOptions, Sequelize as SequelizeType } from 'sequelize'; @@ -213,9 +213,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re allowedMentions: AllowedMentions.users(), // No everyone or role mentions by default makeCache: Options.cacheWithLimits({}), failIfNotExists: false, - rest: { api: 'https://canary.discord.com/api' }, - // todo: remove this when https://github.com/discordjs/discord.js/pull/7497 is merged - jsonTransformer + rest: { api: 'https://canary.discord.com/api' } }); patch(this); @@ -527,29 +525,3 @@ export interface BushStats { */ commandsUsed: bigint; } - -// exported as const enum from discord-api-types -enum GatewayIntentBits { - Guilds = 1, - GuildMembers = 2, - GuildBans = 4, - GuildEmojisAndStickers = 8, - GuildIntegrations = 16, - GuildWebhooks = 32, - GuildInvites = 64, - GuildVoiceStates = 128, - GuildPresences = 256, - GuildMessages = 512, - GuildMessageReactions = 1024, - GuildMessageTyping = 2048, - DirectMessages = 4096, - DirectMessageReactions = 8192, - DirectMessageTyping = 16384, - GuildScheduledEvents = 65536 -} - -function jsonTransformer(obj: any): any { - if (typeof obj !== 'object' || !obj) return obj; - if (Array.isArray(obj)) return obj.map(jsonTransformer); - return Object.fromEntries(Object.entries(obj).map(([key, value]) => [snakeCase(key), jsonTransformer(value)])); -} diff --git a/src/lib/models/instance/Guild.ts b/src/lib/models/instance/Guild.ts index 7fe7ac1..5fb507a 100644 --- a/src/lib/models/instance/Guild.ts +++ b/src/lib/models/instance/Guild.ts @@ -311,77 +311,81 @@ interface GuildFeature { name: string; description: string; default: boolean; - notConfigurable?: boolean; + hidden: boolean; } -const asGuildFeature = <T>(gf: { [K in keyof T]: GuildFeature }) => gf; + +type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>; + +const asGuildFeature = <T>(gf: { [K in keyof T]: PartialBy<GuildFeature, 'hidden' | 'default'> }): { + [K in keyof T]: GuildFeature; +} => { + for (const key in gf) { + gf[key].hidden ??= false; + gf[key].default ??= false; + } + return gf as { [K in keyof T]: GuildFeature }; +}; export const guildFeaturesObj = asGuildFeature({ automod: { name: 'Automod', - description: 'Deletes offensive content as well as phishing links.', - default: false + description: 'Deletes offensive content as well as phishing links.' }, excludeDefaultAutomod: { name: 'Exclude Default Automod', - description: 'Opt out of using the default automod options.', - default: false + description: 'Opt out of using the default automod options.' }, excludeAutomodScamLinks: { name: 'Exclude Automod Scam Links', - description: 'Opt out of having automod delete scam links.', - default: false + description: 'Opt out of having automod delete scam links.' }, delScamMentions: { name: 'Delete Scam Mentions', - description: 'Deletes messages with @everyone and @here mentions that have common scam phrases.', - default: false + description: 'Deletes messages with @everyone and @here mentions that have common scam phrases.' + }, + blacklistedFile: { + name: 'Blacklisted File', + description: 'Automatically deletes malicious files.' }, autoPublish: { name: 'Auto Publish', - description: 'Publishes messages in configured announcement channels.', - default: false + description: 'Publishes messages in configured announcement channels.' }, // todo implement a better auto thread system autoThread: { name: 'Auto Thread', description: 'Creates a new thread for messages in configured channels.', - default: false, - notConfigurable: true + hidden: true }, - blacklistedFile: { - name: 'Blacklisted File', - description: 'Automatically deletes malicious files.', - default: false + perspectiveApi: { + name: 'Perspective API', + description: 'Use the Perspective API to detect toxicity.', + hidden: true }, boosterMessageReact: { name: 'Booster Message React', - description: 'Reacts to booster messages with the boost emoji.', - default: false + description: 'Reacts to booster messages with the boost emoji.' }, leveling: { name: 'Leveling', - description: "Tracks users' messages and assigns them xp.", - default: false + description: "Tracks users' messages and assigns them xp." + }, + sendLevelUpMessages: { + name: 'Send Level Up Messages', + description: 'Send a message when a user levels up.', + default: true }, stickyRoles: { name: 'Sticky Roles', - description: 'Restores past roles to a user when they rejoin.', - default: false + description: 'Restores past roles to a user when they rejoin.' }, reporting: { name: 'Reporting', - description: 'Allow users to make reports.', - default: false + description: 'Allow users to make reports.' }, modsCanPunishMods: { name: 'Mods Can Punish Mods', - description: 'Allow moderators to punish other moderators.', - default: false - }, - sendLevelUpMessages: { - name: 'Send Level Up Messages', - description: 'Send a message when a user levels up.', - default: true + description: 'Allow moderators to punish other moderators.' }, logManualPunishments: { name: 'Log Manual Punishments', @@ -391,14 +395,7 @@ export const guildFeaturesObj = asGuildFeature({ punishmentAppeals: { name: 'Punishment Appeals', description: 'Allow users to appeal their punishments and send the appeal to the configured channel.', - default: false, - notConfigurable: true - }, - perspectiveApi: { - name: 'Perspective API', - description: 'Use the Perspective API to detect toxicity.', - default: false, - notConfigurable: true + hidden: true }, highlight: { name: 'Highlight', @@ -437,4 +434,6 @@ export const guildLogsArr = Object.keys(guildLogsObj).filter( type LogChannelDB = { [x in keyof typeof guildLogsObj]?: Snowflake }; export type GuildFeatures = keyof typeof guildFeaturesObj; -export const guildFeaturesArr: GuildFeatures[] = Object.keys(guildFeaturesObj) as GuildFeatures[]; +export const guildFeaturesArr: GuildFeatures[] = Object.keys(guildFeaturesObj).filter( + (f) => !guildFeaturesObj[f as keyof typeof guildFeaturesObj].hidden +) as GuildFeatures[]; diff --git a/src/listeners/ws/INTERACTION_CREATE.ts b/src/listeners/ws/INTERACTION_CREATE.ts index 25d9cfe..1c79406 100644 --- a/src/listeners/ws/INTERACTION_CREATE.ts +++ b/src/listeners/ws/INTERACTION_CREATE.ts @@ -1,30 +1,22 @@ import { BushListener, BushUser, Moderation, ModLog, PunishmentTypePresent } from '#lib'; import assert from 'assert'; -import { TextInputStyle } from 'discord-api-types-next/v9'; import { - APIBaseInteraction, APIEmbed, - APIInteraction as DiscordAPITypesAPIInteraction, + APIInteraction, APIInteractionResponseChannelMessageWithSource, APIInteractionResponseDeferredMessageUpdate, APIInteractionResponseUpdateMessage, APIModalInteractionResponse, - APIModalSubmission, ButtonStyle, ComponentType, GatewayDispatchEvents, InteractionResponseType, InteractionType, - Routes + Routes, + TextInputStyle } from 'discord-api-types/v9'; import { ActionRow, ButtonComponent, Embed, Snowflake } from 'discord.js'; -// todo: use from discord-api-types once updated -export type APIModalSubmitInteraction = APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission> & - Required<Pick<APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission>, 'data'>>; - -export type APIInteraction = DiscordAPITypesAPIInteraction | APIModalSubmitInteraction; - export default class WsInteractionCreateListener extends BushListener { public constructor() { super('wsInteractionCreate', { @@ -222,19 +214,16 @@ export default class WsInteractionCreateListener extends BushListener { const components = [ new ActionRow({ - type: 1, components: [ new ButtonComponent({ - type: 2, - custom_id: `appeal_accept;${punishment};${guildId};${userId};${modlogCase}`, + customId: `appeal_accept;${punishment};${guildId};${userId};${modlogCase}`, label: 'Accept', - style: 3 /* Success */ + style: ButtonStyle.Success }).toJSON(), new ButtonComponent({ - type: 2, - custom_id: `appeal_deny;${punishment};${guildId};${userId};${modlogCase}`, + customId: `appeal_deny;${punishment};${guildId};${userId};${modlogCase}`, label: 'Deny', - style: 4 /* Danger */ + style: ButtonStyle.Danger }).toJSON() ] }) |