mirror of
https://github.com/musix-org/musix-oss
synced 2025-07-03 16:24:28 +00:00
Update 3.6
This commit is contained in:
@ -7,41 +7,39 @@ module.exports = {
|
||||
permission: "none",
|
||||
category: "music",
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
const getThumb = require("video-thumbnail-url");
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
if (!queue) return msg.channel.send(client.messages.noServerQueue);
|
||||
let songTime = (queue.songs[0].songLength * 1000).toFixed(0);
|
||||
let songTime = (queue.songs[0].info.lengthSeconds * 1000).toFixed(0);
|
||||
let completed = (
|
||||
queue.connection.dispatcher.streamTime + queue.time
|
||||
).toFixed(0);
|
||||
let barlength = 20;
|
||||
let barlength = 30;
|
||||
let completedpercent = ((completed / songTime) * barlength).toFixed(0);
|
||||
let array = [];
|
||||
for (let i = 0; i < completedpercent - 1; i++) {
|
||||
array.push("⎯");
|
||||
}
|
||||
array.push("⭗");
|
||||
array.push("🔘");
|
||||
for (let i = 0; i < barlength - completedpercent - 1; i++) {
|
||||
array.push("⎯");
|
||||
}
|
||||
const thumbnail = getThumb(queue.songs[0].url);
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(client.messages.nowPlaying)
|
||||
.setDescription(
|
||||
`${client.messages.nowPlayingDesc} ${
|
||||
queue.songs[0].title
|
||||
}\n${array.join("")} | \`${client.funcs.msToTime(
|
||||
}\n\`${array.join("")}\`\n\`${client.funcs.msToTime(
|
||||
completed,
|
||||
"hh:mm:ss"
|
||||
)} / ${client.funcs.msToTime(songTime, "hh:mm:ss")}\`\nchannel: \`${queue.songs[0].channel.name}\``
|
||||
)} / ${client.funcs.msToTime(songTime, "hh:mm:ss")}\`\nchannel: \`${queue.songs[0].info.author.name}\``
|
||||
)
|
||||
.setFooter(`Queued by ${queue.songs[0].author.tag}`)
|
||||
.setURL(queue.songs[0].url)
|
||||
.setThumbnail(thumbnail._rejectionHandler0)
|
||||
.setThumbnail(queue.songs[0].info.thumbnail.thumbnails[4].url)
|
||||
.setColor(client.config.embedColor);
|
||||
if (queue.nigthCore)
|
||||
embed.setDescription(
|
||||
`${client.messages.nowPlayingDesc} ${queue.songs[0].title} \nchannel: \`${queue.songs[0].channel.name}\``
|
||||
`${client.messages.nowPlayingDesc} ${queue.songs[0].title} \nchannel: \`${queue.songs[0].info.author.name}\``
|
||||
);
|
||||
return msg.channel.send(embed);
|
||||
},
|
||||
|
@ -43,11 +43,9 @@ module.exports = {
|
||||
if (!voiceChannel.speakable)
|
||||
return msg.channel.send(client.messages.noPermsSpeak);
|
||||
if (ytdl.validateURL(url)) {
|
||||
const resource = {
|
||||
url: url
|
||||
}
|
||||
client.funcs.handleVideo(
|
||||
resource,
|
||||
client.funcs.handleVideo({
|
||||
url: url
|
||||
},
|
||||
msg,
|
||||
voiceChannel,
|
||||
client,
|
||||
@ -81,8 +79,7 @@ module.exports = {
|
||||
"ytdl"
|
||||
);
|
||||
}
|
||||
let message;
|
||||
message = client.messages.playlistAdded.replace(
|
||||
const message = client.messages.playlistAdded.replace(
|
||||
"%TITLE%",
|
||||
playlist.title
|
||||
);
|
||||
|
65
src/commands/searchSimilar.js
Normal file
65
src/commands/searchSimilar.js
Normal file
@ -0,0 +1,65 @@
|
||||
const similarSongs = require("similar-songs");
|
||||
|
||||
module.exports = {
|
||||
name: "searchsimilar",
|
||||
alias: ["none"],
|
||||
usage: "<song name>, <artist>",
|
||||
description: "a command to search similar songs (in developement)",
|
||||
onlyDev: false,
|
||||
permission: "none",
|
||||
category: "music",
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
const searchString = args.slice(1).join(" ");
|
||||
const query = searchString.split(",");
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
const voiceChannel = msg.member.voice.channel;
|
||||
if (
|
||||
client.global.db.guilds[msg.guild.id].blacklist.includes(
|
||||
msg.member.voice.channelID
|
||||
)
|
||||
)
|
||||
return msg.channel.send(client.messages.blackListedVC);
|
||||
if (!queue) {
|
||||
if (!msg.member.voice.channel)
|
||||
return msg.channel.send(client.messages.noVoiceChannel);
|
||||
} else {
|
||||
if (voiceChannel !== queue.voiceChannel)
|
||||
return msg.channel.send(client.messages.wrongVoiceChannel);
|
||||
}
|
||||
if (!query[0] || !query[1]) {
|
||||
const message = client.messages.searchSimilarUsage.replace("%USAGE%", command.usage);
|
||||
return msg.channel.send(message);
|
||||
|
||||
}
|
||||
if (voiceChannel.full) return msg.channel.send(client.messages.channelFull);
|
||||
if (!voiceChannel.joinable)
|
||||
return msg.channel.send(client.messages.noPermsConnect);
|
||||
if (!voiceChannel.speakable)
|
||||
return msg.channel.send(client.messages.noPermsSpeak);
|
||||
similarSongs.find({
|
||||
title: query[0],
|
||||
artist: query[1].slice(1),
|
||||
limit: 10,
|
||||
lastfmAPIKey: client.config.lastfm_api_key,
|
||||
lastfmAPISecret: client.config.lastfm_secret,
|
||||
youtubeAPIKey: client.config.api_key,
|
||||
},
|
||||
async function (err, songs) {
|
||||
if (err) return msg.channel.send(err.message);
|
||||
if (songs.length !== 0) {
|
||||
const lmsg = await msg.channel.send(client.messages.loadingSongs);
|
||||
for (let i = 0; i < songs.length; i++) {
|
||||
client.funcs.handleVideo({
|
||||
url: `https://www.youtube.com/watch?v=${songs[i].youtubeId}`
|
||||
}, msg, voiceChannel, client, true, "ytdl");
|
||||
}
|
||||
const message = client.messages.songsAdded.replace(
|
||||
"%AMOUNT%",
|
||||
songs.length
|
||||
);
|
||||
return lmsg.edit(message);
|
||||
} else return msg.channel.send(client.messages.noSimilarResults);
|
||||
}
|
||||
);
|
||||
},
|
||||
};
|
@ -9,11 +9,20 @@ module.exports = {
|
||||
execute(msg, args, client, Discord, command) {
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
if (msg.content.contains("-force")) {
|
||||
if (queue) {
|
||||
queue.voiceChannel.leave();
|
||||
queue.exists = false;
|
||||
}
|
||||
if (msg.guild.voice.channel) msg.guild.voice.channel.leave();
|
||||
client.queue.delete(guild.id);
|
||||
return msg.channel.send(client.messages.stop);
|
||||
}
|
||||
queue.songs = [];
|
||||
queue.looping = false;
|
||||
queue.endReason = "stop";
|
||||
queue.connection.dispatcher.end();
|
||||
msg.channel.send(client.messages.stop)
|
||||
msg.channel.send(client.messages.stop);
|
||||
}
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user