1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-22 21:13:18 +00:00

Update 3.5

This commit is contained in:
MatteZ02 2020-06-04 08:26:33 +03:00
parent 256585293e
commit 0874818101
12 changed files with 71 additions and 26 deletions

View File

@ -1,6 +1,6 @@
{
"name": "musix",
"version": "3.4.1",
"version": "3.5.0",
"description": "V3 for Musix the discord music bot",
"main": "./index.js",
"scripts": {
@ -27,8 +27,8 @@
"dotenv": "^8.2.0",
"erlpack": "github:discordapp/erlpack",
"express": "^4.17.1",
"firebase": "^7.14.3",
"firebase-admin": "^8.12.0",
"firebase": "^7.14.6",
"firebase-admin": "^8.12.1",
"fs": "0.0.1-security",
"genius-lyrics-api": "^2.0.3",
"he": "^1.2.0",
@ -43,7 +43,7 @@
"utf-8-validate": "^5.0.2",
"video-thumbnail-url": "^1.0.1",
"yt-search": "^1.1.2",
"ytdl-core": "^2.1.2",
"ytdl-core": "^2.1.5",
"zlib-sync": "^0.1.6"
}
}
}

View File

@ -18,7 +18,7 @@ module.exports = {
if (queue.nigthCore)
return msg.channel.send(client.messages.disableNigthCore);
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);
queue.bass = bass;
client.funcs.end(

View File

@ -25,11 +25,16 @@ module.exports = {
getLyrics(options).then((lyrics) => {
if (lyrics === null)
return msg.channel.send(client.messages.noResultsLyrics);
const embed = new Discord.MessageEmbed()
.setTitle(client.messages.lyricsTitle)
.setDescription(lyrics)
.setColor(client.config.embedColor);
msg.channel.send(embed);
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()
.setTitle(client.messages.lyricsTitle)
.setDescription(toi)
.setColor(client.config.embedColor);
msg.channel.send(embed);
}
});
},
};

View File

@ -8,15 +8,13 @@ module.exports = {
category: "music",
async execute(msg, args, client, Discord, command) {
const getThumb = require("video-thumbnail-url");
const ytdl = require("ytdl-core");
const queue = client.queue.get(msg.guild.id);
if (!queue) return msg.channel.send(client.messages.noServerQueue);
let data = await Promise.resolve(ytdl.getInfo(queue.songs[0].url));
let songTime = (data.length_seconds * 1000).toFixed(0);
let songTime = (queue.songs[0].length * 1000).toFixed(0);
let completed = (
queue.connection.dispatcher.streamTime + queue.time
).toFixed(0);
let barlength = 30;
let barlength = 20;
let completedpercent = ((completed / songTime) * barlength).toFixed(0);
let array = [];
for (let i = 0; i < completedpercent - 1; i++) {
@ -35,7 +33,7 @@ module.exports = {
}\n${array.join("")} | \`${client.funcs.msToTime(
completed,
"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}`)
.setURL(queue.songs[0].url)
@ -43,7 +41,7 @@ module.exports = {
.setColor(client.config.embedColor);
if (queue.nigthCore)
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);
},

View File

@ -43,9 +43,7 @@ module.exports = {
if (!voiceChannel.speakable)
return msg.channel.send(client.messages.noPermsSpeak);
if (ytdl.validateURL(url)) {
const song = await ytdl.getInfo(url);
const resource = {
title: song.title,
url: url
}
client.funcs.handleVideo(
@ -53,7 +51,7 @@ module.exports = {
msg,
voiceChannel,
client,
true,
false,
"ytdl"
);
} else if (url.match(/^https?:\/\/(open.spotify.com|spotify.com)(.*)$/)) {

View File

@ -19,6 +19,7 @@ module.exports = {
"%SONGS%",
queue.songs.length - 1
);
if (pos < 0) return msg.channel.send(client.messages.noSongsInQueue);
if (pos >= queue.songs.length) return msg.channel.send(message1);
message2 = client.messages.removed.replace(
"%SONG%",

View File

@ -0,0 +1,6 @@
module.exports = {
name: "guildcreate",
async execute(client, guild) {
delete client.global.db.guilds[guild.id];
},
};

View File

@ -19,9 +19,13 @@ module.exports = {
}
}
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(() => {
if (!queue || !queue.connection.dispatcher || queue.connection.dispatcher === null) return;
if (queue.voiceChannel.members.size === 1) {
queue.textChannel.send(client.messages.leftAlone);
queue.songs = [];
queue.looping = false;
queue.endReason = "Timeout";

View File

@ -63,6 +63,8 @@ module.exports = {
joined: emojis.green_check_mark + "Joined",
joinSupport: "Join the musix support server: ",
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)",
looping: emojis.repeat + "Looping the queue now!",
loopingSong: emojis.repeatSong + "Looping **%TITLE%** now!",
@ -100,6 +102,7 @@ module.exports = {
"I could not obtain any results!",
noServerQueue: emojis.redx + "There is nothing playing!",
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!",
nowPlayingDesc: emojis.notes + "**Now playing:**",
notAllowed: emojis.redx + "You are not allowed to do that!",

View File

@ -1,10 +1,35 @@
module.exports = async function (client) {
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)
client.global.db.guilds[guild.id].prefix = client.config.prefix;
if (client.global.db.guilds[guild.id].defaultVolume === undefined)
client.global.db.guilds[guild.id].defaultVolume =
client.config.defaultVolume;
client.config.defaultVolume;
if (client.global.db.guilds[guild.id].permissions === undefined)
client.global.db.guilds[guild.id].permissions = client.config.permissions;
if (client.global.db.guilds[guild.id].dj === undefined)
@ -13,7 +38,7 @@ module.exports = async function (client) {
client.global.db.guilds[guild.id].djrole = client.config.djrole;
if (client.global.db.guilds[guild.id].startPlaying === undefined)
client.global.db.guilds[guild.id].startPlaying =
client.config.startPlaying;
client.config.startPlaying;
if (client.global.db.guilds[guild.id].bass === undefined)
client.global.db.guilds[guild.id].bass = client.config.bass;
if (client.global.db.guilds[guild.id].blacklsit === undefined)
@ -21,4 +46,4 @@ module.exports = async function (client) {
if (client.global.db.guilds[guild.id].premium === undefined)
client.global.db.guilds[guild.id].premium = false;
});
};
};

View File

@ -1,3 +1,6 @@
const Discord = require("discord.js");
const ytdl = require("ytdl-core");
module.exports = async function (
resource,
msg,
@ -6,12 +9,14 @@ module.exports = async function (
playlist,
type
) {
const Discord = require("discord.js");
const songInfo = await ytdl.getInfo(resource.url);
const song = {
title: Discord.Util.escapeMarkdown(resource.title),
title: Discord.Util.escapeMarkdown(songInfo.title),
url: resource.url,
author: msg.author,
length: songInfo.length_seconds,
type: type,
channel: songInfo.author
};
const queue = client.queue.get(msg.guild.id);

View File

@ -65,7 +65,7 @@ module.exports = async function (guild, song, client, seek, play) {
.on("error", (error) => {
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 (song.type !== "ytdl") return;
const data = await Promise.resolve(ytdl.getInfo(queue.songs[0].url));