-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
42 lines (39 loc) · 1.58 KB
/
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
const Discord = require('discord.js');
const config = require('./config.json');
const client = new Discord.Client();
client.on('ready', () => {
client.user.setPresence({
game: {
name: '!help'
},
status: 'online'
});
console.log(`Started.`);
});
client.on('message', message => {
if (message.content.toLowerCase() === '!german') {
if (message.member.roles.has('523970406433030170')) {
message.member.removeRole('523970406433030170').then(() => {
message.channel.send(`:white_check_mark: Removed role, <@!${message.author.id}>`);
});
} else {
message.member.addRole('523970406433030170').then(() => {
message.channel.send(`:white_check_mark: Assigned role, <@!${message.author.id}>`);
});
}
} else if (message.content.toLowerCase() === '!announcements') {
if (message.member.roles.has('523972203772117012')) {
message.member.removeRole('523972203772117012').then(() => {
message.channel.send(`:white_check_mark: Removed role, <@!${message.author.id}>`);
});
} else {
message.member.addRole('523972203772117012').then(() => {
message.channel.send(`:white_check_mark: Assigned role, <@!${message.author.id}>`);
});
}
} else if (message.content.toLowerCase() === '!help') {
message.channel.send('`!german` - Toggles your german role\n' +
'`!announcements` - Toggles your announcements role');
}
});
client.login(config.token);