Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이세린
/
anxietymanager
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
이세린
2022-06-08 20:32:44 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7ec4868357c93cd7b4db90f9848605e461bc7e00
7ec48683
1 parent
ebbf8adb
Wrote basic checklist. Need to optimize.
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
commands/checklist.js
commands/checklist.js
View file @
7ec4868
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
...
...
Please
register
or
login
to post a comment