From 5bb25e030da06cadefdee41fbe28f2516dcdb972 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Tue, 5 Sep 2023 12:18:32 +0200 Subject: [PATCH] deleted --- src/classes/embeds.ts | 54 -------------------------- src/interactions/commands/info/test.ts | 42 -------------------- 2 files changed, 96 deletions(-) delete mode 100644 src/classes/embeds.ts delete mode 100644 src/interactions/commands/info/test.ts diff --git a/src/classes/embeds.ts b/src/classes/embeds.ts deleted file mode 100644 index 576bb7d..0000000 --- a/src/classes/embeds.ts +++ /dev/null @@ -1,54 +0,0 @@ -import config from 'config'; -import { - ChatInputCommandInteraction, - EmbedAuthorData, - EmbedBuilder, - EmbedFooterData, - InteractionResponse, - Message, - MessageComponentInteraction, - EmbedField -} from 'discord.js'; -import { EmbedOptions } from '../types/configTypes'; - -export type EmbedContext = { - author?: EmbedAuthorData; - title?: string; - description: string; - footer?: EmbedFooterData; - thumbnail?: string; - fields?: EmbedField[]; -}; - -abstract class BaseEmbed { - embedOptions: EmbedOptions; - context: EmbedContext; - interaction: ChatInputCommandInteraction | MessageComponentInteraction; - embed: EmbedBuilder; - - constructor(interaction: ChatInputCommandInteraction | MessageComponentInteraction, context: EmbedContext) { - this.embedOptions = config.get('embedOptions'); - this.context = context; - this.interaction = interaction; - this.embed = new EmbedBuilder(); - this.embed.setDescription(`${context.title ? `**${context.title}**\n` : ''}${context.description}`); - context.author && this.embed.setAuthor(context.author); - context.footer && this.embed.setFooter(context.footer); - context.thumbnail && this.embed.setThumbnail(context.thumbnail); - } - - abstract send(): Promise | InteractionResponse>; -} - -export class InfoEmbed extends BaseEmbed { - constructor(interaction: ChatInputCommandInteraction | MessageComponentInteraction, context: EmbedContext) { - super(interaction, context); - - this.embed.setColor(this.embedOptions.colors.info); - } - - async send(): Promise> { - const embeds = { embeds: [this.embed] }; - return await this.interaction.editReply(embeds); - } -} diff --git a/src/interactions/commands/info/test.ts b/src/interactions/commands/info/test.ts deleted file mode 100644 index 0d1472a..0000000 --- a/src/interactions/commands/info/test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { SlashCommandBuilder } from 'discord.js'; -import { EmbedContext, InfoEmbed } from '../../../classes/embeds'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; - -class TestCommand extends BaseSlashCommandInteraction { - constructor() { - const data = new SlashCommandBuilder().setName('test').setDescription('Test command.'); - super(data); - } - - async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType { - const { executionId, interaction } = params; - const logger = this.getLogger(this.name, executionId, interaction); - - const embedContext: EmbedContext = { - title: 'Test title', - description: 'This is a test embed.', - author: { - name: 'Test author', - iconURL: 'https://cdn.discordapp.com/embed/avatars/0.png' - }, - footer: { - text: 'Test footer', - iconURL: 'https://cdn.discordapp.com/embed/avatars/0.png' - }, - thumbnail: 'https://cdn.discordapp.com/embed/avatars/0.png', - fields: [ - { - name: 'Test field', - value: 'Test field value', - inline: false - } - ] - }; - - logger.debug('Responding with info embed.'); - return new InfoEmbed(interaction, embedContext).send(); - } -} - -export default new TestCommand();