1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-16 18:56:00 +00:00

Updated multiple things

This commit is contained in:
MatteZ02
2020-03-14 18:38:02 +02:00
parent ed1322cff6
commit 4a76582f76
31 changed files with 171 additions and 170 deletions

View File

@ -21,6 +21,7 @@ module.exports = class extends Client {
this.config = require('./config/config.js');
this.messages = require('./config/messages.js');
this.dispatcher.finish = require('../events/dispatcher/finish.js');
this.dispatcher.error = require('../events/dispatcher/error.js');
fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => {
this.funcs[filename.slice(0, -3)] = require(`./funcs/${filename}`);

View File

@ -16,6 +16,7 @@ module.exports = {
bugTitle: "Found a bug with Musix?\nDM the core developer:",
cancellingVideoSelection: "<:redx:674263474704220182> Cancelling video selection",
cantSkipToCurrent: "<:redx:674263474704220182> You can't skip to the song currently playing!",
channelFull: "<:redx:674263474704220182> Your voice channel is full!",
cmdUsesFooter: "These statistics are from the current uptime.",
cmdUsesTitle: "Musix Command Usage During Current Uptime",
correctUsage: "<:redx:674263474704220182> correct usage: ",
@ -113,6 +114,7 @@ module.exports = {
shuffled: "<:shuffle:674685595980791871> Queue suffled!",
skipped: "<:skip:674685614221688832> Skipped the song!",
songAdded: "<:green_check_mark:674265384777416705> **%TITLE%** has been added to the queue!",
songBlockedWMG: "<:redx:674263474704220182> This song had been blocked by WMG (Warner Music Groud).\n<:skip:674685614221688832> Skipped to next song.",
songSelection: "__Song Selection__",
startPlaying: "<a:aNotes:674602408105476106> Start playing: ",
statusField1: ":signal_strength: Ping",

View File

@ -1,12 +1,12 @@
module.exports = function (client, msg, command) {
const serverQueue = client.queue.get(msg.guild.id);
const queue = client.queue.get(msg.guild.id);
const permissions = msg.channel.permissionsFor(msg.author);
if (!serverQueue || !serverQueue.playing) {
if (!queue || !queue.playing) {
msg.channel.send(client.messages.noServerQueue);
return false;
}
if (msg.author.id !== client.config.devId) {
if (msg.member.voice.channel !== serverQueue.voiceChannel) {
if (msg.member.voice.channel !== queue.voiceChannel) {
msg.channel.send(client.messages.wrongVoiceChannel);
return false;
}

View File

@ -7,10 +7,10 @@ module.exports = async function (video, msg, voiceChannel, client, playlist = fa
author: msg.author
}
const serverQueue = client.queue.get(msg.guild.id);
const queue = client.queue.get(msg.guild.id);
if (serverQueue) {
serverQueue.songs.push(song);
if (queue) {
queue.songs.push(song);
if (playlist) return;
let message;
message = client.messages.songAdded.replace("%TITLE%", song.title);

View File

@ -3,38 +3,34 @@ module.exports = async function (guild, song, client, seek, play) {
const ytdl = require('ytdl-core');
const getThumb = require('video-thumbnail-url');
const serverQueue = client.queue.get(guild.id);
const queue = client.queue.get(guild.id);
if (!song) {
serverQueue.voiceChannel.leave();
queue.voiceChannel.leave();
client.queue.delete(guild.id);
return;
}
const dispatcher = serverQueue.connection
.play(await ytdl(song.url, { filter: "audio", highWaterMark: 1 << 25, volume: false, begin: seek }), { seek: 0, bitrate: 1024, passes: 10, volume: 1, bassboost: serverQueue.bass })
const dispatcher = queue.connection
.play(await ytdl(song.url, { filter: "audio", highWaterMark: 1 << 25, volume: false, begin: seek }), { seek: 0, bitrate: 1024, passes: 10, volume: 1, bassboost: queue.bass })
.on("finish", () => {
client.dispatcher.finish(client, serverQueue.endReason, guild);
client.dispatcher.finish(client, queue.endReason, guild);
});
dispatcher.on('start', () => {
dispatcher.player.streamingData.pausedTime = 0;
});
dispatcher.on('error', error => {
console.error(error);
client.debug_channel.send(client.messages.dispatcherError + error);
serverQueue.voiceChannel.leave();
client.queue.delete(guild.id);
return serverQueue.textChannel.send(client.messages.errorDispatcher);
client.dispatcher.error(client, error, guild);
});
dispatcher.setVolume(serverQueue.volume / 10);
dispatcher.setVolume(queue.volume / 10);
if (client.global.db.guilds[guild.id].startPlaying || play) {
const data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
const data = await Promise.resolve(ytdl.getInfo(queue.songs[0].url));
const songtime = (data.length_seconds * 1000).toFixed(0);
const thumbnail = getThumb(serverQueue.songs[0].url);
const thumbnail = getThumb(queue.songs[0].url);
const embed = new Discord.MessageEmbed()
.setTitle(`${client.messages.startPlaying}**${song.title}**`)
.setDescription(`Song duration: \`${client.funcs.msToTime(songtime, "hh:mm:ss")}\``)
.setThumbnail(thumbnail._rejectionHandler0)
.setColor(client.config.embedColor)
serverQueue.textChannel.send(embed);
queue.textChannel.send(embed);
}
serverQueue.playing = true;
queue.playing = true;
}