mirror of
https://github.com/musix-org/musix-oss
synced 2024-12-22 21:13:18 +00:00
commit
ac96a99e1c
@ -9,7 +9,7 @@ module.exports = {
|
|||||||
if (serverQueue) {
|
if (serverQueue) {
|
||||||
let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
|
let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
|
||||||
}
|
}
|
||||||
if (message.author.id !== client.global.devId) return message.channel.send(':x: You are not allowed to do that!');
|
if (message.author.id !== client.config.devId) return message.channel.send(':x: You are not allowed to do that!');
|
||||||
const input = message.content.slice(prefix.length + 4);
|
const input = message.content.slice(prefix.length + 4);
|
||||||
let output;
|
let output;
|
||||||
try {
|
try {
|
||||||
@ -23,4 +23,4 @@ module.exports = {
|
|||||||
.setDescription(`Input: \`\`\`js\n${input.replace(/; /g, ';').replace(/;/g, ';\n')}\n\`\`\`\nOutput: \`\`\`\n${output}\n\`\`\``);
|
.setDescription(`Input: \`\`\`js\n${input.replace(/; /g, ';').replace(/;/g, ';\n')}\n\`\`\`\nOutput: \`\`\`\n${output}\n\`\`\``);
|
||||||
return message.channel.send(embed);
|
return message.channel.send(embed);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@ module.exports = {
|
|||||||
alias: 'fs',
|
alias: 'fs',
|
||||||
cooldown: 5,
|
cooldown: 5,
|
||||||
execute(message, args, client, Discord, prefix) {
|
execute(message, args, client, Discord, prefix) {
|
||||||
if (message.author.id !== client.global.devId) return message.channel.send(':x: You are not allowed to do that!')
|
if (message.author.id !== client.config.devId) return message.channel.send(':x: You are not allowed to do that!')
|
||||||
client.queue.delete(message.guild.id);
|
client.queue.delete(message.guild.id);
|
||||||
message.channel.send('queue deleted')
|
message.channel.send('queue deleted')
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ module.exports = {
|
|||||||
const permissions = message.channel.permissionsFor(message.author);
|
const permissions = message.channel.permissionsFor(message.author);
|
||||||
const { voiceChannel } = message.member;
|
const { voiceChannel } = message.member;
|
||||||
if (serverQueue) {
|
if (serverQueue) {
|
||||||
if (message.author.id !== client.global.devId) {
|
if (message.author.id !== client.config.devId) {
|
||||||
if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to loop the queue!');
|
if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to loop the queue!');
|
||||||
if (client.global.db.guilds[message.guild.id].permissions === true) {
|
if (client.global.db.guilds[message.guild.id].permissions === true) {
|
||||||
if (client.global.db.guilds[message.guild.id].dj) {
|
if (client.global.db.guilds[message.guild.id].dj) {
|
||||||
|
@ -9,7 +9,7 @@ module.exports = {
|
|||||||
const { voiceChannel } = message.member;
|
const { voiceChannel } = message.member;
|
||||||
if (serverQueue && serverQueue.playing === true) {
|
if (serverQueue && serverQueue.playing === true) {
|
||||||
if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to pause the music!');
|
if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to pause the music!');
|
||||||
if (message.author.id !== client.global.devId) {
|
if (message.author.id !== client.config.devId) {
|
||||||
if (client.global.db.guilds[message.guild.id].permissions === true) {
|
if (client.global.db.guilds[message.guild.id].permissions === true) {
|
||||||
if (client.global.db.guilds[message.guild.id].dj) {
|
if (client.global.db.guilds[message.guild.id].dj) {
|
||||||
if (!message.member.roles.has(client.global.db.guilds[message.guild.id].djrole)) return message.channel.send(':x: You need the `DJ` role to pause the music!');
|
if (!message.member.roles.has(client.global.db.guilds[message.guild.id].djrole)) return message.channel.send(':x: You need the `DJ` role to pause the music!');
|
||||||
@ -22,4 +22,4 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
return message.channel.send(':x: There is nothing playing.');
|
return message.channel.send(':x: There is nothing playing.');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,7 @@ module.exports = {
|
|||||||
.setAuthor(client.user.username, client.user.displayAvatarURL)
|
.setAuthor(client.user.username, client.user.displayAvatarURL)
|
||||||
.setColor('#b50002')
|
.setColor('#b50002')
|
||||||
const permissions = message.channel.permissionsFor(message.author);
|
const permissions = message.channel.permissionsFor(message.author);
|
||||||
if (message.author.id !== client.global.devId) {
|
if (message.author.id !== client.config.devId) {
|
||||||
if (client.global.db.guilds[message.guild.id].dj) {
|
if (client.global.db.guilds[message.guild.id].dj) {
|
||||||
if (!message.member.roles.has(client.global.db.guilds[message.guild.id].djrole)) return message.channel.send(':x: You need the `DJ` role to modify or play the playlist!');
|
if (!message.member.roles.has(client.global.db.guilds[message.guild.id].djrole)) return message.channel.send(':x: You need the `DJ` role to modify or play the playlist!');
|
||||||
} else if (!permissions.has('MANAGE_GUILD')) return message.channel.send(':x: You need the `MANAGE_SERVER` permission to modify the playlist!');
|
} else if (!permissions.has('MANAGE_GUILD')) return message.channel.send(':x: You need the `MANAGE_SERVER` permission to modify the playlist!');
|
||||||
@ -38,7 +38,7 @@ module.exports = {
|
|||||||
.setDescription(error.stack.replace(/at /g, '**at **'))
|
.setDescription(error.stack.replace(/at /g, '**at **'))
|
||||||
.setColor('#b50002');
|
.setColor('#b50002');
|
||||||
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('634718645188034560').send(embed);
|
client.channels.get(client.config.debug_channel).send(embed);
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -13,7 +13,7 @@ module.exports = {
|
|||||||
if (isNaN(pos)) return message.channel.send(':x: You need to enter a number!');
|
if (isNaN(pos)) return message.channel.send(':x: You need to enter a number!');
|
||||||
if (pos === 0) return message.channel.send(':x: You can not remove the currently playing song!');
|
if (pos === 0) return message.channel.send(':x: You can not remove the currently playing song!');
|
||||||
if (pos > serverQueue.songs.size) return message.channel.send(`:x: There is only ${serverQueue.songs.size} amount of songs in the queue!`);
|
if (pos > serverQueue.songs.size) return message.channel.send(`:x: There is only ${serverQueue.songs.size} amount of songs in the queue!`);
|
||||||
if (message.author.id !== client.global.devId) {
|
if (message.author.id !== client.config.devId) {
|
||||||
if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to remove songs!');
|
if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to remove songs!');
|
||||||
if (client.global.db.guilds[message.guild.id].dj) {
|
if (client.global.db.guilds[message.guild.id].dj) {
|
||||||
if (serverQueue.songs[pos].author !== message.author) {
|
if (serverQueue.songs[pos].author !== message.author) {
|
||||||
|
@ -8,7 +8,7 @@ module.exports = {
|
|||||||
const permissions = message.channel.permissionsFor(message.author);
|
const permissions = message.channel.permissionsFor(message.author);
|
||||||
const { voiceChannel } = message.member;
|
const { voiceChannel } = message.member;
|
||||||
if (serverQueue && !serverQueue.playing) {
|
if (serverQueue && !serverQueue.playing) {
|
||||||
if (message.author.id !== client.global.devId) {
|
if (message.author.id !== client.config.devId) {
|
||||||
if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to loop the queue!');
|
if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to loop the queue!');
|
||||||
if (client.global.db.guilds[message.guild.id].permissions === true) {
|
if (client.global.db.guilds[message.guild.id].permissions === true) {
|
||||||
if (client.global.db.guilds[message.guild.id].dj) {
|
if (client.global.db.guilds[message.guild.id].dj) {
|
||||||
|
@ -10,7 +10,7 @@ module.exports = {
|
|||||||
const { voiceChannel } = message.member;
|
const { voiceChannel } = message.member;
|
||||||
let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
|
let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
|
||||||
if (serverQueue) {
|
if (serverQueue) {
|
||||||
if (message.author.id !== client.global.devId) {
|
if (message.author.id !== client.config.devId) {
|
||||||
return message.channel.send(':x: This command is currently disabled!');
|
return message.channel.send(':x: This command is currently disabled!');
|
||||||
if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to seek the song!');
|
if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to seek the song!');
|
||||||
if (client.global.db.guilds[message.guild.id].permissions === true) {
|
if (client.global.db.guilds[message.guild.id].permissions === true) {
|
||||||
|
@ -32,7 +32,7 @@ module.exports = {
|
|||||||
.setDescription(error.stack.replace(/at /g, '**at **'))
|
.setDescription(error.stack.replace(/at /g, '**at **'))
|
||||||
.setColor('#b50002');
|
.setColor('#b50002');
|
||||||
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('634718645188034560').send(embed);
|
client.channels.get(client.config.debug_channel).send(embed);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return message.channel.send(embed);
|
return message.channel.send(embed);
|
||||||
|
@ -2,7 +2,7 @@ module.exports = {
|
|||||||
name: 'guildcreate',
|
name: 'guildcreate',
|
||||||
async execute(client, guild) {
|
async execute(client, guild) {
|
||||||
client.db.collection('guilds').doc(guild.id).set({
|
client.db.collection('guilds').doc(guild.id).set({
|
||||||
prefix: '>',
|
prefix: client.config.prefix,
|
||||||
defaultVolume: 5,
|
defaultVolume: 5,
|
||||||
permissions: false,
|
permissions: false,
|
||||||
premium: false,
|
premium: false,
|
||||||
@ -11,7 +11,7 @@ module.exports = {
|
|||||||
startPlaying: true
|
startPlaying: true
|
||||||
});
|
});
|
||||||
client.global.db.guilds[guild.id] = {
|
client.global.db.guilds[guild.id] = {
|
||||||
prefix: ">",
|
prefix: client.config.prefix,
|
||||||
defaultVolume: 5,
|
defaultVolume: 5,
|
||||||
permissions: false,
|
permissions: false,
|
||||||
premium: false,
|
premium: false,
|
||||||
|
@ -2,7 +2,7 @@ module.exports = {
|
|||||||
name: 'message',
|
name: 'message',
|
||||||
async execute(client, message, Discord) {
|
async execute(client, message, Discord) {
|
||||||
if (message.author.bot || !message.guild) return;
|
if (message.author.bot || !message.guild) return;
|
||||||
if (message.content === '->reset' && message.author.id === client.global.devId) {
|
if (message.content === '->reset' && message.author.id === client.config.devId) {
|
||||||
client.guilds.forEach(guild => {
|
client.guilds.forEach(guild => {
|
||||||
client.global.db.guilds[guild.id] = {
|
client.global.db.guilds[guild.id] = {
|
||||||
prefix: client.config.prefix,
|
prefix: client.config.prefix,
|
||||||
@ -15,7 +15,7 @@ module.exports = {
|
|||||||
return message.channel.send(':white_check_mark: Reset all guild settings for __all__ guilds!');
|
return message.channel.send(':white_check_mark: Reset all guild settings for __all__ guilds!');
|
||||||
});
|
});
|
||||||
return message.channel.send(':white_check_mark: Reset all guild settings!')
|
return message.channel.send(':white_check_mark: Reset all guild settings!')
|
||||||
} else if (message.content === '->resetguildsettings' && message.author.id === client.global.devId) {
|
} else if (message.content === '->resetguildsettings' && message.author.id === client.config.devId) {
|
||||||
client.global.db.guilds[message.guild.id] = {
|
client.global.db.guilds[message.guild.id] = {
|
||||||
prefix: client.config.prefix,
|
prefix: client.config.prefix,
|
||||||
defaultVolume: 5,
|
defaultVolume: 5,
|
||||||
@ -30,7 +30,7 @@ module.exports = {
|
|||||||
const args = message.content.slice(prefix.length).split(' ');
|
const args = message.content.slice(prefix.length).split(' ');
|
||||||
let commandName;
|
let commandName;
|
||||||
if (message.mentions.users.first()) {
|
if (message.mentions.users.first()) {
|
||||||
if (message.mentions.users.first().id === client.config.botId) {
|
if (message.mentions.users.first().id === client.user.id) {
|
||||||
if (!args[1]) return;
|
if (!args[1]) return;
|
||||||
if (args[1] === 'prefix') return message.channel.send(`My prefix here is: \`${prefix}\`.`);
|
if (args[1] === 'prefix') return message.channel.send(`My prefix here is: \`${prefix}\`.`);
|
||||||
commandName = args[1].toLowerCase();
|
commandName = args[1].toLowerCase();
|
||||||
|
@ -10,7 +10,7 @@ module.exports = {
|
|||||||
client.global.db.playlists[guildData.id] = guildData.d;
|
client.global.db.playlists[guildData.id] = guildData.d;
|
||||||
});
|
});
|
||||||
console.log('- DB Set -');
|
console.log('- DB Set -');
|
||||||
client.user.setActivity(`@musix help | 🎶`, { type: 'LISTENING' });
|
client.user.setActivity(`@${client.user.username} help | 🎶`, { type: 'LISTENING' });
|
||||||
client.user.setStatus('dnd');
|
client.user.setStatus('dnd');
|
||||||
dbl.postStats(client.guilds.size);
|
dbl.postStats(client.guilds.size);
|
||||||
console.log('- Activated -');
|
console.log('- Activated -');
|
||||||
@ -18,7 +18,7 @@ module.exports = {
|
|||||||
client.guilds.forEach(guild => {
|
client.guilds.forEach(guild => {
|
||||||
users += guild.memberCount;
|
users += guild.memberCount;
|
||||||
})
|
})
|
||||||
let status = [`${users} users on ${client.guilds.size} guilds!`, '@musix help | 🎶'];
|
let status = [`${users} users on ${client.guilds.size} guilds!`, `@${client.user.username} help | 🎶`];
|
||||||
let i = 0;
|
let i = 0;
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
if (i == status.length) {
|
if (i == status.length) {
|
||||||
|
@ -9,7 +9,7 @@ module.exports = function (message, args, client, Discord, prefix, command) {
|
|||||||
.setTitle(`Musix ${error.toString()}`)
|
.setTitle(`Musix ${error.toString()}`)
|
||||||
.setDescription(error.stack.replace(/at /g, '**at **'))
|
.setDescription(error.stack.replace(/at /g, '**at **'))
|
||||||
.setColor('#b50002');
|
.setColor('#b50002');
|
||||||
client.fetchUser(client.global.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('634718645188034560').send(embed);
|
client.channels.get(client.config.debug_channel).send(embed);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -32,7 +32,7 @@ module.exports = async function (video, message, voiceChannel, client, playlist
|
|||||||
client.funcs.play(message.guild, construct.songs[0], client, message, 0, true);
|
client.funcs.play(message.guild, construct.songs[0], client, message, 0, true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
client.queue.delete(message.guild.id);
|
client.queue.delete(message.guild.id);
|
||||||
client.channels.get('634718645188034560').send("Error with connecting to voice channel: " + error);
|
client.channels.get(client.config.debug_channel).send("Error with connecting to voice channel: " + error);
|
||||||
return message.channel.send(`:x: An error occured: ${error}`);
|
return message.channel.send(`:x: An error occured: ${error}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -41,4 +41,4 @@ module.exports = async function (video, message, voiceChannel, client, playlist
|
|||||||
return message.channel.send(`:white_check_mark: **${song.title}** has been added to the queue!`);
|
return message.channel.send(`:white_check_mark: **${song.title}** has been added to the queue!`);
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
12
index.js
12
index.js
@ -1,7 +1,7 @@
|
|||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const client = new Discord.Client({ disableEveryone: true, disabledEvents: ['TYPING_START'] });
|
const client = new Discord.Client({ disableEveryone: true, disabledEvents: ['TYPING_START'] });
|
||||||
const DBL = require("dblapi.js");
|
const DBL = require("dblapi.js");
|
||||||
const dbl = new DBL(process.env.DBLTOKEN, client);
|
const dbl = new DBL(process.env.DBL_TOKEN, client);
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const dotenv = require('dotenv');
|
const dotenv = require('dotenv');
|
||||||
const firebase = require('firebase/app');
|
const firebase = require('firebase/app');
|
||||||
@ -38,11 +38,11 @@ client.funcs.dbget = require('./funcs/dbget.js');
|
|||||||
client.funcs.exe = require('./funcs/exe.js');
|
client.funcs.exe = require('./funcs/exe.js');
|
||||||
|
|
||||||
client.config = {
|
client.config = {
|
||||||
token: process.env.TOKEN,
|
token: process.env.DISCORD_TOKEN,
|
||||||
apikey: process.env.API_KEY,
|
debug_channel: process.env.DISCORD_DEBUG_CHANNEL_ID,
|
||||||
botId: "607266889537945605",
|
apikey: process.env.YOUTUBE_KEY,
|
||||||
devId: "360363051792203779",
|
devId: process.env.DISCORD_DEV_UID,
|
||||||
prefix: '>',
|
prefix: process.env.PREFIX
|
||||||
};
|
};
|
||||||
|
|
||||||
const commandFiles = fs.readdirSync('./commands/').filter(f => f.endsWith('.js'));
|
const commandFiles = fs.readdirSync('./commands/').filter(f => f.endsWith('.js'));
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
"dblapi.js": "^2.3.0",
|
"dblapi.js": "^2.3.0",
|
||||||
"discord.js": "^11.5.1",
|
"discord.js": "^11.5.1",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.2.0",
|
||||||
"ffmpeg-binaries": "^4.0.0",
|
|
||||||
"firebase": "^6.6.2",
|
"firebase": "^6.6.2",
|
||||||
"firebase-admin": "^8.6.1",
|
"firebase-admin": "^8.6.1",
|
||||||
"fs": "0.0.1-security",
|
"fs": "0.0.1-security",
|
||||||
|
Loading…
Reference in New Issue
Block a user