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-03 15:54:39 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a9b9410c75618e7026c6138f7ef7be94c1a0a622
a9b9410c
1 parent
70fb4b13
Edited Command Hanlder, Using Run instead of Execute, Cute Command now complete
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
50 additions
and
34 deletions
commands/breathe.js
commands/calm.js
commands/chat.js
commands/checklist.js
commands/cute.js
commands/help.js
config.json
main.js
commands/breathe.js
View file @
a9b9410
const
Discord
=
require
(
'discord.js'
);
module
.
exports
=
{
name
:
'breathe'
,
description
:
'Embeds a gif'
,
...
...
commands/calm.js
View file @
a9b9410
const
Discord
=
require
(
'discord.js'
);
module
.
exports
=
{
name
:
'calm'
,
description
:
'Actual help section'
,
execute
(
message
,
args
,
Discord
){
const
calm
Embed
=
new
Discord
.
MessageEmbed
()
async
run
(
client
,
message
,
args
){
const
calm
=
new
Discord
.
MessageEmbed
()
.
setColor
(
'#91B2C7'
)
.
setDescription
(
"It's okay, I'm here to help! What would you like to do?"
)
.
addFields
(
...
...
@@ -11,7 +13,7 @@ module.exports = {
{
name
:
';checklist'
,
value
:
"I'll guide you through an anxiety checklist"
},
{
name
:
';chat'
,
value
:
"If you just want a chat with me, I'm all ears!"
}
);
message
.
channel
.
send
(
calm
Embed
);
message
.
channel
.
send
(
calm
);
}
}
...
...
commands/chat.js
View file @
a9b9410
const
Discord
=
require
(
'discord.js'
);
...
...
commands/checklist.js
View file @
a9b9410
const
Discord
=
require
(
'discord.js'
);
...
...
commands/cute.js
View file @
a9b9410
const
{
MessageEmbed
}
=
require
(
'discord.js'
);
const
Discord
=
require
(
'discord.js'
);
const
randomPuppy
=
require
(
'random-puppy'
);
module
.
exports
=
{
name
:
'cute'
,
description
:
'
pulls cute animal pics and embed post
'
,
execute
(
message
,
args
,
Discord
){
let
reddit
=
[
description
:
'
Embeds pictures pulled from listed subreddits
'
,
async
run
(
client
,
message
,
args
){
const
subreddits
=
[
"aww"
,
"puppies"
,
"toebeans"
]
const
random
=
subreddits
[
Math
.
floor
(
Math
.
random
()
*
subreddits
.
length
-
1
)];
const
img
=
await
randomPuppy
(
random
);
let
subreddit
=
reddit
[
Math
.
floor
(
Math
.
random
()
*
reddit
.
length
-
1
)];
const
cute
=
new
Discord
.
MessageEmbed
()
.
setDescription
(
"Some cute animals to blow away your anxieties!"
)
.
setColor
(
'#91B2C7'
)
.
setURL
(
`https://reddit.com/r/
${
random
}
`
)
.
setImage
(
img
);
const
cuteEmbed
=
new
MessageEmbed
()
.
setDescription
(
"Some cute animals to blow away your anxieties!"
);
randomPuppy
(
subreddit
).
then
(
reponse
=>
{
console
.
log
(
url
);
const
cuteurl
=
url
;
cuteEmbed
.
setColor
(
'#91B2C7'
);
cuteEmbed
.
setImage
(
'${cuteurl}'
);
});
message
.
channel
.
send
(
cuteEmbed
);
message
.
channel
.
send
(
cute
);
}
}
\ No newline at end of file
...
...
commands/help.js
View file @
a9b9410
const
Discord
=
require
(
'discord.js'
);
module
.
exports
=
{
name
:
'help'
,
description
:
'Directs to ;calm'
,
execute
(
message
,
args
){
async
run
(
client
,
message
,
args
){
message
.
channel
.
send
(
'To see available commands, call me with ;calm'
);
}
}
\ No newline at end of file
...
...
config.json
0 → 100644
View file @
a9b9410
{
"token"
:
"OTgwOTAxNzg3MzY2MjE1Njgw.GVFGdS.z9ily3n-7rcJnqf2FrHg3KJn5h_u68llQzJOGU"
}
\ No newline at end of file
main.js
View file @
a9b9410
...
...
@@ -5,23 +5,33 @@ const client = new Discord.Client();
const
prefix
=
';'
;
const
{
token
}
=
require
(
'./config.json'
);
// hid token in config file
const
fs
=
require
(
'fs'
);
const
{
join
}
=
require
(
'path'
);
// Command Handler
client
.
commands
=
new
Discord
.
Collection
();
const
commandFiles
=
fs
.
readdirSync
(
'./commands'
).
filter
(
file
=>
file
.
endsWith
(
'.js'
));
for
(
const
file
of
commandFiles
){
const
commandName
=
file
.
split
(
"."
)[
0
];
const
command
=
require
(
`./commands/
${
file
}
`
);
client
.
commands
.
set
(
command
.
name
,
command
);
console
.
log
(
`Attempting to load command
${
commandName
}
`
);
client
.
commands
.
set
(
commandName
,
command
);
}
//Ready check
client
.
once
(
'ready'
,
()
=>
{
console
.
log
(
'anxietymanager is online'
)
console
.
log
([...
client
.
commands
])
console
.
log
(
`anxietymanager is online.`
)
});
//Command Calls
client
.
on
(
'message'
,
message
=>
{
client
.
on
(
'message'
,
async
message
=>
{
if
(
!
message
.
content
.
startsWith
(
prefix
))
return
;
const
args
=
message
.
content
.
slice
(
prefix
.
length
).
split
(
/ +/
);
...
...
@@ -29,17 +39,17 @@ client.on('message', message => {
if
(
command
==
'ping'
){
message
.
channel
.
send
(
'pong!'
);
}
else
if
(
command
==
'help'
){
client
.
commands
.
get
(
'help'
).
execute
(
message
,
args
);
}
else
if
(
command
==
'calm'
){
client
.
commands
.
get
(
'calm'
).
execute
(
message
,
args
,
Discord
);
}
else
if
(
command
==
'breathe'
){
client
.
commands
.
get
(
'breathe'
).
execute
(
message
,
args
);
}
else
if
(
command
==
'cute'
){
client
.
commands
.
get
(
'cute'
).
execute
(
message
,
args
,
Discord
);
}
});
if
(
!
client
.
commands
.
has
(
command
)){
return
;
}
try
{
client
.
commands
.
get
(
command
).
run
(
client
,
message
,
args
);
}
catch
(
error
){
console
.
error
(
error
);
}
});
client
.
login
(
'OTgwOTAxNzg3MzY2MjE1Njgw.GVFGdS.z9ily3n-7rcJnqf2FrHg3KJn5h_u68llQzJOGU'
);
\ No newline at end of file
client
.
login
(
token
);
\ No newline at end of file
...
...
Please
register
or
login
to post a comment