Added forceskip, fixed blank title tracks some more

This commit is contained in:
Essem 2021-09-19 18:06:09 -05:00
parent 3517826f46
commit b07c0e389e
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
3 changed files with 21 additions and 3 deletions

View file

@ -0,0 +1,18 @@
import { skipVotes } from "../../utils/soundplayer.js";
import MusicCommand from "../../classes/musicCommand.js";
class ForceSkipCommand extends MusicCommand {
async run() {
if (!this.message.channel.guild) return "This command only works in servers!";
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.message.member.permissions.has("manageChannels")) return "You need to have the `Manage Channels` permission to force skip!";
this.connection.player.stop(this.message.channel.guild.id);
skipVotes.set(this.message.channel.guild.id, { count: 0, ids: [], max: Math.min(3, this.connection.voiceChannel.voiceMembers.size - 1) });
return;
}
static description = "Force skips the current song";
}
export default ForceSkipCommand;

View file

@ -18,7 +18,7 @@ class QueueCommand extends MusicCommand {
const trackList = [];
const firstTrack = tracks.shift();
for (const [i, track] of tracks.entries()) {
trackList.push(`${i + 1}. ${track.info.author} - **${track.info.title}** (${track.info.isStream ? "∞" : format(track.info.length)})`);
trackList.push(`${i + 1}. ${track.info.author !== "" ? track.info.author : "(blank)"} - **${track.info.title !== "" ? track.info.title : "(blank)"}** (${track.info.isStream ? "∞" : format(track.info.length)})`);
}
const pageSize = 5;
const embeds = [];
@ -39,7 +39,7 @@ class QueueCommand extends MusicCommand {
},
"fields": [{
"name": "🎶 Now Playing",
"value": `${firstTrack.info.author} - **${firstTrack.info.title}** (${firstTrack.info.isStream ? "∞" : format(firstTrack.info.length)})`
"value": `${firstTrack.info.author !== "" ? firstTrack.info.author : "(blank)"} - **${firstTrack.info.title !== "" ? firstTrack.info.title : "(blank)"}** (${firstTrack.info.isStream ? "∞" : format(firstTrack.info.length)})`
}, {
"name": "🔁 Looping?",
"value": player.loop ? "Yes" : "No"