mirror of
https://github.com/musix-org/musix-oss
synced 2024-12-23 03:33:17 +00:00
Update 3.5
This commit is contained in:
parent
256585293e
commit
0874818101
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "musix",
|
"name": "musix",
|
||||||
"version": "3.4.1",
|
"version": "3.5.0",
|
||||||
"description": "V3 for Musix the discord music bot",
|
"description": "V3 for Musix the discord music bot",
|
||||||
"main": "./index.js",
|
"main": "./index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -27,8 +27,8 @@
|
|||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.2.0",
|
||||||
"erlpack": "github:discordapp/erlpack",
|
"erlpack": "github:discordapp/erlpack",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"firebase": "^7.14.3",
|
"firebase": "^7.14.6",
|
||||||
"firebase-admin": "^8.12.0",
|
"firebase-admin": "^8.12.1",
|
||||||
"fs": "0.0.1-security",
|
"fs": "0.0.1-security",
|
||||||
"genius-lyrics-api": "^2.0.3",
|
"genius-lyrics-api": "^2.0.3",
|
||||||
"he": "^1.2.0",
|
"he": "^1.2.0",
|
||||||
@ -43,7 +43,7 @@
|
|||||||
"utf-8-validate": "^5.0.2",
|
"utf-8-validate": "^5.0.2",
|
||||||
"video-thumbnail-url": "^1.0.1",
|
"video-thumbnail-url": "^1.0.1",
|
||||||
"yt-search": "^1.1.2",
|
"yt-search": "^1.1.2",
|
||||||
"ytdl-core": "^2.1.2",
|
"ytdl-core": "^2.1.5",
|
||||||
"zlib-sync": "^0.1.6"
|
"zlib-sync": "^0.1.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -18,7 +18,7 @@ module.exports = {
|
|||||||
if (queue.nigthCore)
|
if (queue.nigthCore)
|
||||||
return msg.channel.send(client.messages.disableNigthCore);
|
return msg.channel.send(client.messages.disableNigthCore);
|
||||||
if (isNaN(bass)) return msg.channel.send(client.messages.validNumber);
|
if (isNaN(bass)) return msg.channel.send(client.messages.validNumber);
|
||||||
if (bass > 100) return msg.channel.send(client.messages.maxBass);
|
if (bass > 10) return msg.channel.send(client.messages.maxBass);
|
||||||
if (bass < 0) return msg.channel.send(client.messages.positiveBass);
|
if (bass < 0) return msg.channel.send(client.messages.positiveBass);
|
||||||
queue.bass = bass;
|
queue.bass = bass;
|
||||||
client.funcs.end(
|
client.funcs.end(
|
||||||
|
@ -25,11 +25,16 @@ module.exports = {
|
|||||||
getLyrics(options).then((lyrics) => {
|
getLyrics(options).then((lyrics) => {
|
||||||
if (lyrics === null)
|
if (lyrics === null)
|
||||||
return msg.channel.send(client.messages.noResultsLyrics);
|
return msg.channel.send(client.messages.noResultsLyrics);
|
||||||
|
for (let i = 0; i < lyrics.length; i += 2000) {
|
||||||
|
let toi = ""
|
||||||
|
toi =
|
||||||
|
lyrics.substring(i, Math.min(lyrics.length, i + 2000));
|
||||||
const embed = new Discord.MessageEmbed()
|
const embed = new Discord.MessageEmbed()
|
||||||
.setTitle(client.messages.lyricsTitle)
|
.setTitle(client.messages.lyricsTitle)
|
||||||
.setDescription(lyrics)
|
.setDescription(toi)
|
||||||
.setColor(client.config.embedColor);
|
.setColor(client.config.embedColor);
|
||||||
msg.channel.send(embed);
|
msg.channel.send(embed);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
@ -8,15 +8,13 @@ module.exports = {
|
|||||||
category: "music",
|
category: "music",
|
||||||
async execute(msg, args, client, Discord, command) {
|
async execute(msg, args, client, Discord, command) {
|
||||||
const getThumb = require("video-thumbnail-url");
|
const getThumb = require("video-thumbnail-url");
|
||||||
const ytdl = require("ytdl-core");
|
|
||||||
const queue = client.queue.get(msg.guild.id);
|
const queue = client.queue.get(msg.guild.id);
|
||||||
if (!queue) return msg.channel.send(client.messages.noServerQueue);
|
if (!queue) return msg.channel.send(client.messages.noServerQueue);
|
||||||
let data = await Promise.resolve(ytdl.getInfo(queue.songs[0].url));
|
let songTime = (queue.songs[0].length * 1000).toFixed(0);
|
||||||
let songTime = (data.length_seconds * 1000).toFixed(0);
|
|
||||||
let completed = (
|
let completed = (
|
||||||
queue.connection.dispatcher.streamTime + queue.time
|
queue.connection.dispatcher.streamTime + queue.time
|
||||||
).toFixed(0);
|
).toFixed(0);
|
||||||
let barlength = 30;
|
let barlength = 20;
|
||||||
let completedpercent = ((completed / songTime) * barlength).toFixed(0);
|
let completedpercent = ((completed / songTime) * barlength).toFixed(0);
|
||||||
let array = [];
|
let array = [];
|
||||||
for (let i = 0; i < completedpercent - 1; i++) {
|
for (let i = 0; i < completedpercent - 1; i++) {
|
||||||
@ -35,7 +33,7 @@ module.exports = {
|
|||||||
}\n${array.join("")} | \`${client.funcs.msToTime(
|
}\n${array.join("")} | \`${client.funcs.msToTime(
|
||||||
completed,
|
completed,
|
||||||
"hh:mm:ss"
|
"hh:mm:ss"
|
||||||
)} / ${client.funcs.msToTime(songTime, "hh:mm:ss")}\``
|
)} / ${client.funcs.msToTime(songTime, "hh:mm:ss")}\`\nchannel: \`${queue.songs[0].channel.name}\``
|
||||||
)
|
)
|
||||||
.setFooter(`Queued by ${queue.songs[0].author.tag}`)
|
.setFooter(`Queued by ${queue.songs[0].author.tag}`)
|
||||||
.setURL(queue.songs[0].url)
|
.setURL(queue.songs[0].url)
|
||||||
@ -43,7 +41,7 @@ module.exports = {
|
|||||||
.setColor(client.config.embedColor);
|
.setColor(client.config.embedColor);
|
||||||
if (queue.nigthCore)
|
if (queue.nigthCore)
|
||||||
embed.setDescription(
|
embed.setDescription(
|
||||||
`${client.messages.nowPlayingDesc} ${queue.songs[0].title}`
|
`${client.messages.nowPlayingDesc} ${queue.songs[0].title} \nchannel: \`${queue.songs[0].channel.name}\``
|
||||||
);
|
);
|
||||||
return msg.channel.send(embed);
|
return msg.channel.send(embed);
|
||||||
},
|
},
|
||||||
|
@ -43,9 +43,7 @@ module.exports = {
|
|||||||
if (!voiceChannel.speakable)
|
if (!voiceChannel.speakable)
|
||||||
return msg.channel.send(client.messages.noPermsSpeak);
|
return msg.channel.send(client.messages.noPermsSpeak);
|
||||||
if (ytdl.validateURL(url)) {
|
if (ytdl.validateURL(url)) {
|
||||||
const song = await ytdl.getInfo(url);
|
|
||||||
const resource = {
|
const resource = {
|
||||||
title: song.title,
|
|
||||||
url: url
|
url: url
|
||||||
}
|
}
|
||||||
client.funcs.handleVideo(
|
client.funcs.handleVideo(
|
||||||
@ -53,7 +51,7 @@ module.exports = {
|
|||||||
msg,
|
msg,
|
||||||
voiceChannel,
|
voiceChannel,
|
||||||
client,
|
client,
|
||||||
true,
|
false,
|
||||||
"ytdl"
|
"ytdl"
|
||||||
);
|
);
|
||||||
} else if (url.match(/^https?:\/\/(open.spotify.com|spotify.com)(.*)$/)) {
|
} else if (url.match(/^https?:\/\/(open.spotify.com|spotify.com)(.*)$/)) {
|
||||||
|
@ -19,6 +19,7 @@ module.exports = {
|
|||||||
"%SONGS%",
|
"%SONGS%",
|
||||||
queue.songs.length - 1
|
queue.songs.length - 1
|
||||||
);
|
);
|
||||||
|
if (pos < 0) return msg.channel.send(client.messages.noSongsInQueue);
|
||||||
if (pos >= queue.songs.length) return msg.channel.send(message1);
|
if (pos >= queue.songs.length) return msg.channel.send(message1);
|
||||||
message2 = client.messages.removed.replace(
|
message2 = client.messages.removed.replace(
|
||||||
"%SONG%",
|
"%SONG%",
|
||||||
|
6
src/events/clientEvents/guildDelete.js
Normal file
6
src/events/clientEvents/guildDelete.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
name: "guildcreate",
|
||||||
|
async execute(client, guild) {
|
||||||
|
delete client.global.db.guilds[guild.id];
|
||||||
|
},
|
||||||
|
};
|
@ -19,9 +19,13 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldState.channel.members.size === 1 && oldState.channel === queue.voiceChannel || change) {
|
if (oldState.channel.members.size === 1 && oldState.channel === queue.voiceChannel || change) {
|
||||||
|
queue.textChannel.send(client.messages.leftAlonePaused);
|
||||||
|
queue.paused = true;
|
||||||
|
queue.connection.dispatcher.pause(true);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!queue || !queue.connection.dispatcher || queue.connection.dispatcher === null) return;
|
if (!queue || !queue.connection.dispatcher || queue.connection.dispatcher === null) return;
|
||||||
if (queue.voiceChannel.members.size === 1) {
|
if (queue.voiceChannel.members.size === 1) {
|
||||||
|
queue.textChannel.send(client.messages.leftAlone);
|
||||||
queue.songs = [];
|
queue.songs = [];
|
||||||
queue.looping = false;
|
queue.looping = false;
|
||||||
queue.endReason = "Timeout";
|
queue.endReason = "Timeout";
|
||||||
|
@ -63,6 +63,8 @@ module.exports = {
|
|||||||
joined: emojis.green_check_mark + "Joined",
|
joined: emojis.green_check_mark + "Joined",
|
||||||
joinSupport: "Join the musix support server: ",
|
joinSupport: "Join the musix support server: ",
|
||||||
keySet: emojis.green_check_mark + "Key set!",
|
keySet: emojis.green_check_mark + "Key set!",
|
||||||
|
leftAlone: "Music has been stopped since i was left alone for too long.",
|
||||||
|
leftAlonePaused: emojis.pause + "Paused the music as i have been left alone!",
|
||||||
loadingSongs: emojis.loading + "Loading song(s)",
|
loadingSongs: emojis.loading + "Loading song(s)",
|
||||||
looping: emojis.repeat + "Looping the queue now!",
|
looping: emojis.repeat + "Looping the queue now!",
|
||||||
loopingSong: emojis.repeatSong + "Looping **%TITLE%** now!",
|
loopingSong: emojis.repeatSong + "Looping **%TITLE%** now!",
|
||||||
@ -100,6 +102,7 @@ module.exports = {
|
|||||||
"I could not obtain any results!",
|
"I could not obtain any results!",
|
||||||
noServerQueue: emojis.redx + "There is nothing playing!",
|
noServerQueue: emojis.redx + "There is nothing playing!",
|
||||||
noSongs: emojis.redx + "That song does not exist!",
|
noSongs: emojis.redx + "That song does not exist!",
|
||||||
|
noSongsInQueue: emojis.redx + "There are no songs in the queue!",
|
||||||
notPremium: emojis.redx + "This is not a premium guild!",
|
notPremium: emojis.redx + "This is not a premium guild!",
|
||||||
nowPlayingDesc: emojis.notes + "**Now playing:**",
|
nowPlayingDesc: emojis.notes + "**Now playing:**",
|
||||||
notAllowed: emojis.redx + "You are not allowed to do that!",
|
notAllowed: emojis.redx + "You are not allowed to do that!",
|
||||||
|
@ -1,5 +1,30 @@
|
|||||||
module.exports = async function (client) {
|
module.exports = async function (client) {
|
||||||
client.guilds.cache.forEach((guild) => {
|
client.guilds.cache.forEach((guild) => {
|
||||||
|
if (!client.global.db.guilds[guild.id]) {
|
||||||
|
client.db.collection("guilds").doc(guild.id).set({
|
||||||
|
prefix: client.config.prefix,
|
||||||
|
defaultVolume: client.config.defaultVolume,
|
||||||
|
permissions: client.config.permissions,
|
||||||
|
dj: client.config.dj,
|
||||||
|
djrole: client.config.djrole,
|
||||||
|
startPlaying: client.config.startPlaying,
|
||||||
|
bass: client.config.bass,
|
||||||
|
blacklist: [],
|
||||||
|
premium: false,
|
||||||
|
});
|
||||||
|
client.global.db.guilds[guild.id] = {
|
||||||
|
prefix: client.config.prefix,
|
||||||
|
defaultVolume: client.config.defaultVolume,
|
||||||
|
permissions: client.config.permissions,
|
||||||
|
dj: client.config.dj,
|
||||||
|
djrole: client.config.djrole,
|
||||||
|
startPlaying: client.config.startPlaying,
|
||||||
|
bass: client.config.bass,
|
||||||
|
blacklist: [],
|
||||||
|
premium: false,
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (client.global.db.guilds[guild.id].prefix === undefined)
|
if (client.global.db.guilds[guild.id].prefix === undefined)
|
||||||
client.global.db.guilds[guild.id].prefix = client.config.prefix;
|
client.global.db.guilds[guild.id].prefix = client.config.prefix;
|
||||||
if (client.global.db.guilds[guild.id].defaultVolume === undefined)
|
if (client.global.db.guilds[guild.id].defaultVolume === undefined)
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
const Discord = require("discord.js");
|
||||||
|
const ytdl = require("ytdl-core");
|
||||||
|
|
||||||
module.exports = async function (
|
module.exports = async function (
|
||||||
resource,
|
resource,
|
||||||
msg,
|
msg,
|
||||||
@ -6,12 +9,14 @@ module.exports = async function (
|
|||||||
playlist,
|
playlist,
|
||||||
type
|
type
|
||||||
) {
|
) {
|
||||||
const Discord = require("discord.js");
|
const songInfo = await ytdl.getInfo(resource.url);
|
||||||
const song = {
|
const song = {
|
||||||
title: Discord.Util.escapeMarkdown(resource.title),
|
title: Discord.Util.escapeMarkdown(songInfo.title),
|
||||||
url: resource.url,
|
url: resource.url,
|
||||||
author: msg.author,
|
author: msg.author,
|
||||||
|
length: songInfo.length_seconds,
|
||||||
type: type,
|
type: type,
|
||||||
|
channel: songInfo.author
|
||||||
};
|
};
|
||||||
|
|
||||||
const queue = client.queue.get(msg.guild.id);
|
const queue = client.queue.get(msg.guild.id);
|
||||||
|
@ -65,7 +65,7 @@ module.exports = async function (guild, song, client, seek, play) {
|
|||||||
.on("error", (error) => {
|
.on("error", (error) => {
|
||||||
client.dispatcher.error(client, error, guild);
|
client.dispatcher.error(client, error, guild);
|
||||||
});
|
});
|
||||||
dispatcher.setVolume(queue.volume / 10);
|
dispatcher.setVolume(queue.volume / 100);
|
||||||
if ((client.global.db.guilds[guild.id].startPlaying && play) || play) {
|
if ((client.global.db.guilds[guild.id].startPlaying && play) || play) {
|
||||||
if (song.type !== "ytdl") return;
|
if (song.type !== "ytdl") return;
|
||||||
const data = await Promise.resolve(ytdl.getInfo(queue.songs[0].url));
|
const data = await Promise.resolve(ytdl.getInfo(queue.songs[0].url));
|
||||||
|
Loading…
Reference in New Issue
Block a user