Fixed pause message, handle blank names better
This commit is contained in:
parent
e692077ed5
commit
3234688929
2 changed files with 30 additions and 26 deletions
|
@ -8,7 +8,7 @@ class PauseCommand extends MusicCommand {
|
||||||
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!";
|
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;
|
const player = this.connection.player;
|
||||||
await player.pause(!player.paused ? true : false);
|
await player.pause(!player.paused ? true : false);
|
||||||
return `🔊 The player has been ${!player.paused ? "paused" : "resumed"}.`;
|
return `🔊 The player has been ${player.paused ? "paused" : "resumed"}.`;
|
||||||
}
|
}
|
||||||
|
|
||||||
static description = "Pauses/resumes the current song";
|
static description = "Pauses/resumes the current song";
|
||||||
|
|
|
@ -78,7 +78,7 @@ export async function play(client, sound, message, music = false) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (oldQueue && oldQueue.length !== 0 && music) {
|
if (oldQueue && oldQueue.length !== 0 && music) {
|
||||||
return `Your ${playlistInfo.name ? "playlist" : "tune"} \`${playlistInfo.name ? playlistInfo.name : (tracks[0].info.title !== "" ? tracks[0].info.title : "(blank)")}\` has been added to the queue!`;
|
return `Your ${playlistInfo.name ? "playlist" : "tune"} \`${playlistInfo.name ? playlistInfo.name.trim() : (tracks[0].info.title !== "" ? tracks[0].info.title.trim() : "(blank)")}\` has been added to the queue!`;
|
||||||
} else {
|
} else {
|
||||||
nextSong(client, message, connection, tracks[0].track, tracks[0].info, music, voiceChannel, player ? player.loop : false, player ? player.shuffle : false);
|
nextSong(client, message, connection, tracks[0].track, tracks[0].info, music, voiceChannel, player ? player.loop : false, player ? player.shuffle : false);
|
||||||
return;
|
return;
|
||||||
|
@ -101,6 +101,7 @@ export async function nextSong(client, message, connection, track, info, music,
|
||||||
if (music && lastTrack === track && players.get(voiceChannel.guild.id)) {
|
if (music && lastTrack === track && players.get(voiceChannel.guild.id)) {
|
||||||
playingMessage = players.get(voiceChannel.guild.id).playMessage;
|
playingMessage = players.get(voiceChannel.guild.id).playMessage;
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
playingMessage = await client.createMessage(message.channel.id, !music ? "🔊 Playing sound..." : {
|
playingMessage = await client.createMessage(message.channel.id, !music ? "🔊 Playing sound..." : {
|
||||||
embeds: [{
|
embeds: [{
|
||||||
color: 16711680,
|
color: 16711680,
|
||||||
|
@ -110,11 +111,11 @@ export async function nextSong(client, message, connection, track, info, music,
|
||||||
},
|
},
|
||||||
fields: [{
|
fields: [{
|
||||||
name: "ℹ️ Title:",
|
name: "ℹ️ Title:",
|
||||||
value: info.title !== "" ? info.title : "(blank)"
|
value: info.title && info.title.trim() !== "" ? info.title : "(blank)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "🎤 Artist:",
|
name: "🎤 Artist:",
|
||||||
value: info.author !== "" ? info.author : "(blank)"
|
value: info.title && info.author.trim() !== "" ? info.author : "(blank)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "💬 Channel:",
|
name: "💬 Channel:",
|
||||||
|
@ -126,6 +127,9 @@ export async function nextSong(client, message, connection, track, info, music,
|
||||||
}]
|
}]
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
} catch {
|
||||||
|
// no-op
|
||||||
|
}
|
||||||
}
|
}
|
||||||
connection.removeAllListeners("error");
|
connection.removeAllListeners("error");
|
||||||
connection.removeAllListeners("end");
|
connection.removeAllListeners("end");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue