fix: Extract logic for getting author value for embeds

This commit is contained in:
Marius Begby committed 2023-09-05 21:52:03 +02:00
1 parent 8c05499f08
commit 83e23d87b4
60 files changed
+126 -317

No files matched your search

+12 -1
View File
@@ -1,4 +1,5 @@
import config from 'config';
import { GuildQueue } from 'discord-player';
import {
ApplicationCommandOptionChoiceData,
AutocompleteInteraction,
@@ -64,7 +65,7 @@ abstract class BaseInteractionWithEmbedResponse extends BaseInteraction {
this.botOptions = config.get('botOptions');
}
protected async getEmbedAuthor(
protected async getEmbedUserAuthor(
interaction: MessageComponentInteraction | ChatInputCommandInteraction
): Promise<EmbedAuthorOptions> {
let authorName: string = '';
@@ -79,6 +80,16 @@ abstract class BaseInteractionWithEmbedResponse extends BaseInteraction {
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
};
}
protected async getEmbedQueueAuthor(
interaction: MessageComponentInteraction | ChatInputCommandInteraction,
queue: GuildQueue
): Promise<EmbedAuthorOptions> {
return {
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
iconURL: interaction.guild!.iconURL() || this.embedOptions.info.fallbackIconUrl
};
}
}
export abstract class BaseSlashCommandInteraction extends BaseInteractionWithEmbedResponse {