1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-15 17:45:59 +00:00

Updated everything

This commit is contained in:
MatteZ02
2019-09-15 09:18:33 +03:00
parent 9d7e55b5ee
commit e4e99d76c9
1064 changed files with 277 additions and 171372 deletions

9
events/guildcreate.js Normal file
View File

@ -0,0 +1,9 @@
module.exports = {
name: 'guildcreate',
async execute(client, guild) {
musix.user.setActivity(`music to ${client.users.size} users!`, { type: 'PLAYING' });
client.db.collection('musix_guilds').doc(guild.id).set({
musix_prefix: '>',
});
}
}

6
events/guilddelete.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
name: 'guilddelete',
async execute(client, guild) {
musix.user.setActivity(`music to ${client.users.size} users!`, { type: 'PLAYING' });
}
}

6
events/guildmemberadd.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
name: 'guildmeberadd',
async execute(client) {
musix.user.setActivity(`music to ${client.users.size} users!`, { type: 'PLAYING' });
}
}

View File

@ -0,0 +1,6 @@
module.exports = {
name: 'guildmeberremove',
async execute(client) {
musix.user.setActivity(`music to ${client.users.size} users!`, { type: 'PLAYING' });
}
}

42
events/message.js Normal file
View File

@ -0,0 +1,42 @@
module.exports = {
name: 'message',
async execute(client, message) {
const { Discord, RichEmbed } = require('discord.js');
const fs = require('fs');
if (message.author.bot || !message.guild) return;
const prefix = client.global.db.musix_guilds[message.guild.id].musix_prefix;
if (message.mentions.users.first()) {
if (message.mentions.users.first().id === '607266889537945605') return message.channel.send(`My prefix on this server is \`${prefix}\` !`);
}
if (!message.content.startsWith(prefix)) return;
const args = message.content.slice(prefix.length).split(' ');
if (!args[0]) return;
let commandName = args[0].toLowerCase();
if (commandName === `p`) {
commandName = 'play';
}
if (commandName === 'q') {
commandName = 'queue';
}
if (commandName === 's') {
commandName = 'skip';
}
if (commandName === 'np') {
commandName = 'nowplaying';
}
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
const permissions = message.channel.permissionsFor(message.client.user);
if (!permissions.has('EMBED_LINKS')) return message.channel.send(':x: I cannot send embeds (Embed links), make sure I have the proper permissions!');
if (!command && message.content !== `${prefix}`) return;
try {
command.execute(message, args, client, RichEmbed, prefix);
} catch (error) {
message.reply(':x: there was an error trying to execute that command!');
const embed = new Discord.RichEmbed()
.setTitle(`Musix ${error.toString()}`)
.setDescription(error.stack.replace(/at /g, '**at **'))
.setColor('#b50002');
client.fetchUser('360363051792203779').then(user => user.send(embed)).catch(console.error);
}
}
}

18
events/ready.js Normal file
View File

@ -0,0 +1,18 @@
module.exports = {
name: 'ready',
async execute(client) {
const remoteMusixGuildsData = await client.funcs.dbget('guilds', null, client);
remoteMusixGuildsData.forEach(guildData => {
client.global.db.musix_guilds[guildData.id] = guildData.d;
});
await client.user.setActivity(`music to ${client.users.size} users!`, { type: 'PLAYING' });
await client.user.setStatus('dnd');
setInterval(async () => {
client.guilds.forEach(guild => {
client.db.collection('guilds').doc(guild.id).set(client.global.db.musix_guilds[guild.id]);
});
client.global.lastDBwrite = Date.now();
}, 1200000);
}
}