mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 22:15:37 +00:00
fix: Add Open source button to /status
This commit is contained in:
1 parent
4f29399a8e
commit
fa84e2925e
5 files changed
+35
-4
No files matched your search
@@ -1,6 +1,15 @@
|
||||
// @ts-ignore
|
||||
import { version } from '../../../../package.json';
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import {
|
||||
APIActionRowComponent,
|
||||
APIButtonComponent,
|
||||
APIMessageActionRowComponent,
|
||||
ButtonBuilder,
|
||||
ButtonStyle,
|
||||
ComponentType,
|
||||
EmbedBuilder,
|
||||
SlashCommandBuilder
|
||||
} from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../../common/statusUtils';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
@@ -24,6 +33,22 @@ class StatusCommand extends BaseSlashCommandInteraction {
|
||||
]);
|
||||
const discordStatusEmbedString = getDiscordStatus(client!, translator);
|
||||
|
||||
const components: APIMessageActionRowComponent[] = [];
|
||||
if (this.botOptions.openSourceUrl && this.botOptions.openSourceUrl !== '') {
|
||||
const openSourceButton: APIButtonComponent = new ButtonBuilder()
|
||||
.setURL(this.botOptions.openSourceUrl)
|
||||
.setStyle(ButtonStyle.Link)
|
||||
.setEmoji(this.embedOptions.icons.openSource)
|
||||
.setLabel(translator('commands.status.openSourceButtonLabel'))
|
||||
.toJSON();
|
||||
components.push(openSourceButton);
|
||||
}
|
||||
|
||||
const embedActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
||||
type: ComponentType.ActionRow,
|
||||
components
|
||||
};
|
||||
|
||||
logger.debug('Responding with info embed.');
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
@@ -54,7 +79,8 @@ class StatusCommand extends BaseSlashCommandInteraction {
|
||||
}
|
||||
)
|
||||
.setColor(this.embedOptions.colors.info)
|
||||
]
|
||||
],
|
||||
components: components.length > 0 ? [embedActionRow] : []
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
@@ -5,6 +5,7 @@ export type BotOptions = {
|
||||
name: string;
|
||||
botInviteUrl: string;
|
||||
serverInviteUrl: string;
|
||||
openSourceUrl: string;
|
||||
};
|
||||
|
||||
export type CustomLoggerOptions = {
|
||||
@@ -49,6 +50,7 @@ export type EmbedOptions = {
|
||||
rule: string;
|
||||
support: string;
|
||||
bot: string;
|
||||
openSource: string;
|
||||
server: string;
|
||||
discord: string;
|
||||
audioPlaying: string;
|
||||
|
||||
Reference in new issue
Block a user