forked from Talus/GenBot-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
37 lines (35 loc) · 1.05 KB
/
index.js
File metadata and controls
37 lines (35 loc) · 1.05 KB
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
const Discord = require('discord.js');
const client = new Discord.Client();
const token = 'NjIwNDA2MzY1MTQ3NjI3NTIz.XXaygw.klPIAqXszSjSVP3vJ6Qwe6riB9U';
usedCommandRecently4 = new Set();
client.on('ready', () =>{
console.log('gen bot is now online')
client.user.setPresence({ game: { name: `${client.guilds.size} Servers`, type: "WATCHING"}});
});
client.on('message', message =>{
if (message.content === 'hello'){
message.author.send('hi');
};
});
client.on('message', message =>{
if (!message.guild) return;
if (message.content === '=test'){
if (usedCommandRecently4.has(message.author.id)){
message.channel.send('Cooldown Message')
} else{
usedCommandRecently4.add(message.author.id);
setTimeout(() =>{
usedCommandRecently4.delete(message.author.id);
}, 10000)
var string = `test1
test2
test3
test4
test5`
var words = string.split('\n');
let random = words[Math.floor(Math.random()*words.length)];
message.author.send(`${random}`);
};
};
});
client.login(token);