From 3985cdef0dd31d0cbd83a44e96999ef71ce09285 Mon Sep 17 00:00:00 2001 From: Szymon Pel Date: Tue, 3 Dec 2024 22:02:48 +0100 Subject: [PATCH] feat: create `SlashCommand` class --- src/structures/embed.ts | 2 +- src/structures/slashCommand.ts | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/structures/slashCommand.ts diff --git a/src/structures/embed.ts b/src/structures/embed.ts index e498f75..f079a34 100644 --- a/src/structures/embed.ts +++ b/src/structures/embed.ts @@ -15,7 +15,7 @@ export class Embed extends EmbedBuilder { * Sets default embed properties including author information if provided * @param author The Discord user to set as the embed author */ - setDefaults(author?: User) { + setDefaults(author?: User): Embed { if (!author) return this; const name = author.displayName === author.username ? author.username diff --git a/src/structures/slashCommand.ts b/src/structures/slashCommand.ts new file mode 100644 index 0000000..ac3381c --- /dev/null +++ b/src/structures/slashCommand.ts @@ -0,0 +1,22 @@ +import { + ApplicationIntegrationType, + InteractionContextType, + SlashCommandBuilder, +} from "discord.js"; + +export class SlashCommand extends SlashCommandBuilder { + public constructor() { + super(); + + this.setDescription("..."); + + this.setContexts( + InteractionContextType.Guild, + InteractionContextType.BotDM, + InteractionContextType.PrivateChannel, + ).setIntegrationTypes( + ApplicationIntegrationType.GuildInstall, + ApplicationIntegrationType.UserInstall, + ); + } +}