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-06-02 20:02:26 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
49edce61abf08b596050a6d0bd773c62f9308ce5
49edce61
2 parents
2924f704
a2546f88
Merge branch 'revert-
2924f704
' into 'master'
Revert "Merge branch 'translator' into 'master'" This reverts merge request
!4
See merge request
!5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
124 deletions
button.js
emon_bot
translate.js
button.js
deleted
100644 → 0
View file @
2924f70
const
{
MessageActionRow
,
MessageButton
,
Interaction
}
=
require
(
'discord.js'
);
// var trans = 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'
){
global
.
trans_var
=
'ko'
;
}
else
if
(
interaction
.
customId
===
'japanese'
){
global
.
trans_var
=
'jp'
;
}
else
if
(
interaction
.
customId
===
'english'
){
global
.
trans_var
=
'en'
;
}
});
};
exports
.
config
=
{
name
:
'나라'
,
aliases
:
[
' '
,
' '
,
' '
,
' '
],
category
:
[
'translate'
],
des
:
[
'채팅 내용에 대한 검색결과를 보여줍니다.'
],
use
:
[
'!나라'
]
};
\ No newline at end of file
emon_bot
@
73db82ca
Subproject commit 73db82ca09f26d4cdc84d04c9f3228fe1f5e7511
translate.js
deleted
100644 → 0
View file @
2924f70
const
translatte
=
require
(
'translatte'
);
global
.
trans_var
=
'en'
;
exports
.
run
=
async
(
client
,
msg
,
args
,
prefix
)
=>
{
if
(
args
[
0
])
{
// 명령어 뒤에 입력값이 있을 경우 (ex. !<명령어> <채팅>)
if
(
trans_var
==
'en'
){
en_translate
(
args
[
0
]).
then
(
transed_text
=>
{
msg
.
reply
(
transed_text
)})
}
else
if
(
trans_var
==
'jp'
){
jp_translate
(
args
[
0
]).
then
(
transed_text
=>
{
msg
.
reply
(
transed_text
)})
}
else
if
(
trans_var
==
"ko"
){
ko_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
:
[
'!번역 <채팅>'
]
};
/*고칠 것
1. 상호작용 실패 알림 뜨는거
2. !번역, 영어상태에서 영어 번역하면 에러 떠서 멈춰버림
3. 꾸미기(?)
*/
\ No newline at end of file
Please
register
or
login
to post a comment