mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 22:15:29 +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
+2
-1
@@ -293,7 +293,8 @@
|
|||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "status",
|
"name": "status",
|
||||||
"description": "Show operational status of the bot."
|
"description": "Show operational status of the bot."
|
||||||
}
|
},
|
||||||
|
"openSourceButtonLabel": "GitHub"
|
||||||
},
|
},
|
||||||
"stop": {
|
"stop": {
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
|||||||
+2
-1
@@ -293,7 +293,8 @@
|
|||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "status",
|
"name": "status",
|
||||||
"description": "Vis driftsstatus for botten."
|
"description": "Vis driftsstatus for botten."
|
||||||
}
|
},
|
||||||
|
"openSourceButtonLabel": "GitHub"
|
||||||
},
|
},
|
||||||
"stop": {
|
"stop": {
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
|||||||
Vendored
+1
@@ -295,6 +295,7 @@ interface Resources {
|
|||||||
name: 'status';
|
name: 'status';
|
||||||
description: 'Show operational status of the bot.';
|
description: 'Show operational status of the bot.';
|
||||||
};
|
};
|
||||||
|
openSourceButtonLabel: 'GitHub';
|
||||||
};
|
};
|
||||||
stop: {
|
stop: {
|
||||||
metadata: {
|
metadata: {
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { version } from '../../../../package.json';
|
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 { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||||
import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../../common/statusUtils';
|
import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../../common/statusUtils';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||||
@@ -24,6 +33,22 @@ class StatusCommand extends BaseSlashCommandInteraction {
|
|||||||
]);
|
]);
|
||||||
const discordStatusEmbedString = getDiscordStatus(client!, translator);
|
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.');
|
logger.debug('Responding with info embed.');
|
||||||
return await interaction.editReply({
|
return await interaction.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
@@ -54,7 +79,8 @@ class StatusCommand extends BaseSlashCommandInteraction {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.setColor(this.embedOptions.colors.info)
|
.setColor(this.embedOptions.colors.info)
|
||||||
]
|
],
|
||||||
|
components: components.length > 0 ? [embedActionRow] : []
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
@@ -5,6 +5,7 @@ export type BotOptions = {
|
|||||||
name: string;
|
name: string;
|
||||||
botInviteUrl: string;
|
botInviteUrl: string;
|
||||||
serverInviteUrl: string;
|
serverInviteUrl: string;
|
||||||
|
openSourceUrl: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CustomLoggerOptions = {
|
export type CustomLoggerOptions = {
|
||||||
@@ -49,6 +50,7 @@ export type EmbedOptions = {
|
|||||||
rule: string;
|
rule: string;
|
||||||
support: string;
|
support: string;
|
||||||
bot: string;
|
bot: string;
|
||||||
|
openSource: string;
|
||||||
server: string;
|
server: string;
|
||||||
discord: string;
|
discord: string;
|
||||||
audioPlaying: string;
|
audioPlaying: string;
|
||||||
|
|||||||
Reference in new issue
Block a user