1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-16 18:56:00 +00:00
This commit is contained in:
MatteZ02
2020-04-20 19:56:23 +03:00
parent 2d55a3a8da
commit a6e3e8b0de
71 changed files with 158 additions and 164 deletions

View File

@ -1,3 +1,5 @@
const { db } = require("../../../index-.js");
module.exports = {
name: "message",
async execute(client, msg, Discord) {
@ -6,9 +8,9 @@ module.exports = {
const args = msg.content.split(" ");
if (!args[1] || !args[2])
return msg.channel.send(client.messages.setKeyUsage);
if (!client.guilds.cache.get(args[2]))
return msg.channel.send(client.messages.invalidGuild);
client.global.db.guilds[args[2]].spotify_access_key = args[1];
client.config.db.collection("guilds").doc(args[2]).set({
key: args[1],
});
return msg.channel.send(client.messages.keySet);
}
if (!msg.guild) return;

View File

@ -2,16 +2,16 @@ module.exports = function (client) {
const Discord = require('discord.js');
const events = './clientEvents/';
client.on('ready', () => {
require(`${events}ready.ts`).execute(client, Discord);
require(`${events}ready.js`).execute(client, Discord);
});
client.on('message', (msg) => {
require(`${events}msg.ts`).execute(client, msg, Discord);
require(`${events}msg.js`).execute(client, msg, Discord);
});
client.on('guildCreate', (guild) => {
require(`${events}guildCreate.ts`).execute(client, guild);
require(`${events}guildCreate.js`).execute(client, guild);
});
client.on('voiceStateUpdate', (oldState, newState) => {
require(`${events}voiceStateUpdate.ts`).execute(client, oldState, newState);
require(`${events}voiceStateUpdate.js`).execute(client, oldState, newState);
});
client.on('error', (error) => {
client.channels.fetch(client.config.debug_channel).send(`Error: ${error} on shard: ${client.shard}`);