Clean up now playing embeds, lower volume, make seek accept a timestamp
This commit is contained in:
parent
7fae0c1582
commit
ac871cb453
4 changed files with 21 additions and 14 deletions
|
@ -18,19 +18,19 @@ class NowPlayingCommand extends MusicCommand {
|
||||||
icon_url: this.client.user.avatarURL
|
icon_url: this.client.user.avatarURL
|
||||||
},
|
},
|
||||||
fields: [{
|
fields: [{
|
||||||
name: "ℹ️ Title:",
|
name: "ℹ️ Title",
|
||||||
value: track.title ? track.title : "Unknown"
|
value: track.title ? track.title : "Unknown"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "🎤 Artist:",
|
name: "🎤 Artist",
|
||||||
value: track.author ? track.author : "Unknown"
|
value: track.author ? track.author : "Unknown"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "💬 Channel:",
|
name: "💬 Channel",
|
||||||
value: this.channel.guild.channels.get(this.member.voiceState.channelID).name
|
value: this.channel.guild.channels.get(this.member.voiceState.channelID).name
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "🌐 Node:",
|
name: "🌐 Node",
|
||||||
value: player.node ? player.node.name : "Unknown"
|
value: player.node ? player.node.name : "Unknown"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,13 @@ class SeekCommand extends MusicCommand {
|
||||||
const player = this.connection.player;
|
const player = this.connection.player;
|
||||||
const track = await player.node.rest.decode(player.track);
|
const track = await player.node.rest.decode(player.track);
|
||||||
if (!track.isSeekable) return "This track isn't seekable!";
|
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!";
|
if (isNaN(seconds) || (seconds * 1000) > track.length || (seconds * 1000) < 0) return "That's not a valid position!";
|
||||||
player.seekTo(seconds * 1000);
|
player.seekTo(seconds * 1000);
|
||||||
return `🔊 Seeked track to ${seconds} second(s).`;
|
return `🔊 Seeked track to ${seconds} second(s).`;
|
||||||
|
@ -17,10 +23,9 @@ class SeekCommand extends MusicCommand {
|
||||||
|
|
||||||
static flags = [{
|
static flags = [{
|
||||||
name: "position",
|
name: "position",
|
||||||
type: 10,
|
type: 3,
|
||||||
description: "Seek to this position",
|
description: "Seek to this position",
|
||||||
required: true,
|
required: true
|
||||||
min_value: 0
|
|
||||||
}];
|
}];
|
||||||
static description = "Seeks to a different position in the music";
|
static description = "Seeks to a different position in the music";
|
||||||
static aliases = ["pos"];
|
static aliases = ["pos"];
|
||||||
|
|
|
@ -31,6 +31,7 @@ Napi::Value Meme(const Napi::CallbackInfo &info) {
|
||||||
int size = width / 9;
|
int size = width / 9;
|
||||||
int dividedWidth = width / 1000;
|
int dividedWidth = width / 1000;
|
||||||
int rad = 1;
|
int rad = 1;
|
||||||
|
vector<double> zeroVec = {0, 0, 0, 0};
|
||||||
|
|
||||||
string font_string = (font == "roboto" ? "Roboto Condensed" : font) + " " +
|
string font_string = (font == "roboto" ? "Roboto Condensed" : font) + " " +
|
||||||
(font != "impact" ? "bold" : "normal") + " " +
|
(font != "impact" ? "bold" : "normal") + " " +
|
||||||
|
@ -67,7 +68,7 @@ Napi::Value Meme(const Napi::CallbackInfo &info) {
|
||||||
topOutline =
|
topOutline =
|
||||||
topOutline.morph(altMask, VIPS_OPERATION_MORPHOLOGY_DILATE);
|
topOutline.morph(altMask, VIPS_OPERATION_MORPHOLOGY_DILATE);
|
||||||
}
|
}
|
||||||
topOutline = (topOutline == (vector<double>){0, 0, 0, 0});
|
topOutline = (topOutline == zeroVec);
|
||||||
VImage topInvert = topOutline.extract_band(3).invert();
|
VImage topInvert = topOutline.extract_band(3).invert();
|
||||||
topOutline = topOutline
|
topOutline = topOutline
|
||||||
.extract_band(0, VImage::option()->set(
|
.extract_band(0, VImage::option()->set(
|
||||||
|
@ -95,7 +96,7 @@ Napi::Value Meme(const Napi::CallbackInfo &info) {
|
||||||
bottomOutline =
|
bottomOutline =
|
||||||
bottomOutline.morph(altMask, VIPS_OPERATION_MORPHOLOGY_DILATE);
|
bottomOutline.morph(altMask, VIPS_OPERATION_MORPHOLOGY_DILATE);
|
||||||
}
|
}
|
||||||
bottomOutline = (bottomOutline == (vector<double>){0, 0, 0, 0});
|
bottomOutline = (bottomOutline == zeroVec);
|
||||||
VImage bottomInvert = bottomOutline.extract_band(3).invert();
|
VImage bottomInvert = bottomOutline.extract_band(3).invert();
|
||||||
bottomOutline = bottomOutline
|
bottomOutline = bottomOutline
|
||||||
.extract_band(0, VImage::option()->set(
|
.extract_band(0, VImage::option()->set(
|
||||||
|
|
|
@ -134,19 +134,19 @@ export async function nextSong(client, options, connection, track, info, music,
|
||||||
icon_url: client.user.avatarURL
|
icon_url: client.user.avatarURL
|
||||||
},
|
},
|
||||||
fields: [{
|
fields: [{
|
||||||
name: "ℹ️ Title:",
|
name: "ℹ️ Title",
|
||||||
value: info.title?.trim() !== "" ? info.title : "(blank)"
|
value: info.title?.trim() !== "" ? info.title : "(blank)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "🎤 Artist:",
|
name: "🎤 Artist",
|
||||||
value: info.author?.trim() !== "" ? info.author : "(blank)"
|
value: info.author?.trim() !== "" ? info.author : "(blank)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "💬 Channel:",
|
name: "💬 Channel",
|
||||||
value: voiceChannel.name
|
value: voiceChannel.name
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "🌐 Node:",
|
name: "🌐 Node",
|
||||||
value: connection.node?.name ?? "Unknown"
|
value: connection.node?.name ?? "Unknown"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -168,6 +168,7 @@ export async function nextSong(client, options, connection, track, info, music,
|
||||||
connection.removeAllListeners("exception");
|
connection.removeAllListeners("exception");
|
||||||
connection.removeAllListeners("stuck");
|
connection.removeAllListeners("stuck");
|
||||||
connection.removeAllListeners("end");
|
connection.removeAllListeners("end");
|
||||||
|
connection.setVolume(0.70);
|
||||||
connection.playTrack({ track });
|
connection.playTrack({ track });
|
||||||
players.set(voiceChannel.guild.id, { player: connection, type: music ? "music" : "sound", host: host, voiceChannel: voiceChannel, originalChannel: options.channel, loop, shuffle, playMessage: playingMessage });
|
players.set(voiceChannel.guild.id, { player: connection, type: music ? "music" : "sound", host: host, voiceChannel: voiceChannel, originalChannel: options.channel, loop, shuffle, playMessage: playingMessage });
|
||||||
connection.once("exception", async (exception) => {
|
connection.once("exception", async (exception) => {
|
||||||
|
|
Loading…
Reference in a new issue