-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuni.js
52 lines (43 loc) · 1.78 KB
/
buni.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
const config = require('./config.json');
const discord = require('./discord.js');
const Eris = require('eris');
const fs = require('fs');
const client = new Eris(config.token);
client.commands = new Map();
fs.readdir('./commands/', (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
let command = require(`./commands/${file}`);
let commandName = file.split(".")[0];
client.commands.set(commandName, command);
});
});
client.on('ready', () => {
console.log(`${client.user.username+"#"+client.user.discriminator} has successfully logged in`);
client.editStatus({name: `over the universe | ${config.prefix}help`, type: 3 });
});
client.connect().catch(console.error);
client.on('messageCreate', async msg => {
if (msg.author.bot || msg.type !== 0 || msg.author.discriminator === 0000) return;
if (config.autoVoteChannels.includes(msg.channel.id)) {
msg.addReaction("👍");
msg.addReaction("👎");
return;
}
if (!msg.content.startsWith(config.prefix)) return;
const args = msg.content.slice(config.prefix.length).split(/\s+/);
if (args[0].startsWith("~")) return;
const command = args.shift().toLowerCase();
const cmd = client.commands.get(discord.resolveCommand(msg, command, client.commands));
if (!cmd) return msg.channel.createMessage(discord.embed(msg, "I could not find that command!"));
cmd.run(client, msg, args);
});
client.on('messageReactionAdd', (msg, emoji, user) => {
if (msg.id !== "739544190689476688") return;
msg.channel.guild.addMemberRole(user.id, "739326324702707723");
});
client.on("messageReactionAdd", discord.handleReaction);
client.on('messageReactionRemove', (msg, emoji, userID) => {
if (msg.id !== "739544190689476688") return;
msg.channel.guild.removeMemberRole(userID, "739326324702707723");
});