Clean up now playing embeds, lower volume, make seek accept a timestamp

This commit is contained in:
Essem 2022-08-25 10:36:12 -05:00
parent 7fae0c1582
commit ac871cb453
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
4 changed files with 21 additions and 14 deletions

View file

@ -18,19 +18,19 @@ class NowPlayingCommand extends MusicCommand {
icon_url: this.client.user.avatarURL
},
fields: [{
name: " Title:",
name: " Title",
value: track.title ? track.title : "Unknown"
},
{
name: "🎤 Artist:",
name: "🎤 Artist",
value: track.author ? track.author : "Unknown"
},
{
name: "💬 Channel:",
name: "💬 Channel",
value: this.channel.guild.channels.get(this.member.voiceState.channelID).name
},
{
name: "🌐 Node:",
name: "🌐 Node",
value: player.node ? player.node.name : "Unknown"
},
{

View file

@ -9,7 +9,13 @@ class SeekCommand extends MusicCommand {
const player = this.connection.player;
const track = await player.node.rest.decode(player.track);
if (!track.isSeekable) return "This track isn't seekable!";
const seconds = parseFloat(this.options.position ?? this.args[0]);
const pos = this.options.position ?? this.args[0];
let seconds;
if (pos.includes(":")) {
seconds = +(pos.split(":").reduce((acc, time) => (60 * acc) + +time));
} else {
seconds = parseFloat(pos);
}
if (isNaN(seconds) || (seconds * 1000) > track.length || (seconds * 1000) < 0) return "That's not a valid position!";
player.seekTo(seconds * 1000);
return `🔊 Seeked track to ${seconds} second(s).`;
@ -17,10 +23,9 @@ class SeekCommand extends MusicCommand {
static flags = [{
name: "position",
type: 10,
type: 3,
description: "Seek to this position",
required: true,
min_value: 0
required: true
}];
static description = "Seeks to a different position in the music";
static aliases = ["pos"];