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-06-06 23:50:16 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
a1614fedcc46ba2a5dbb3f62a0688f2e7564e857
a1614fed
2 parents
7b4d8af5
22d22641
Merge branch 'release3.0'
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
9 deletions
.gitignore
commands/compass.js
commands/guide.js
commands/help.js
config.json
deploy-commands.js
.gitignore
0 → 100644
View file @
a1614fe
config.json
\ No newline at end of file
commands/compass.js
View file @
a1614fe
...
...
@@ -23,7 +23,7 @@ module.exports = {
let
info_island
=
[];
let
info_contents
=
[];
let
All_contents
=
[
"유령선"
,
"카오스
게이트"
,
"필드 보스
"
];
let
All_contents
=
[
"유령선"
,
"카오스
게이트
"
];
const
$IslandList
=
$
(
"ul.today-quest-list"
).
children
(
"li.list"
);
const
$ContentList
=
$
(
"ul.item-list"
).
children
(
"li.list"
);
...
...
commands/guide.js
0 → 100644
View file @
a1614fe
const
{
SlashCommandBuilder
}
=
require
(
'@discordjs/builders'
);
const
{
MessageEmbed
}
=
require
(
'discord.js'
);
const
axios
=
require
(
"axios"
);
const
cheerio
=
require
(
"cheerio"
);
module
.
exports
=
{
data
:
new
SlashCommandBuilder
()
.
setName
(
'공략'
)
.
setDescription
(
'로스트아크 인벤의 군단장 레이드 공략 글 정보를 소개합니다.'
)
.
addStringOption
((
option
)
=>
option
.
setName
(
'레이드'
)
.
setDescription
(
'군단장 레이드 이름'
)
.
setRequired
(
true
)
.
addChoices
({
name
:
"발탄"
,
value
:
"발탄"
})
.
addChoices
({
name
:
"비아키스"
,
value
:
"비아키스"
})
.
addChoices
({
name
:
"쿠크세이튼"
,
value
:
"쿠크세이튼"
})
.
addChoices
({
name
:
"아브렐슈드"
,
value
:
"아브렐슈드"
})),
async
execute
(
interaction
){
const
rade_name
=
interaction
.
options
.
getString
(
'레이드'
);
const
getHtml
=
async
()
=>
{
try
{
return
await
axios
.
get
(
"https://lostark.inven.co.kr/"
)
}
catch
(
error
){
console
.
error
(
error
);
}
}
await
getHtml
()
.
then
(
html
=>
{
const
$
=
cheerio
.
load
(
html
.
data
);
const
$radeList
=
$
(
"div.menu_item01 div.item_body ul.list"
).
children
(
"li.row"
);
let
rade_info
=
[];
let
rade_url
=
[];
$radeList
.
each
(
function
(
i
,
elem
){
if
(
$
(
this
).
text
().
indexOf
(
rade_name
)
!=
-
1
){
rade_info
.
push
(
$
(
this
).
text
());
rade_url
.
push
(
$
(
this
).
find
(
'a'
).
attr
(
'href'
));
}
})
let
rade_print
=
""
;
for
(
var
i
=
0
;
i
<
rade_info
.
length
;
i
++
){
rade_print
+=
`[
${
rade_info
[
i
]}
](
${
rade_url
[
i
]}
)\n`
;
}
const
guideembed
=
new
MessageEmbed
()
.
setColor
(
'#6FF3E0'
)
.
setTitle
(
"공략 정보"
)
.
setDescription
(
rade_print
)
interaction
.
reply
({
embeds
:
[
guideembed
],
allowedMentions
:
{
repliedUser
:
false
}
});
})
}
}
\ No newline at end of file
commands/help.js
View file @
a1614fe
...
...
@@ -24,7 +24,9 @@ module.exports = {
.
addField
(
'/정보 <닉네임>'
,
'전투정보실 조회'
,
true
)
.
addField
(
'/로아와 <닉네임>'
,
'로아와 조회'
,
true
)
.
addField
(
'/나침반'
,
'금일 스케줄 조회'
,
true
)
.
addField
(
'/용어 <단어>'
,
'로스트아크 용어 설명'
,
true
);
.
addField
(
'/용어 <단어>'
,
'로스트아크 용어 설명'
,
true
)
.
addField
(
'/각인 <클래스>'
,
'클래스 별 각인 분석 정보 제공'
,
true
)
.
addField
(
'/공략 <레이드>'
,
'군단장 레이드 공략 글 정보 제공'
,
true
);
await
interaction
.
reply
({
embeds
:
[
helpEmbed
],
allowedMentions
:
{
repliedUser
:
false
}});
}
else
if
(
helpCommand
===
"도움"
)
{
const
helpEmbed
=
new
MessageEmbed
()
...
...
@@ -65,9 +67,21 @@ module.exports = {
}
else
if
(
helpCommand
===
"용어"
){
const
helpEmbed
=
new
MessageEmbed
()
.
setColor
(
'#0099ff'
)
.
setTitle
(
`/용어 사용방법`
)
.
setTitle
(
`/용어
<단어>
사용방법`
)
.
setDescription
(
`<단어>에 해당하는 로스트아크 용어 설명을 제공합니다.`
);
await
interaction
.
reply
({
embeds
:
[
helpEmbed
],
allowedMentions
:
{
repliedUser
:
false
}});
}
else
if
(
helpCommand
===
"각인"
){
const
helpEmbed
=
new
MessageEmbed
()
.
setColor
(
'#0099ff'
)
.
setTitle
(
`/각인 <클래스> 사용방법`
)
.
setDescription
(
`<클래스>에 해당하는 로아와 상위 20명의 각인 정보를 분석하고 제공합니다.`
);
await
interaction
.
reply
({
embeds
:
[
helpEmbed
],
allowedMentions
:
{
repliedUser
:
false
}});
}
else
if
(
helpCommand
===
"공략"
)
{
const
helpEmbed
=
new
MessageEmbed
()
.
setColor
(
'#0099ff'
)
.
setTitle
(
`/공략 <레이드> 사용방법`
)
.
setDescription
(
`<레이드>에 해당하는 로스트아크 인벤 사이트의 공략 글 정보를 제공합니다.`
);
await
interaction
.
reply
({
embeds
:
[
helpEmbed
],
allowedMentions
:
{
repliedUser
:
false
}});
}
else
{
await
interaction
.
reply
(
"해당 명령어는 없습니다."
);
}
...
...
config.json
deleted
100644 → 0
View file @
7b4d8af
{
"clientId"
:
"951774447977771068"
,
"token"
:
"OTUxNzc0NDQ3OTc3NzcxMDY4.YisXBw.GRzmw_os4hM2yHsEqTl5CyQN30A"
,
"guildIds"
:
[
"951774261612265522"
,
"915096999152484393"
,
"917734102466195507"
]
}
\ No newline at end of file
deploy-commands.js
View file @
a1614fe
...
...
@@ -20,11 +20,22 @@ const rest = new REST({ version: "9" }).setToken(token);
(
async
()
=>
{
guildIds
.
map
(
async
(
guildId
)
=>
{
try
{
await
rest
.
put
(
Routes
.
applicationGuildCommands
(
clientId
,
guildId
),
{
body
:
commands
});
await
rest
.
put
(
Routes
.
applicationGuildCommands
(
clientId
,
guildId
),
{
body
:
{}
});
console
.
log
(
`
${
guildId
}
서버 성공`
);
}
catch
(
error
)
{
console
.
error
(
error
);
}
});
try
{
await
rest
.
put
(
Routes
.
applicationCommands
(
clientId
),
{
body
:
commands
},
);
console
.
log
(
'글로벌 커맨드 등록 성공'
);
}
catch
(
error
)
{
console
.
error
(
error
);
}
})();
\ No newline at end of file
...
...
Please
register
or
login
to post a comment