mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 06:28:53 +00:00
Add updated action buttons to /nowplaying
This commit is contained in:
1 parent
fac39e45cb
commit
4b646e24db
3 files changed
+46
-21
No files matched your search
@@ -75,13 +75,8 @@ class HistoryCommand extends BaseSlashCommandInteraction {
|
|||||||
) {
|
) {
|
||||||
logger.debug('History exists with current track, gathering information.');
|
logger.debug('History exists with current track, gathering information.');
|
||||||
|
|
||||||
const playPauseButton: APIButtonComponent = new ButtonBuilder()
|
const components: APIMessageActionRowComponent[] = [];
|
||||||
.setCustomId(`action-pauseresume-button_${currentTrack.id}`)
|
|
||||||
.setLabel(queue.node.isPaused() ? 'Resume' : 'Pause')
|
|
||||||
.setStyle(ButtonStyle.Secondary)
|
|
||||||
.setEmoji(this.embedOptions.icons.pauseResumeTrack)
|
|
||||||
.toJSON();
|
|
||||||
const components: APIMessageActionRowComponent[] = [playPauseButton];
|
|
||||||
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}`)
|
||||||
@@ -89,7 +84,16 @@ class HistoryCommand extends BaseSlashCommandInteraction {
|
|||||||
.setStyle(ButtonStyle.Secondary)
|
.setStyle(ButtonStyle.Secondary)
|
||||||
.setEmoji(this.embedOptions.icons.previousTrack)
|
.setEmoji(this.embedOptions.icons.previousTrack)
|
||||||
.toJSON();
|
.toJSON();
|
||||||
components.unshift(previousButton);
|
components.push(previousButton);
|
||||||
|
|
||||||
|
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();
|
||||||
|
components.push(playPauseButton);
|
||||||
|
|
||||||
const skipButton: APIButtonComponent = new ButtonBuilder()
|
const skipButton: APIButtonComponent = new ButtonBuilder()
|
||||||
.setCustomId(`action-skip-button_${currentTrack.id}`)
|
.setCustomId(`action-skip-button_${currentTrack.id}`)
|
||||||
.setLabel('Skip')
|
.setLabel('Skip')
|
||||||
|
|||||||
@@ -44,19 +44,36 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
|
|||||||
const displayQueueRepeatMode: string = this.getDisplayQueueRepeatMode(queue);
|
const displayQueueRepeatMode: string = this.getDisplayQueueRepeatMode(queue);
|
||||||
const displayEmbedProgressBar: string = this.getDisplayQueueProgressBar(queue);
|
const displayEmbedProgressBar: string = this.getDisplayQueueProgressBar(queue);
|
||||||
|
|
||||||
const customId: string = `action-skip-button_${currentTrack.id}`;
|
const components: APIMessageActionRowComponent[] = [];
|
||||||
logger.debug(`Generated custom id for skip button: ${customId}`);
|
|
||||||
|
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();
|
||||||
|
components.push(previousButton);
|
||||||
|
|
||||||
|
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();
|
||||||
|
components.push(playPauseButton);
|
||||||
|
|
||||||
const skipButton: APIButtonComponent = new ButtonBuilder()
|
const skipButton: APIButtonComponent = new ButtonBuilder()
|
||||||
.setCustomId(customId)
|
.setCustomId(`action-skip-button_${currentTrack.id}`)
|
||||||
.setLabel('Skip')
|
.setLabel('Skip')
|
||||||
.setStyle(ButtonStyle.Secondary)
|
.setStyle(ButtonStyle.Secondary)
|
||||||
.setEmoji(this.embedOptions.icons.nextTrack)
|
.setEmoji(this.embedOptions.icons.nextTrack)
|
||||||
.toJSON();
|
.toJSON();
|
||||||
|
components.push(skipButton);
|
||||||
|
|
||||||
const embedActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
const embedActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
||||||
type: ComponentType.ActionRow,
|
type: ComponentType.ActionRow,
|
||||||
components: [skipButton]
|
components
|
||||||
};
|
};
|
||||||
|
|
||||||
logger.debug('Sending info embed with action row components.');
|
logger.debug('Sending info embed with action row components.');
|
||||||
@@ -78,7 +95,7 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
|
|||||||
.setThumbnail(this.getTrackThumbnailUrl(queue.currentTrack!))
|
.setThumbnail(this.getTrackThumbnailUrl(queue.currentTrack!))
|
||||||
.setColor(this.embedOptions.colors.info)
|
.setColor(this.embedOptions.colors.info)
|
||||||
],
|
],
|
||||||
components: [embedActionRow as APIActionRowComponent<APIMessageActionRowComponent>]
|
components: [embedActionRow]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,13 +67,8 @@ class QueueCommand extends BaseSlashCommandInteraction {
|
|||||||
) {
|
) {
|
||||||
logger.debug('Queue exists with current track, gathering information.');
|
logger.debug('Queue exists with current track, gathering information.');
|
||||||
|
|
||||||
const playPauseButton: APIButtonComponent = new ButtonBuilder()
|
const components: APIMessageActionRowComponent[] = [];
|
||||||
.setCustomId(`action-pauseresume-button_${currentTrack.id}`)
|
|
||||||
.setLabel(queue.node.isPaused() ? 'Resume' : 'Pause')
|
|
||||||
.setStyle(ButtonStyle.Secondary)
|
|
||||||
.setEmoji(this.embedOptions.icons.pauseResumeTrack)
|
|
||||||
.toJSON();
|
|
||||||
const components: APIMessageActionRowComponent[] = [playPauseButton];
|
|
||||||
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}`)
|
||||||
@@ -81,7 +76,16 @@ class QueueCommand extends BaseSlashCommandInteraction {
|
|||||||
.setStyle(ButtonStyle.Secondary)
|
.setStyle(ButtonStyle.Secondary)
|
||||||
.setEmoji(this.embedOptions.icons.previousTrack)
|
.setEmoji(this.embedOptions.icons.previousTrack)
|
||||||
.toJSON();
|
.toJSON();
|
||||||
components.unshift(previousButton);
|
components.push(previousButton);
|
||||||
|
|
||||||
|
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();
|
||||||
|
components.push(playPauseButton);
|
||||||
|
|
||||||
const skipButton: APIButtonComponent = new ButtonBuilder()
|
const skipButton: APIButtonComponent = new ButtonBuilder()
|
||||||
.setCustomId(`action-skip-button_${currentTrack.id}`)
|
.setCustomId(`action-skip-button_${currentTrack.id}`)
|
||||||
.setLabel('Skip')
|
.setLabel('Skip')
|
||||||
|
|||||||
Reference in new issue
Block a user