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:33:43 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
98b0e10a85603a777bfe252dbb1977c3a3a7a0d3
98b0e10a
1 parent
9fd311a5
can translate
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
10 deletions
button.js
translate.js
button.js
View file @
98b0e10
const
{
MessageActionRow
,
MessageButton
,
Interaction
}
=
require
(
'discord.js'
);
const
tr
=
require
(
'./translate'
)
// var trans = require('./translate');
exports
.
run
=
async
(
client
,
msg
,
args
,
prefix
)
=>
{
...
...
@@ -28,8 +29,15 @@ exports.run = async (client, msg, args, prefix) => {
if
(
!
interaction
.
isButton
())
return
;
if
(
interaction
.
customId
===
'korean'
){
console
.
log
(
tr
.
temp
);
tr
.
temp
global
.
trans_var
=
'ko'
;
}
else
if
(
interaction
.
customId
===
'japanese'
){
global
.
trans_var
=
'jp'
;
}
else
if
(
interaction
.
customId
===
'english'
){
global
.
trans_var
=
'en'
;
}
});
...
...
translate.js
View file @
98b0e10
const
translatte
=
require
(
'translatte'
);
let
temp
=
'영어모드
'
;
global
.
trans_var
=
'en
'
;
exports
.
run
=
async
(
client
,
msg
,
args
,
prefix
)
=>
{
if
(
args
[
0
])
{
// 명령어 뒤에 입력값이 있을 경우 (ex. !<명령어> <채팅>)
/*
if(temp=='영어'){
if
(
trans_var
==
'en'
){
en_translate
(
args
[
0
]).
then
(
transed_text
=>
{
msg
.
reply
(
transed_text
)})
}
else if(t
emp=='일본어
'){
else
if
(
t
rans_var
==
'jp
'
){
jp_translate
(
args
[
0
]).
then
(
transed_text
=>
{
msg
.
reply
(
transed_text
)})
}
else if(t
emp=="한국어
"){
else
if
(
t
rans_var
==
"ko
"
){
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
(
"메세지를 다시 확인해주세요."
);
...
...
@@ -65,3 +62,9 @@ exports.config = {
des
:
[
'채팅 내용에 대한 검색결과를 보여줍니다.'
],
use
:
[
'!번역 <채팅>'
]
};
/*고칠 것
1. 상호작용 실패 알림 뜨는거
2. !번역, 영어상태에서 영어 번역하면 에러 떠서 멈춰버림
3. 꾸미기(?)
*/
\ No newline at end of file
...
...
Please
register
or
login
to post a comment