Properly await more functions
This commit is contained in:
parent
c5fc1d0b0f
commit
5acd2b1113
7 changed files with 26 additions and 26 deletions
|
@ -7,7 +7,7 @@ class PauseCommand extends MusicCommand {
|
|||
if (!this.message.channel.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!";
|
||||
if (this.connection.host !== this.message.author.id && !this.message.member.permissions.has("manageChannels")) return "Only the current voice session host can pause/resume the music!";
|
||||
const player = this.connection.player;
|
||||
player.pause(!player.paused ? true : false);
|
||||
await player.pause(!player.paused ? true : false);
|
||||
return `🔊 The player has been ${!player.paused ? "paused" : "resumed"}.`;
|
||||
}
|
||||
|
||||
|
@ -15,4 +15,4 @@ class PauseCommand extends MusicCommand {
|
|||
static aliases = ["resume"];
|
||||
}
|
||||
|
||||
export default PauseCommand;
|
||||
export default PauseCommand;
|
||||
|
|
|
@ -20,4 +20,4 @@ class RemoveCommand extends MusicCommand {
|
|||
static aliases = ["rm"];
|
||||
}
|
||||
|
||||
export default RemoveCommand;
|
||||
export default RemoveCommand;
|
||||
|
|
|
@ -12,7 +12,7 @@ class SeekCommand extends MusicCommand {
|
|||
if (!track.isSeekable) return "This track isn't seekable!";
|
||||
const seconds = parseFloat(this.args[0]);
|
||||
if (isNaN(seconds) || (seconds * 1000) > track.length || (seconds * 1000) < 0) return "That's not a valid position!";
|
||||
player.seek(seconds * 1000);
|
||||
await player.seek(seconds * 1000);
|
||||
return `🔊 Seeked track to ${seconds} second(s).`;
|
||||
}
|
||||
|
||||
|
@ -21,4 +21,4 @@ class SeekCommand extends MusicCommand {
|
|||
static arguments = ["[seconds]"];
|
||||
}
|
||||
|
||||
export default SeekCommand;
|
||||
export default SeekCommand;
|
||||
|
|
|
@ -16,14 +16,14 @@ class SkipCommand extends MusicCommand {
|
|||
max: votes.max
|
||||
};
|
||||
if (votes.count + 1 === votes.max) {
|
||||
player.player.stop(this.message.channel.guild.id);
|
||||
await player.player.stop(this.message.channel.guild.id);
|
||||
skipVotes.set(this.message.channel.guild.id, { count: 0, ids: [], max: Math.min(3, player.voiceChannel.voiceMembers.filter((i) => i.id !== this.client.user.id && !i.bot).length) });
|
||||
} else {
|
||||
skipVotes.set(this.message.channel.guild.id, newObject);
|
||||
return `🔊 Voted to skip song (${votes.count + 1}/${votes.max} people have voted).`;
|
||||
}
|
||||
} else {
|
||||
player.player.stop(this.message.channel.guild.id);
|
||||
await player.player.stop(this.message.channel.guild.id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -32,4 +32,4 @@ class SkipCommand extends MusicCommand {
|
|||
static aliases = ["forceskip"];
|
||||
}
|
||||
|
||||
export default SkipCommand;
|
||||
export default SkipCommand;
|
||||
|
|
|
@ -7,9 +7,9 @@ class StopCommand extends MusicCommand {
|
|||
if (!this.message.member.voiceState.channelID) return "You need to be in a voice channel first!";
|
||||
if (!this.message.channel.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!";
|
||||
if (this.connection.host !== this.message.author.id && !this.message.member.permissions.has("manageChannels")) return "Only the current voice session host can stop the music!";
|
||||
manager.leave(this.message.channel.guild.id);
|
||||
await manager.leave(this.message.channel.guild.id);
|
||||
const connection = this.connection.player;
|
||||
connection.destroy();
|
||||
await connection.destroy();
|
||||
players.delete(this.message.channel.guild.id);
|
||||
queues.delete(this.message.channel.guild.id);
|
||||
return "🔊 The current voice channel session has ended.";
|
||||
|
@ -19,4 +19,4 @@ class StopCommand extends MusicCommand {
|
|||
static aliases = ["disconnect"];
|
||||
}
|
||||
|
||||
export default StopCommand;
|
||||
export default StopCommand;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue