checklist.js
2.53 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const Discord = require('discord.js');
module.exports = {
name: 'checklist',
description: 'Go through anxiety help checklist',
async run(client, message, args){
const start = '🧡';
const next1 = '💛';
const next2 = '💚';
const next3 = '💙';
var listnum = 0;
const checklistlist = [
"First, breathe deeply",
"Have a glass of water",
"Do neck and shoulder stretches",
"I hope this helped. You got this!"
];
message.channel.send("We'll go through a checklist to help with anxiety. Click the heart to continue.").then(reactmessage => {
reactmessage.react(start);
});
client.on('messageReactionAdd', async(reaction, user) =>{
if (reaction.message.partial) await reaction.message.fetch();
if (reaction.partial) await reaction.fetch();
if (user.bot) return;
if (!reaction.message.guild) return;
if (reaction.emoji.name === start){
if (listnum <= checklistlist.length){
message.channel.send(checklistlist[listnum]).then(reactmessage =>{
reactmessage.react(next1);
});
message.channel.send(';breathe');
listnum++;
}
}
if (reaction.emoji.name === next1){
if (listnum <= checklistlist.length){
message.channel.send(checklistlist[listnum]).then(reactmessage =>{
reactmessage.react(next2);
});
listnum++;
}
}
if (reaction.emoji.name === next2){
if (listnum <= checklistlist.length){
message.channel.send(checklistlist[listnum]).then(reactmessage =>{
reactmessage.react(next3);
});
message.channel.send('https://media.istockphoto.com/vectors/neck-shoulder-spine-exercise-isolated-set-vector-flat-cartoon-graphic-vector-id1221242499?k=20&m=1221242499&s=612x612&w=0&h=M8ea84Lp3lrPxlPGU6OkFpz0NwUXEynRSa11yisn6KQ=');
listnum++;
}
}
if (reaction.emoji.name === next3){
if (listnum <= checklistlist.length){
message.channel.send(checklistlist[listnum]);
listnum = 0;
}
}
});
}
}
// FIX: while loop not working for using same emoji??