feat: Add new config option to enable/disable button labels

This commit is contained in:
Marius Begby committed 2023-12-12 15:59:24 +01:00
1 parent 82927c5880
commit 47d3c36cc7
6 files changed
+28 -10

No files matched your search

+3
View File
@@ -65,6 +65,9 @@ module.exports.embedOptions = {
info: '#5865F2',
note: '#80848E'
},
components: {
showButtonLabels: false
},
icons: {
logo: '🤖',
beta: '`beta`',
+4 -1
View File
@@ -194,11 +194,14 @@ class FiltersCommand extends BaseSlashCommandInteraction {
const disableButton: APIButtonComponent = new ButtonBuilder()
.setCustomId('filters-disable-button')
.setLabel('Disable all filters')
.setStyle(ButtonStyle.Secondary)
.setEmoji(this.embedOptions.icons.disable)
.toJSON();
if (this.embedOptions.components.showButtonLabels) {
disableButton.label = 'Disable all filters';
}
const disableFiltersActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
type: ComponentType.ActionRow,
components: [disableButton]
+6 -3
View File
@@ -80,7 +80,6 @@ class HistoryCommand extends BaseSlashCommandInteraction {
const previousButton: APIButtonComponent = new ButtonBuilder()
.setDisabled(queue.history.tracks.data.length > 0 ? false : true)
.setCustomId(`action-previous-button_${currentTrack.id}`)
.setLabel('Previous')
.setStyle(ButtonStyle.Secondary)
.setEmoji(this.embedOptions.icons.previousTrack)
.toJSON();
@@ -88,7 +87,6 @@ class HistoryCommand extends BaseSlashCommandInteraction {
const playPauseButton: APIButtonComponent = new ButtonBuilder()
.setCustomId(`action-pauseresume-button_${currentTrack.id}`)
.setLabel(queue.node.isPaused() ? 'Resume' : 'Pause')
.setStyle(ButtonStyle.Secondary)
.setEmoji(this.embedOptions.icons.pauseResumeTrack)
.toJSON();
@@ -96,12 +94,17 @@ class HistoryCommand extends BaseSlashCommandInteraction {
const skipButton: APIButtonComponent = new ButtonBuilder()
.setCustomId(`action-skip-button_${currentTrack.id}`)
.setLabel('Skip')
.setStyle(ButtonStyle.Secondary)
.setEmoji(this.embedOptions.icons.nextTrack)
.toJSON();
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> = {
type: ComponentType.ActionRow,
components
@@ -49,7 +49,6 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
const previousButton: APIButtonComponent = new ButtonBuilder()
.setDisabled(queue.history.tracks.data.length > 0 ? false : true)
.setCustomId(`action-previous-button_${currentTrack.id}`)
.setLabel('Previous')
.setStyle(ButtonStyle.Secondary)
.setEmoji(this.embedOptions.icons.previousTrack)
.toJSON();
@@ -57,7 +56,6 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
const playPauseButton: APIButtonComponent = new ButtonBuilder()
.setCustomId(`action-pauseresume-button_${currentTrack.id}`)
.setLabel(queue.node.isPaused() ? 'Resume' : 'Pause')
.setStyle(ButtonStyle.Secondary)
.setEmoji(this.embedOptions.icons.pauseResumeTrack)
.toJSON();
@@ -65,12 +63,17 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
const skipButton: APIButtonComponent = new ButtonBuilder()
.setCustomId(`action-skip-button_${currentTrack.id}`)
.setLabel('Skip')
.setStyle(ButtonStyle.Secondary)
.setEmoji(this.embedOptions.icons.nextTrack)
.toJSON();
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> = {
type: ComponentType.ActionRow,
components
+6 -3
View File
@@ -72,7 +72,6 @@ class QueueCommand extends BaseSlashCommandInteraction {
const previousButton: APIButtonComponent = new ButtonBuilder()
.setDisabled(queue.history.tracks.data.length > 0 ? false : true)
.setCustomId(`action-previous-button_${currentTrack.id}`)
.setLabel('Previous')
.setStyle(ButtonStyle.Secondary)
.setEmoji(this.embedOptions.icons.previousTrack)
.toJSON();
@@ -80,7 +79,6 @@ class QueueCommand extends BaseSlashCommandInteraction {
const playPauseButton: APIButtonComponent = new ButtonBuilder()
.setCustomId(`action-pauseresume-button_${currentTrack.id}`)
.setLabel(queue.node.isPaused() ? 'Resume' : 'Pause')
.setStyle(ButtonStyle.Secondary)
.setEmoji(this.embedOptions.icons.pauseResumeTrack)
.toJSON();
@@ -88,12 +86,17 @@ class QueueCommand extends BaseSlashCommandInteraction {
const skipButton: APIButtonComponent = new ButtonBuilder()
.setCustomId(`action-skip-button_${currentTrack.id}`)
.setLabel('Skip')
.setStyle(ButtonStyle.Secondary)
.setEmoji(this.embedOptions.icons.nextTrack)
.toJSON();
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> = {
type: ComponentType.ActionRow,
components
+3
View File
@@ -39,6 +39,9 @@ export type EmbedOptions = {
info: ColorResolvable;
note: ColorResolvable;
};
components: {
showButtonLabels: boolean;
};
icons: {
logo: string;
beta: string;