Skip to content

Commit

Permalink
Working error checking for ps/up
Browse files Browse the repository at this point in the history
Fixed the logic in some of the error handling and changed it to be more brief
  • Loading branch information
RobertAndion committed May 15, 2021
1 parent 9eba2bb commit fb048fb
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions commands/ytdltie.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,30 +140,21 @@ module.exports = class ytdltie {
}

async pause(message) {


const voiceChannel = message.member.voice.channel;
const server_queue = this.queue.get(message.guild.id);
if(!voiceChannel || server_queue.voice_channel != voiceChannel) return message.channel.send("Please join a voice channel first.");

if(server_queue.connection.dispatcher.paused) {//checks if paused
message.channel.send("Can't repause the pause");
return;
}
if(server_queue.connection.dispatcher.pausedSince) return message.channel.send("Song is already paused!"); // Handle double pause

server_queue.connection.dispatcher.pause();
message.channel.send("⏸️ Paused the song!");


}

async unpause(message) {
const voiceChannel = message.member.voice.channel;
const server_queue = this.queue.get(message.guild.id);
if(!voiceChannel || server_queue.voice_channel != voiceChannel) return message.channel.send("Please join a voice channel first.");
/*if(!server_queue.connection.dispatcher.paused) {//checks if unpaused
message.channel.send("No music is currently paused");
return;
} */
if(!server_queue.connection.dispatcher.pausedSince) return message.channel.send("No music is currently paused"); // Handle call on unpaused.

server_queue.connection.dispatcher.pause(true);
server_queue.connection.dispatcher.resume();
server_queue.connection.dispatcher.resume();
Expand Down

0 comments on commit fb048fb

Please sign in to comment.