이세린

Wrote basic checklist. Need to optimize.

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??
\ No newline at end of file
......