mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 22:15:29 +00:00
feat: Add new config option to enable/disable button labels
This commit is contained in:
1 parent
82927c5880
commit
47d3c36cc7
6 files changed
+28
-10
No files matched your search
@@ -65,6 +65,9 @@ module.exports.embedOptions = {
|
|||||||
info: '#5865F2',
|
info: '#5865F2',
|
||||||
note: '#80848E'
|
note: '#80848E'
|
||||||
},
|
},
|
||||||
|
components: {
|
||||||
|
showButtonLabels: false
|
||||||
|
},
|
||||||
icons: {
|
icons: {
|
||||||
logo: '🤖',
|
logo: '🤖',
|
||||||
beta: '`beta`',
|
beta: '`beta`',
|
||||||
|
|||||||
@@ -194,11 +194,14 @@ class FiltersCommand extends BaseSlashCommandInteraction {
|
|||||||
|
|
||||||
const disableButton: APIButtonComponent = new ButtonBuilder()
|
const disableButton: APIButtonComponent = new ButtonBuilder()
|
||||||
.setCustomId('filters-disable-button')
|
.setCustomId('filters-disable-button')
|
||||||
.setLabel('Disable all filters')
|
|
||||||
.setStyle(ButtonStyle.Secondary)
|
.setStyle(ButtonStyle.Secondary)
|
||||||
.setEmoji(this.embedOptions.icons.disable)
|
.setEmoji(this.embedOptions.icons.disable)
|
||||||
.toJSON();
|
.toJSON();
|
||||||
|
|
||||||
|
if (this.embedOptions.components.showButtonLabels) {
|
||||||
|
disableButton.label = 'Disable all filters';
|
||||||
|
}
|
||||||
|
|
||||||
const disableFiltersActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
const disableFiltersActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
||||||
type: ComponentType.ActionRow,
|
type: ComponentType.ActionRow,
|
||||||
components: [disableButton]
|
components: [disableButton]
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ class HistoryCommand extends BaseSlashCommandInteraction {
|
|||||||
const previousButton: APIButtonComponent = new ButtonBuilder()
|
const previousButton: APIButtonComponent = new ButtonBuilder()
|
||||||
.setDisabled(queue.history.tracks.data.length > 0 ? false : true)
|
.setDisabled(queue.history.tracks.data.length > 0 ? false : true)
|
||||||
.setCustomId(`action-previous-button_${currentTrack.id}`)
|
.setCustomId(`action-previous-button_${currentTrack.id}`)
|
||||||
.setLabel('Previous')
|
|
||||||
.setStyle(ButtonStyle.Secondary)
|
.setStyle(ButtonStyle.Secondary)
|
||||||
.setEmoji(this.embedOptions.icons.previousTrack)
|
.setEmoji(this.embedOptions.icons.previousTrack)
|
||||||
.toJSON();
|
.toJSON();
|
||||||
@@ -88,7 +87,6 @@ class HistoryCommand extends BaseSlashCommandInteraction {
|
|||||||
|
|
||||||
const playPauseButton: APIButtonComponent = new ButtonBuilder()
|
const playPauseButton: APIButtonComponent = new ButtonBuilder()
|
||||||
.setCustomId(`action-pauseresume-button_${currentTrack.id}`)
|
.setCustomId(`action-pauseresume-button_${currentTrack.id}`)
|
||||||
.setLabel(queue.node.isPaused() ? 'Resume' : 'Pause')
|
|
||||||
.setStyle(ButtonStyle.Secondary)
|
.setStyle(ButtonStyle.Secondary)
|
||||||
.setEmoji(this.embedOptions.icons.pauseResumeTrack)
|
.setEmoji(this.embedOptions.icons.pauseResumeTrack)
|
||||||
.toJSON();
|
.toJSON();
|
||||||
@@ -96,12 +94,17 @@ class HistoryCommand extends BaseSlashCommandInteraction {
|
|||||||
|
|
||||||
const skipButton: APIButtonComponent = new ButtonBuilder()
|
const skipButton: APIButtonComponent = new ButtonBuilder()
|
||||||
.setCustomId(`action-skip-button_${currentTrack.id}`)
|
.setCustomId(`action-skip-button_${currentTrack.id}`)
|
||||||
.setLabel('Skip')
|
|
||||||
.setStyle(ButtonStyle.Secondary)
|
.setStyle(ButtonStyle.Secondary)
|
||||||
.setEmoji(this.embedOptions.icons.nextTrack)
|
.setEmoji(this.embedOptions.icons.nextTrack)
|
||||||
.toJSON();
|
.toJSON();
|
||||||
components.push(skipButton);
|
components.push(skipButton);
|
||||||
|
|
||||||
|
if (this.embedOptions.components.showButtonLabels) {
|
||||||
|
previousButton.label = 'Previous';
|
||||||
|
playPauseButton.label = queue.node.isPaused() ? 'Resume' : 'Pause';
|
||||||
|
skipButton.label = 'Skip';
|
||||||
|
}
|
||||||
|
|
||||||
const embedActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
const embedActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
||||||
type: ComponentType.ActionRow,
|
type: ComponentType.ActionRow,
|
||||||
components
|
components
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
|
|||||||
const previousButton: APIButtonComponent = new ButtonBuilder()
|
const previousButton: APIButtonComponent = new ButtonBuilder()
|
||||||
.setDisabled(queue.history.tracks.data.length > 0 ? false : true)
|
.setDisabled(queue.history.tracks.data.length > 0 ? false : true)
|
||||||
.setCustomId(`action-previous-button_${currentTrack.id}`)
|
.setCustomId(`action-previous-button_${currentTrack.id}`)
|
||||||
.setLabel('Previous')
|
|
||||||
.setStyle(ButtonStyle.Secondary)
|
.setStyle(ButtonStyle.Secondary)
|
||||||
.setEmoji(this.embedOptions.icons.previousTrack)
|
.setEmoji(this.embedOptions.icons.previousTrack)
|
||||||
.toJSON();
|
.toJSON();
|
||||||
@@ -57,7 +56,6 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
|
|||||||
|
|
||||||
const playPauseButton: APIButtonComponent = new ButtonBuilder()
|
const playPauseButton: APIButtonComponent = new ButtonBuilder()
|
||||||
.setCustomId(`action-pauseresume-button_${currentTrack.id}`)
|
.setCustomId(`action-pauseresume-button_${currentTrack.id}`)
|
||||||
.setLabel(queue.node.isPaused() ? 'Resume' : 'Pause')
|
|
||||||
.setStyle(ButtonStyle.Secondary)
|
.setStyle(ButtonStyle.Secondary)
|
||||||
.setEmoji(this.embedOptions.icons.pauseResumeTrack)
|
.setEmoji(this.embedOptions.icons.pauseResumeTrack)
|
||||||
.toJSON();
|
.toJSON();
|
||||||
@@ -65,12 +63,17 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
|
|||||||
|
|
||||||
const skipButton: APIButtonComponent = new ButtonBuilder()
|
const skipButton: APIButtonComponent = new ButtonBuilder()
|
||||||
.setCustomId(`action-skip-button_${currentTrack.id}`)
|
.setCustomId(`action-skip-button_${currentTrack.id}`)
|
||||||
.setLabel('Skip')
|
|
||||||
.setStyle(ButtonStyle.Secondary)
|
.setStyle(ButtonStyle.Secondary)
|
||||||
.setEmoji(this.embedOptions.icons.nextTrack)
|
.setEmoji(this.embedOptions.icons.nextTrack)
|
||||||
.toJSON();
|
.toJSON();
|
||||||
components.push(skipButton);
|
components.push(skipButton);
|
||||||
|
|
||||||
|
if (this.embedOptions.components.showButtonLabels) {
|
||||||
|
previousButton.label = 'Previous';
|
||||||
|
playPauseButton.label = queue.node.isPaused() ? 'Resume' : 'Pause';
|
||||||
|
skipButton.label = 'Skip';
|
||||||
|
}
|
||||||
|
|
||||||
const embedActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
const embedActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
||||||
type: ComponentType.ActionRow,
|
type: ComponentType.ActionRow,
|
||||||
components
|
components
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ class QueueCommand extends BaseSlashCommandInteraction {
|
|||||||
const previousButton: APIButtonComponent = new ButtonBuilder()
|
const previousButton: APIButtonComponent = new ButtonBuilder()
|
||||||
.setDisabled(queue.history.tracks.data.length > 0 ? false : true)
|
.setDisabled(queue.history.tracks.data.length > 0 ? false : true)
|
||||||
.setCustomId(`action-previous-button_${currentTrack.id}`)
|
.setCustomId(`action-previous-button_${currentTrack.id}`)
|
||||||
.setLabel('Previous')
|
|
||||||
.setStyle(ButtonStyle.Secondary)
|
.setStyle(ButtonStyle.Secondary)
|
||||||
.setEmoji(this.embedOptions.icons.previousTrack)
|
.setEmoji(this.embedOptions.icons.previousTrack)
|
||||||
.toJSON();
|
.toJSON();
|
||||||
@@ -80,7 +79,6 @@ class QueueCommand extends BaseSlashCommandInteraction {
|
|||||||
|
|
||||||
const playPauseButton: APIButtonComponent = new ButtonBuilder()
|
const playPauseButton: APIButtonComponent = new ButtonBuilder()
|
||||||
.setCustomId(`action-pauseresume-button_${currentTrack.id}`)
|
.setCustomId(`action-pauseresume-button_${currentTrack.id}`)
|
||||||
.setLabel(queue.node.isPaused() ? 'Resume' : 'Pause')
|
|
||||||
.setStyle(ButtonStyle.Secondary)
|
.setStyle(ButtonStyle.Secondary)
|
||||||
.setEmoji(this.embedOptions.icons.pauseResumeTrack)
|
.setEmoji(this.embedOptions.icons.pauseResumeTrack)
|
||||||
.toJSON();
|
.toJSON();
|
||||||
@@ -88,12 +86,17 @@ class QueueCommand extends BaseSlashCommandInteraction {
|
|||||||
|
|
||||||
const skipButton: APIButtonComponent = new ButtonBuilder()
|
const skipButton: APIButtonComponent = new ButtonBuilder()
|
||||||
.setCustomId(`action-skip-button_${currentTrack.id}`)
|
.setCustomId(`action-skip-button_${currentTrack.id}`)
|
||||||
.setLabel('Skip')
|
|
||||||
.setStyle(ButtonStyle.Secondary)
|
.setStyle(ButtonStyle.Secondary)
|
||||||
.setEmoji(this.embedOptions.icons.nextTrack)
|
.setEmoji(this.embedOptions.icons.nextTrack)
|
||||||
.toJSON();
|
.toJSON();
|
||||||
components.push(skipButton);
|
components.push(skipButton);
|
||||||
|
|
||||||
|
if (this.embedOptions.components.showButtonLabels) {
|
||||||
|
previousButton.label = 'Previous';
|
||||||
|
playPauseButton.label = queue.node.isPaused() ? 'Resume' : 'Pause';
|
||||||
|
skipButton.label = 'Skip';
|
||||||
|
}
|
||||||
|
|
||||||
const embedActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
const embedActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
||||||
type: ComponentType.ActionRow,
|
type: ComponentType.ActionRow,
|
||||||
components
|
components
|
||||||
|
|||||||
Vendored
+3
@@ -39,6 +39,9 @@ export type EmbedOptions = {
|
|||||||
info: ColorResolvable;
|
info: ColorResolvable;
|
||||||
note: ColorResolvable;
|
note: ColorResolvable;
|
||||||
};
|
};
|
||||||
|
components: {
|
||||||
|
showButtonLabels: boolean;
|
||||||
|
};
|
||||||
icons: {
|
icons: {
|
||||||
logo: string;
|
logo: string;
|
||||||
beta: string;
|
beta: string;
|
||||||
|
|||||||
Reference in new issue
Block a user