diff --git a/Struct/Client.js b/Struct/Client.js new file mode 100644 index 00000000..6d937223 --- /dev/null +++ b/Struct/Client.js @@ -0,0 +1,47 @@ +const { Client, Collection } = require('discord.js'); +const admin = require('firebase-admin'); +const serviceAccount = require('./serviceAccount.json'); + +module.exports = class extends Client { + constructor() { + super({ + disableEveryone: true, + disabledEvents: ['TYPING_START'] + }); + + this.commands = new Collection(); + + this.commandAliases = new Collection(); + + this.playlistCmd = new Collection(); + + this.settingCmd = new Collection(); + + this.events = new Collection(); + + this.queue = new Map(); + + this.funcs = {}; + + this.funcs.handleVideo = require('./funcs/handleVideo.js'); + this.funcs.play = require('./funcs/play.js'); + this.funcs.msToTime = require('./funcs/msToTime.js'); + this.funcs.dbget = require('./funcs/dbget.js'); + this.funcs.exe = require('./funcs/exe.js'); + + admin.initializeApp({ + credential: admin.credential.cert(serviceAccount), + }); + + this.db = admin.firestore(); + + this.global = { + db: { + guilds: {}, + playlists: {}, + }, + }; + + this.db.FieldValue = require('firebase-admin').firestore.FieldValue; + } +}; \ No newline at end of file diff --git a/funcs/dbget.js b/Struct/funcs/dbget.js similarity index 100% rename from funcs/dbget.js rename to Struct/funcs/dbget.js diff --git a/funcs/exe.js b/Struct/funcs/exe.js similarity index 100% rename from funcs/exe.js rename to Struct/funcs/exe.js diff --git a/funcs/handleVideo.js b/Struct/funcs/handleVideo.js similarity index 100% rename from funcs/handleVideo.js rename to Struct/funcs/handleVideo.js diff --git a/funcs/msToTime.js b/Struct/funcs/msToTime.js similarity index 100% rename from funcs/msToTime.js rename to Struct/funcs/msToTime.js diff --git a/funcs/play.js b/Struct/funcs/play.js similarity index 97% rename from funcs/play.js rename to Struct/funcs/play.js index a17c6142..b41ddc41 100644 --- a/funcs/play.js +++ b/Struct/funcs/play.js @@ -34,7 +34,7 @@ module.exports = async function (guild, song, client, message, seek, play) { .setTitle(`:musical_note: Start playing: **${song.title}**`) .setDescription(`Song duration: \`${client.funcs.msToTime(songtime)}\``) .setColor("#b50002") - serverQueue.playing = true; serverQueue.textChannel.send(embed); } + serverQueue.playing = true; } diff --git a/commands/bug.js b/commands/bug.js index 12011d57..f998f668 100644 --- a/commands/bug.js +++ b/commands/bug.js @@ -8,7 +8,7 @@ module.exports = { const embed = new Discord.RichEmbed() .setTitle(`Found a bug with ${client.user.username}?\nDM the core developer:`) .setDescription(`Matte#0002\nOr join the support server: https://discord.gg/rvHuJtB`) - .setColor('#b50002'); + .setColor(client.config.embedColor); message.channel.send(embed); }, }; \ No newline at end of file diff --git a/commands/cmduses.js b/commands/cmduses.js index 93281b91..0c10ab63 100644 --- a/commands/cmduses.js +++ b/commands/cmduses.js @@ -22,7 +22,7 @@ module.exports = { .setTitle('Musix Command Usage During Current Uptime') .setDescription('```ml\n' + markdownrows.join('\n') + '\n```') .setFooter('These statistics are from the current uptime.') - .setColor('#b50002'); + .setColor(client.config.embedColor); msg.channel.send(embed); }, }; \ No newline at end of file diff --git a/commands/eval.js b/commands/eval.js index 2ea7270d..4e4bfd02 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -19,7 +19,7 @@ module.exports = { } const embed = new Discord.RichEmbed() .setTitle('Evaluation Command') - .setColor('#b50002') + .setColor(client.config.embedColor) .setDescription(`Input: \`\`\`js\n${input.replace(/; /g, ';').replace(/;/g, ';\n')}\n\`\`\`\nOutput: \`\`\`\n${output}\n\`\`\``); return message.channel.send(embed); }, diff --git a/commands/help.js b/commands/help.js index 583e693e..0b3a38bf 100644 --- a/commands/help.js +++ b/commands/help.js @@ -6,7 +6,7 @@ module.exports = { onlyDev: false, execute(message, args, client, Discord, prefix) { const embed = new Discord.RichEmbed() - .setTitle('Commands for Musix!') + .setTitle(`Commands for ${client.user.username}!`) .addField(`${prefix}play | ${prefix}p`, 'Play a song.', true) .addField(`${prefix}skip | ${prefix}s`, 'Skip a song.', true) .addField(`${prefix}queue | ${prefix}q`, 'Display the queue.', true) @@ -22,8 +22,8 @@ module.exports = { .addField(`${prefix}bug`, 'Report a bug.', true) .addField(`${prefix}settings`, 'Change the guild specific settings.', true) .addField(`${prefix}help`, 'Display the help.', true) - .setAuthor(client.user.username, client.user.displayAvatarURL) - .setColor('#b50002') + .setAuthor(message.member.username, message.member.displayAvatarURL) + .setColor(client.config.embedColor) return message.channel.send(embed); } }; diff --git a/commands/invite.js b/commands/invite.js index 3458a2be..f33e3d24 100644 --- a/commands/invite.js +++ b/commands/invite.js @@ -6,9 +6,9 @@ module.exports = { onlyDev: false, execute(message, args, client, Discord, prefix) { const embed = new Discord.RichEmbed() - .setTitle('Invite Musix to your Discord server!') - .setURL('https://bit.ly/2YDrKgh') - .setColor('#b50002') + .setTitle(`Invite ${client.user.username} to your Discord server!`) + .setURL(client.config.invite) + .setColor(client.config.embedColor) return message.channel.send(embed); } }; \ No newline at end of file diff --git a/commands/nowplaying.js b/commands/nowplaying.js index f4211876..b4bd1671 100644 --- a/commands/nowplaying.js +++ b/commands/nowplaying.js @@ -20,7 +20,7 @@ module.exports = { .setDescription(`🎶**Now playing:** ${serverQueue.songs[0].title}\n${array.join('')} | \`${client.funcs.msToTime(completed)} / ${client.funcs.msToTime(songtime)}\``) .setFooter(`Queued by ${serverQueue.songs[0].author.tag}`) .setURL(serverQueue.songs[0].url) - .setColor("#b50002") + .setColor(client.config.embedColor) return message.channel.send(embed); } }; diff --git a/commands/play.js b/commands/play.js index 99b8e7a2..da270661 100644 --- a/commands/play.js +++ b/commands/play.js @@ -47,7 +47,7 @@ module.exports = { .setTitle("__Song Selection__") .setDescription(`${videos.map(video2 => `**${++index}** ${he.decode(video2.title)} `).join('\n')}`) .setFooter("Please provide a number ranging from 1-10 to select one of the search results.") - .setColor("#b50002") + .setColor(client.config.embedColor) message.channel.send(embed); try { var response = await message.channel.awaitMessages(message2 => message2.content > 0 && message2.content < 11, { diff --git a/commands/playlist.js b/commands/playlist.js index 3fe857b0..e549ccf1 100644 --- a/commands/playlist.js +++ b/commands/playlist.js @@ -18,7 +18,7 @@ module.exports = { .addField('list', 'Display the playlist.', true) .setFooter(`how to use: ${prefix}playlist