-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
43 lines (33 loc) · 1018 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Init
var Discord = require("discord.js");
var bot = new Discord.Client();
const ids = require("./ids");
// Handlers
var handlerMsg = require("./handlerMsg");
var handlerUsers = require("./handlerUsers");
var handlerReaction = require("./handlerReaction");
// Bot Init
bot.on("ready", () => {
console.log("Bot iniciado");
console.log("Node Version: " + process.version);
console.log("Discord.js Version: " + Discord.version);
// Catch reaction message
bot.channels.cache.get(ids.rolChannelId).messages.fetch(ids.rolMessageId);
});
// Receive Messages
bot.on("message", message => {
handlerMsg.analizar(message);
});
// New members
bot.on("guildMemberAdd", member =>{
handlerUsers.newUser(member);
});
// Add Reaction
bot.on("messageReactionAdd", (reaction,user) => {
handlerReaction.addRole(reaction,user);
});
// Remove Reaction
bot.on("messageReactionRemove", (reaction,user) => {
handlerReaction.removeRole(reaction,user);
});
bot.login(process.env.DISCORD_BOT_KEY);