Skip to content

Basic commands for the player (play, stop, pause) #1869

Answered by twlite
steph-lion asked this question in Q&A
Discussion options

You must be logged in to vote

hello @steph-lion,

Discord Player performs audio player related actions via queue.node object, queue related actions via queue, etc. Discord Player also has a concept called hooks which provide easy access to these objects. If you want to implement a pause/resume command for example, you can make the use of useTimeline hook:

const { useQueue } = require('discord-player');

const queue = useQueue(interaction.guild.id);

if (!queue) {
  // bot is not in a voice channel
}
if (!queue.currentTrack) {
  // not playing any track
}

// toggle pause action
queue.node.pause();
queue.node.resume();
queue.node.setPaused(true/false);

const state = queue.node.isPaused();

return interaction.reply({ co…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by steph-lion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants