Toggle navigation
Toggle navigation
This project
Loading...
Sign in
유병우
/
lostark-discord-bot
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-05-13 14:38:56 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ec4bc80166089f700803275c7873f7ab8d510265
ec4bc801
1 parent
afc4e28e
Create term information command
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
0 deletions
commands/term.js
terms/request.json
terms/response.json
commands/term.js
0 → 100644
View file @
ec4bc80
const
{
SlashCommandBuilder
}
=
require
(
'@discordjs/builders'
);
const
{
MessageEmbed
}
=
require
(
'discord.js'
);
const
fs
=
require
(
'fs'
);
module
.
exports
=
{
data
:
new
SlashCommandBuilder
()
.
setName
(
'용어'
)
.
setDescription
(
'로스트아크 관련 용어정보를 제공합니다.'
)
.
addStringOption
(
option
=>
option
.
setName
(
'단어'
)
.
setDescription
(
'궁금한 단어'
)
.
setRequired
(
true
)),
async
execute
(
interaction
)
{
const
user_term
=
interaction
.
options
.
getString
(
'단어'
);
await
fs
.
readFile
(
'./terms/response.json'
,
'utf-8'
,
(
err
,
respone
)
=>
{
if
(
err
)
return
console
.
log
(
err
);
const
terms
=
JSON
.
parse
(
respone
);
if
(
user_term
in
terms
){
const
termembed
=
new
MessageEmbed
()
.
setColor
(
'#FFD700'
)
.
setTitle
(
'단어 정보 제공'
)
.
setDescription
(
`
${
user_term
}
:
${
terms
[
user_term
]}
`
)
interaction
.
reply
({
embeds
:
[
termembed
],
allowedMentions
:
{
repliedUser
:
false
}
});
}
else
{
const
termembed
=
new
MessageEmbed
()
.
setColor
(
'#FFD700'
)
.
setTitle
(
'단어 정보 제공'
)
.
setDescription
(
`
${
user_term
}
에 대한 정보가 없어요 ㅠㅠ\n사용자가 많이 입력하는 단어 일수록 정보가 빠르게 추가됩니다!`
)
fs
.
readFile
(
'./terms/request.json'
,
'utf-8'
,
(
err
,
request
)
=>
{
if
(
err
)
return
console
.
log
(
err
);
let
req_terms
=
JSON
.
parse
(
request
);
if
(
user_term
in
req_terms
){
req_terms
[
user_term
]
+=
1
;
let
reqtermJsion
=
JSON
.
stringify
(
req_terms
);
fs
.
writeFile
(
'./terms/request.json'
,
reqtermJsion
,
(
err
)
=>
{
if
(
err
)
return
console
.
log
(
err
);
})
}
else
{
req_terms
[
user_term
]
=
0
;
let
reqtermJsion
=
JSON
.
stringify
(
req_terms
);
fs
.
writeFile
(
'./terms/request.json'
,
reqtermJsion
,
(
err
=>
{
if
(
err
)
return
console
.
log
(
err
);
}))
}
})
interaction
.
reply
({
embeds
:
[
termembed
],
allowedMentions
:
{
repliedUser
:
false
}
});
}
})
},
};
\ No newline at end of file
terms/request.json
0 → 100644
View file @
ec4bc80
{
"user_term"
:
0
,
"temp"
:
1
,
"회파"
:
0
}
\ No newline at end of file
terms/response.json
0 → 100644
View file @
ec4bc80
{
"쌀먹"
:
"골드를 벌어 쌀로 바꿔 먹는다는 의미, 현재는 배틀아이템을 아끼거나 기본세팅을 맞추지 않은 사람을 의미하기도 함"
,
"트팟"
:
"트라이파티"
,
"랏폿"
:
"파티모집 중 서폿자리만 남았다는 의미"
}
\ No newline at end of file
Please
register
or
login
to post a comment