-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.js
47 lines (41 loc) · 1.54 KB
/
bot.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
const Discord = require('discord.js');
const Config = require('./config.json');
const Client = new Discord.Client();
Client.on('ready', () => {
console.log(`Logged in as ${Client.user.tag}!`);
});
// commandes
Client.on('message', message => {
let channel = message.guild.channels.cache.find(ch => ch.name === '💻commandes');
if(channel){
if (!message.content.startsWith(Config.prefix) || message.author.bot){
return;
}
if(message.content.startsWith(Config.prefix+'help')){
}
if(message.content.startsWith(Config.prefix+'subscribe')){
let member = message.member;
let role = message.guild.roles.cache.find(r => r.name === 'Abonné');
member.roles.add(role.id);
channel.send('ok');
}
if(message.content.startsWith(Config.prefix+'unsubscribe')){
let member = message.member;
let role = message.guild.roles.cache.find(r => r.name === 'Abonné');
member.roles.remove(role.id);
channel.send('ok');
}
}
});
// bienvenue
Client.on("guildMemberAdd", (member) => {
let channel = member.guild.channels.cache.find(ch => ch.name === '🌍bienvenue');
if(channel){
let role = message.guild.roles.cache.find(r => r.name === 'Membre');
member.roles.add(role.id)
channel.send('Bienvenue '+member+' ! \n' +
'\n' +
'Allez dans #📌présentation pour en apprendre plus sur notre projet : Le Monde Du PC ! ');
}
});
Client.login(Config.token);