-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.js
52 lines (43 loc) · 1.39 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
48
49
50
51
52
const Discord = require('discord.js');
const client = new Discord.Client();
var dotenv = require('dotenv');
dotenv.load();
const pizzaball = client.emojis.find(emoji => emoji.name === "pizzaball");
const pizex = /time\s?to\s?deliver\s?a\s?pizza\s?ball/i;
const bait = /it('| i)?s\s?time/i;
const hook = /for\swhat/i;
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', msg => {
if (msg.author.bot) return;
if (msg.deleted) return;
var arg = msg.content;
if (pizex.test(arg)) {
msg.channel.send('<:pizzaball:463530413844070401>');
return;
}
if (bait.test(arg)){
var promise = new Promise(function(resolve, reject) {
const gottem = new Discord.MessageCollector(msg.channel, m => m.author !== msg.author, {time: 30000});
//console.log(gottem);
gottem.on('collect', clct => {
//console.log('collected');
var fol = clct.content;
if (hook.test(fol)){
msg.channel.send({files:
[{attachment: './timeBall.gif'}]
}).then(result => {gottem.stop('delivered');
});
}
});
gottem.on('end', (col, reason) => {
resolve(reason);
});
});
promise.then(function(value) {
console.log(value);
})
}
});
client.login(process.env.BOT_TOKEN);