1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 03:33:17 +00:00

Debug channel conflict resolved

This commit is contained in:
MatteZ02 2020-04-06 00:20:34 +03:00
parent a06f616a98
commit a47ffd1012
16 changed files with 314 additions and 560 deletions

View File

@ -1,6 +1,7 @@
const config = require("./src/struct/config/config.ts"); const config = require("./src/struct/config/config.ts");
if (config.devMode) { if (config.devMode) {
console.log('- dev mode- ');
config.token = config.devToken; config.token = config.devToken;
config.shards = 1; config.shards = 1;
} }
@ -8,6 +9,6 @@ if (config.devMode) {
const { ShardingManager } = require('discord.js'); const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./src/bot.ts', { token: config.token, respawn: config.respawn, totalShards: config.shards }); const manager = new ShardingManager('./src/bot.ts', { token: config.token, respawn: config.respawn, totalShards: config.shards });
console.log('Launching shards...'); console.log('- Launching shards -');
manager.spawn(config.shards, config.shardDelay, config.shardTimeout); manager.spawn(config.shards, config.shardDelay, config.shardTimeout);
manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`)); manager.on('shardCreate', shard => console.log(`- Launched shard ${shard.id} -`));

824
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,11 +19,11 @@
"dependencies": { "dependencies": {
"@discordjs/opus": "^0.1.0", "@discordjs/opus": "^0.1.0",
"dblapi.js": "^2.4.0", "dblapi.js": "^2.4.0",
"discord.js": "^12.0.2", "discord.js": "^12.1.1",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"ffmpeg": "0.0.4", "ffmpeg": "0.0.4",
"firebase": "^7.10.0", "firebase": "^7.13.1",
"firebase-admin": "^8.9.2", "firebase-admin": "^8.10.0",
"fs": "0.0.1-security", "fs": "0.0.1-security",
"he": "^1.2.0", "he": "^1.2.0",
"ms": "^2.1.2", "ms": "^2.1.2",
@ -32,7 +32,6 @@
"simple-youtube-api": "^5.2.1", "simple-youtube-api": "^5.2.1",
"video-thumbnail-url": "^1.0.1", "video-thumbnail-url": "^1.0.1",
"yt-search": "^1.1.2", "yt-search": "^1.1.2",
"ytdl-core": "^1.0.9", "ytdl-core": "^1.0.9"
"ytdl-core-discord": "^1.1.0"
} }
} }

View File

@ -17,7 +17,7 @@ module.exports = {
msg.channel.send(`${client.messages.joined} ${voiceChannel.name}!`); msg.channel.send(`${client.messages.joined} ${voiceChannel.name}!`);
} catch (error) { } catch (error) {
client.queue.delete(msg.guild.id); client.queue.delete(msg.guild.id);
client.channels.get(client.config.debug_channel).send(client.messages.errorConnecting + error); client.users.cache.get(client.config.devId).send(client.messages.errorConnecting + error);
return msg.channel.send(client.messages.error); return msg.channel.send(client.messages.error);
} }
} }

View File

@ -16,7 +16,7 @@ module.exports = {
msg.channel.send(message); msg.channel.send(message);
} else { } else {
queue.songLooping = false; queue.songLooping = false;
msg.channel.send(message); msg.channel.send(client.messages.noLoopingSong);
} }
} }
} }

View File

@ -11,7 +11,6 @@ module.exports = {
category: 'music', category: 'music',
async execute(msg, args, client, Discord, command) { async execute(msg, args, client, Discord, command) {
const searchString = args.slice(1).join(" "); const searchString = args.slice(1).join(" ");
const url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : "";
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
const voiceChannel = msg.member.voice.channel; const voiceChannel = msg.member.voice.channel;
if (!queue) { if (!queue) {

View File

@ -35,7 +35,7 @@ module.exports = {
.setDescription(error.stack.replace(/at /g, '**at **')) .setDescription(error.stack.replace(/at /g, '**at **'))
.setColor(client.config.embedColor); .setColor(client.config.embedColor);
client.fetchUser(client.config.devId).then(user => user.send(embed)).catch(console.error); client.fetchUser(client.config.devId).then(user => user.send(embed)).catch(console.error);
client.channels.get(client.config.debug_channel).send(embed); client.users.cache.get(client.config.devId).send(embed);
} }
} else { } else {
return msg.channel.send(embed); return msg.channel.send(embed);

View File

@ -42,9 +42,9 @@ function vote(queue, msg, client) {
queue.voters = []; queue.voters = [];
queue.votes = 0; queue.votes = 0;
queue.votesNeeded = null; queue.votesNeeded = null;
return skipSong(queue, msg); return skipSong(queue, msg, client);
} else return msg.channel.send(`${client.messages.notEnoughVotes} ${queue.votes} / ${queue.votesNeeded}!`); } else return msg.channel.send(`${client.messages.notEnoughVotes} ${queue.votes} / ${queue.votesNeeded}!`);
} else { } else {
return skipSong(queue, msg); return skipSong(queue, msg, client);
} }
}; };

View File

@ -9,7 +9,10 @@ module.exports = {
if (msg.mentions.users.first()) { if (msg.mentions.users.first()) {
if (msg.mentions.users.first().id === client.user.id) { if (msg.mentions.users.first().id === client.user.id) {
if (!args[1]) return; if (!args[1]) return;
if (args[1] === 'prefix') return msg.channel.send(`${client.messages.prefixHere}\`${prefix}\`.`); if (args[1] === 'prefix') {
if (!args[2]) return msg.channel.send(`${client.messages.prefixHere}\`${prefix}\`.`);
if (args[2] === "=" && args[3]) return prefix = args[3];
}
if (args[1] === 'help') { if (args[1] === 'help') {
const command = client.commands.get("help"); const command = client.commands.get("help");
return client.funcs.exe(msg, args, client, Discord, prefix, command); return client.funcs.exe(msg, args, client, Discord, prefix, command);

View File

@ -3,14 +3,11 @@ const DBL = require("dblapi.js");
module.exports = { module.exports = {
name: 'ready', name: 'ready',
async execute(client, Discord) { async execute(client, Discord) {
const debugChannel = await client.channels.fetch(client.config.debug_channel);
client.debug_channel = debugChannel
const remoteMusixGuildsData = await client.funcs.dbget('guilds', null, client); const remoteMusixGuildsData = await client.funcs.dbget('guilds', null, client);
remoteMusixGuildsData.forEach(guildData => { remoteMusixGuildsData.forEach(guildData => {
client.global.db.guilds[guildData.id] = guildData.d; client.global.db.guilds[guildData.id] = guildData.d;
}); });
if (client.config.devMode) { if (client.config.devMode) {
console.log('dev mode');
client.guilds.cache.forEach(guild => { client.guilds.cache.forEach(guild => {
client.global.db.guilds[guild.id] = { client.global.db.guilds[guild.id] = {
prefix: client.config.prefix, prefix: client.config.prefix,

View File

@ -6,7 +6,7 @@ module.exports = async function (client, error, guild) {
queue.connection.dispatcher.end(); queue.connection.dispatcher.end();
return queue.textChannel.send(client.messages.songBlockedWMG); return queue.textChannel.send(client.messages.songBlockedWMG);
}*/ }*/
client.debug_channel.send(client.messages.dispatcherError + error); client.users.cache.get(client.config.devId).send(client.messages.dispatcherError + error);
queue.voiceChannel.leave(); queue.voiceChannel.leave();
client.queue.delete(guild.id); client.queue.delete(guild.id);
return queue.textChannel.send(client.messages.errorDispatcher); return queue.textChannel.send(client.messages.errorDispatcher);

View File

@ -6,15 +6,14 @@ module.exports = {
dblKey: process.env.DBLKEY, dblKey: process.env.DBLKEY,
api_key: process.env.GOOGLE_API_KEY, api_key: process.env.GOOGLE_API_KEY,
testServer: "489111553321336832", testServer: "489111553321336832",
debug_channel: "634718645188034560",
primary_test_channel: "617633098296721409", primary_test_channel: "617633098296721409",
secondary_test_channel: "570531724002328577", secondary_test_channel: "570531724002328577",
devId: "360363051792203779", devId: "360363051792203779",
embedColor: "#b50002", embedColor: "#b50002",
invite: "https://discordapp.com/oauth2/authorize?client_id=607266889537945605&permissions=3427328&scope=bot", invite: "https://discordapp.com/oauth2/authorize?client_id=607266889537945605&permissions=3427328&scope=bot",
supportServer: "https://discord.gg/rvHuJtB", supportServer: "https://discord.gg/rvHuJtB",
devMode: false, devMode: true,
dblApi: false, api: false,
saveDB: true, saveDB: true,
respawn: true, respawn: true,
shards: 10, shards: 10,

View File

@ -18,7 +18,7 @@ module.exports = function (client, msg, command) {
} else return true; } else return true;
} else if (!permissions.has(command.permission)) { } else if (!permissions.has(command.permission)) {
let message let message
message = client.messages.noPerms.replace("%PERMS%", commands.permissions); message = client.messages.noPerms.replace("%PERMS%", command.permissions);
msg.channel.send(message); msg.channel.send(message);
return false; return false;
} else return true; } else return true;

View File

@ -13,7 +13,7 @@ module.exports = function (msg, args, client, Discord, command) {
.setDescription(error.stack.replace(/at /g, '**at **')) .setDescription(error.stack.replace(/at /g, '**at **'))
.setFooter(`guild: ${msg.guild.id} (${msg.guild.name}), user: ${msg.member.id} (${msg.member.displayName}), channel: ${msg.channel.id} (${msg.channel.name}), date: ${date}, Shard: ${client.shard.ids}`) .setFooter(`guild: ${msg.guild.id} (${msg.guild.name}), user: ${msg.member.id} (${msg.member.displayName}), channel: ${msg.channel.id} (${msg.channel.name}), date: ${date}, Shard: ${client.shard.ids}`)
.setColor('#b50002'); .setColor('#b50002');
client.debug_channel.send(embed); client.users.cache.get(client.devId).send(embed);
console.error(error); console.error(error);
} }
}; };

View File

@ -4,6 +4,6 @@ module.exports = async function (client) {
await client.channels.fetch(client.config.secondary_test_channel) await client.channels.fetch(client.config.secondary_test_channel)
.then(x => x.join()); .then(x => x.join());
} catch (error) { } catch (error) {
client.debug_channel.send(client.messages.errorDetected + error); client.users.cache.get(client.config.devId).send(client.messages.errorDetected + error);
} }
}; };

View File

@ -33,7 +33,7 @@ module.exports = async function (video, msg, voiceChannel, client, playlist = fa
client.funcs.play(msg.guild, construct.songs[0], client, 0, true); client.funcs.play(msg.guild, construct.songs[0], client, 0, true);
} catch (error) { } catch (error) {
client.queue.delete(msg.guild.id); client.queue.delete(msg.guild.id);
client.debug_channel.send(client.messages.errorConnecting + error); client.users.cache.get(client.config.devId).send(client.messages.errorConnecting + error);
return msg.channel.send(client.messages.error); return msg.channel.send(client.messages.error);
} }
return; return;