mirror of
https://github.com/musix-org/musix-oss
synced 2025-06-16 18:56:00 +00:00
Update 3.0.2
This commit is contained in:
@ -68,6 +68,9 @@ module.exports = class extends Client {
|
||||
this.on('voiceStateUpdate', (newMember) => {
|
||||
require(`${events}voiceStateUpdate`).execute(this, newMember);
|
||||
});
|
||||
this.on('error', (error) => {
|
||||
client.channels.fetch(client.config.debug_channel).send('Error: ' + error);
|
||||
});
|
||||
|
||||
this.login(this.config.token).catch(err => console.log('Failed to login: ' + err));
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ module.exports = {
|
||||
embedColor: "#b50002",
|
||||
invite: "https://discordapp.com/api/oauth2/authorize?client_id=607266889537945605&permissions=3427328&redirect_uri=https%3A%2F%2Fdiscordapp.com%2Foauth2%2Fauthorize%3Fclient_id%3D607266889537945605%26%3Bscope%3Dbot%26%3Bpermissions%3D0&scope=bot",
|
||||
//Settings
|
||||
devMode: false,
|
||||
dblApi: true,
|
||||
devMode: true,
|
||||
dblApi: false,
|
||||
saveDB: true,
|
||||
//db values
|
||||
prefix: ">",
|
||||
@ -26,4 +26,5 @@ module.exports = {
|
||||
dj: false,
|
||||
djrole: null,
|
||||
startPlaying: true,
|
||||
bass: 1,
|
||||
}
|
||||
|
17
struct/config/queueConfig.js
Normal file
17
struct/config/queueConfig.js
Normal file
@ -0,0 +1,17 @@
|
||||
module.exports = {
|
||||
textChannel: null,
|
||||
voiceChannel: null,
|
||||
connection: null,
|
||||
songs: [],
|
||||
volume: null,
|
||||
bass: null,
|
||||
playing: false,
|
||||
paused: false,
|
||||
looping: false,
|
||||
songLooping: false,
|
||||
votes: 0,
|
||||
voters: [],
|
||||
votesNeeded: null,
|
||||
time: 0,
|
||||
endReason: null,
|
||||
}
|
@ -11,8 +11,7 @@ module.exports = function (msg, args, client, Discord, prefix, command) {
|
||||
.setTitle(`Musix ${error.toString()}`)
|
||||
.setDescription(error.stack.replace(/at /g, '**at **'))
|
||||
.setColor('#b50002');
|
||||
//client.fetchUser(client.config.devId).then(user => user.send(embed)).catch(console.error);
|
||||
//client.channels.get(client.config.debug_channel).send(embed);
|
||||
client.debug_channel.send(embed);
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
@ -3,6 +3,6 @@ module.exports = async function (client) {
|
||||
await client.channels.fetch(client.config.secondary_test_channel)
|
||||
.then(x => x.join());
|
||||
} catch (error) {
|
||||
client.channels.get(client.config.debug_channel).send("Error detected: " + error);
|
||||
client.debug_channel.send("Error detected: " + error);
|
||||
}
|
||||
};
|
@ -6,28 +6,21 @@ module.exports = async function (video, msg, voiceChannel, client, playlist = fa
|
||||
url: `https://www.youtube.com/watch?v=${video.id}`,
|
||||
author: msg.author
|
||||
}
|
||||
|
||||
const serverQueue = client.queue.get(msg.guild.id);
|
||||
|
||||
if (serverQueue) {
|
||||
serverQueue.songs.push(song);
|
||||
if (playlist) return;
|
||||
return msg.channel.send(`<:green_check_mark:674265384777416705> **${song.title}** has been added to the queue!`);
|
||||
}
|
||||
|
||||
const construct = {
|
||||
textChannel: msg.channel,
|
||||
voiceChannel: voiceChannel,
|
||||
connection: null,
|
||||
songs: [],
|
||||
volume: client.global.db.guilds[msg.guild.id].defaultVolume,
|
||||
playing: false,
|
||||
paused: false,
|
||||
looping: false,
|
||||
songLooping: false,
|
||||
votes: 0,
|
||||
voters: [],
|
||||
votesNeeded: null,
|
||||
time: 0,
|
||||
};
|
||||
const construct = require("../config/queueConfig.js");
|
||||
construct.textChannel = msg.channel;
|
||||
construct.voiceChannel = voiceChannel;
|
||||
construct.volume = client.global.db.guilds[msg.guild.id].defaultVolume;
|
||||
construct.bass = client.global.db.guilds[msg.guild.id].bass;
|
||||
|
||||
construct.songs.push(song);
|
||||
client.queue.set(msg.guild.id, construct);
|
||||
|
||||
@ -37,7 +30,7 @@ module.exports = async function (video, msg, voiceChannel, client, playlist = fa
|
||||
client.funcs.play(msg.guild, construct.songs[0], client, 0, true);
|
||||
} catch (error) {
|
||||
client.queue.delete(msg.guild.id);
|
||||
//client.channels.get(client.config.debug_channel).send("Error with connecting to voice channel: " + error);
|
||||
client.debug_channel.send("Error with connecting to voice channel: " + error);
|
||||
return msg.channel.send(`<:redx:674263474704220182> An error occured: ${error}`);
|
||||
}
|
||||
return;
|
||||
|
@ -2,7 +2,6 @@ module.exports = async function (guild, song, client, seek, play) {
|
||||
const Discord = require('discord.js');
|
||||
const ytdl = require('ytdl-core');
|
||||
const getThumb = require('video-thumbnail-url');
|
||||
const prism = require('prism-media');
|
||||
|
||||
const serverQueue = client.queue.get(guild.id);
|
||||
if (!song) {
|
||||
@ -13,15 +12,16 @@ module.exports = async function (guild, song, client, seek, play) {
|
||||
}
|
||||
|
||||
const dispatcher = serverQueue.connection
|
||||
.play(await ytdl(song.url, { filter: "audio", highWaterMark: 1 << 25, volume: false }), { seek: seek, bitrate: 1024, passes: 10, volume: 1 })
|
||||
.on("finish", reason => {
|
||||
client.dispatcher.finish(client, reason, guild);
|
||||
.play(await ytdl(song.url, { filter: "audio", highWaterMark: 1 << 25, volume: false }), { seek: seek, bitrate: 1024, passes: 10, volume: 1, bassboost: serverQueue.bass })
|
||||
.on("end", () => {
|
||||
client.dispatcher.finish(client, serverQueue.endReason, guild);
|
||||
});
|
||||
dispatcher.on('start', () => {
|
||||
dispatcher.player.streamingData.pausedTime = 0;
|
||||
});
|
||||
dispatcher.on('error', error => {
|
||||
console.error(error);
|
||||
client.debug_channel.send('Error with the dispatcher: ' + error);
|
||||
serverQueue.voiceChannel.leave();
|
||||
client.queue.delete(guild.id);
|
||||
return serverQueue.textChannel.send('<:redx:674263474704220182> An error has occured while playing music! The queue has been deleted.');
|
||||
|
Reference in New Issue
Block a user