Toggle navigation
Toggle navigation
This project
Loading...
Sign in
박건희
/
emon_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-26 21:00:21 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9fd311a52db1bda97b530079e3d43c97dfb5d2f4
9fd311a5
1 parent
4681fda1
initial
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
112 additions
and
0 deletions
button.js
translate.js
button.js
0 → 100644
View file @
9fd311a
const
{
MessageActionRow
,
MessageButton
,
Interaction
}
=
require
(
'discord.js'
);
const
tr
=
require
(
'./translate'
)
exports
.
run
=
async
(
client
,
msg
,
args
,
prefix
)
=>
{
const
row
=
new
MessageActionRow
()
.
addComponents
(
new
MessageButton
()
.
setCustomId
(
'korean'
)
.
setLabel
(
'한국어'
)
.
setStyle
(
'PRIMARY'
),
new
MessageButton
()
.
setCustomId
(
'japanese'
)
.
setLabel
(
'일본어'
)
.
setStyle
(
'PRIMARY'
),
new
MessageButton
()
.
setCustomId
(
'english'
)
.
setLabel
(
'영어'
)
.
setStyle
(
'PRIMARY'
),
);
//버튼 생성
await
msg
.
reply
({
content
:
'번역할 나라를 골라주세요.'
,
components
:
[
row
]
});
//버튼 출력
client
.
on
(
'interactionCreate'
,
interaction
=>
{
if
(
!
interaction
.
isButton
())
return
;
if
(
interaction
.
customId
===
'korean'
){
console
.
log
(
tr
.
temp
);
tr
.
temp
}
});
};
exports
.
config
=
{
name
:
'나라'
,
aliases
:
[
' '
,
' '
,
' '
,
' '
],
category
:
[
'translate'
],
des
:
[
'채팅 내용에 대한 검색결과를 보여줍니다.'
],
use
:
[
'!나라'
]
};
\ No newline at end of file
translate.js
0 → 100644
View file @
9fd311a
const
translatte
=
require
(
'translatte'
);
let
temp
=
'영어모드'
;
exports
.
run
=
async
(
client
,
msg
,
args
,
prefix
)
=>
{
if
(
args
[
0
])
{
// 명령어 뒤에 입력값이 있을 경우 (ex. !<명령어> <채팅>)
/*
if(temp=='영어'){
en_translate(args[0]).then(transed_text=> {msg.reply(transed_text)})
}
else if(temp=='일본어'){
jp_translate(args[0]).then(transed_text=> {msg.reply(transed_text)})
}
else if(temp=="한국어"){
ko_translate(args[0]).then(transed_text=> {msg.reply(transed_text)})
}
*/
en_translate
(
args
[
0
]).
then
(
transed_text
=>
{
msg
.
reply
(
transed_text
)})
}
else
{
msg
.
reply
(
"메세지를 다시 확인해주세요."
);
}
};
function
en_translate
(
distext
){
return
translatte
(
String
(
distext
),
{
to
:
'en'
})
.
then
(
res
=>
{
return
res
.
text
;
}).
catch
(
err
=>
{
console
.
error
(
err
);
throw
err
;
});
}
function
jp_translate
(
distext
){
return
translatte
(
String
(
distext
),
{
to
:
'ja'
})
.
then
(
res
=>
{
return
res
.
text
;
}).
catch
(
err
=>
{
console
.
error
(
err
);
throw
err
;
});
}
function
ko_translate
(
distext
){
return
translatte
(
String
(
distext
),
{
to
:
'ko'
})
.
then
(
res
=>
{
return
res
.
text
;
}).
catch
(
err
=>
{
console
.
error
(
err
);
throw
err
;
});
}
exports
.
config
=
{
name
:
'번역'
,
aliases
:
[
' '
,
' '
,
' '
,
' '
],
category
:
[
'translate'
],
des
:
[
'채팅 내용에 대한 검색결과를 보여줍니다.'
],
use
:
[
'!번역 <채팅>'
]
};
\ No newline at end of file
Please
register
or
login
to post a comment