-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
122 lines (117 loc) · 4.39 KB
/
index.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
const {Collection, Client, Discord} = require('discord.js')
const fs = require('fs')
const client = new Client({
disableEveryone: true,
partials : ["MESSAGE", "CHANNEL", "REACTION"]
})
const config = require('./config.json')
const prefix = config.prefix
const token = config.token
client.commands = new Collection();
client.aliases = new Collection();
client.categories = fs.readdirSync("./commands/");
["command"].forEach(handler => {
require(`./handlers/${handler}`)(client);
});
client.on('message', async message =>{
if(message.author.bot) return;
if(!message.content.startsWith(prefix)) return;
if(!message.guild) return;
if(!message.member) message.member = await message.guild.fetchMember(message);
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const cmd = args.shift().toLowerCase();
if(cmd.length == 0 ) return;
let command = client.commands.get(cmd)
if(!command) command = client.commands.get(client.aliases.get(cmd));
if(command) command.run(client, message, args)
})
client.on('ready', () => {
client.user.setActivity(`${prefix}help`)
console.log(`Name: ${client.user.username}\nTag: ${client.user.tag}\nID: ${client.user.id}`);
client.user.setPresence({
status: "online",
activity: {
name: "decúlenky milované",
type: "WATCHING"
}
})
})
client.on('messageReactionAdd', async(reaction, user) => {
if(reaction.message.partial) await reaction.message.fetch();
if(reaction.partial) await reaction.fetch();
if(user.bot) return;
if(!reaction.message.guild) return;
if(reaction.message.id === '802570578451365898'){
if(reaction.emoji.name === '♂️') {
await reaction.message.guild.members.cache.get(user.id).roles.add('802148536585027605')
const embed = {
"description": "Odteraz si muž moj",
"color": "#00cfff",
"title": "**Role**"
};
user.send({ embed })
}
}
if(reaction.message.id === '802570578451365898'){
if(reaction.emoji.name === '♀️') {
await reaction.message.guild.members.cache.get(user.id).roles.add('802570835420250143')
const embed = {
"description": "Odteraz si ž*na moja",
"color": "#ff00e5",
"title": "**Role**"
};
user.send({ embed })
}
}
if(reaction.message.id === '802570578451365898'){
if(reaction.emoji.name === '🚁') {
await reaction.message.guild.members.cache.get(user.id).roles.add('802570838384836638')
const embed = {
"description": "Odteraz si bojova helikoptera :)",
"color": "#f82500",
"title": "**Role**"
};
user.send({ embed })
}
}
})
client.on('messageReactionRemove', async(reaction, user) => {
if(reaction.message.partial) await reaction.message.fetch();
if(reaction.partial) await reaction.fetch();
if(user.bot) return;
if(!reaction.message.guild) return;
if(reaction.message.id === '802570578451365898'){
if(reaction.emoji.name === '♂️') {
await reaction.message.guild.members.cache.get(user.id).roles.remove('802148536585027605')
const embed = {
"description": "Odteraz si už neni muž moj",
"color": "#00cfff",
"title": "**Role**"
};
user.send({ embed })
}
}
if(reaction.message.id === '802570578451365898'){
if(reaction.emoji.name === '♀️') {
await reaction.message.guild.members.cache.get(user.id).roles.remove('802570835420250143')
const embed = {
"description": "Odteraz si už neni ž*na moja",
"color": "#ff00e5",
"title": "**Role**"
};
user.send({ embed })
}
}
if(reaction.message.id === '802570578451365898'){
if(reaction.emoji.name === '🚁') {
await reaction.message.guild.members.cache.get(user.id).roles.add('802570838384836638')
const embed = {
"description": "Odteraz si už neni bojova helikoptera :(",
"color": "#f82500",
"title": "**Role**"
};
user.send({ embed })
}
}
})
client.login(token)