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 21:28:41 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b3ba0c3068d91507cf6a1316becf536930acfc6c
b3ba0c30
1 parent
8e7b5d64
button disabled
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
4 deletions
Commands/Translate/button.js
Commands/Translate/translate.js
Commands/Translate/button.js
View file @
b3ba0c3
...
...
@@ -2,6 +2,31 @@ const { MessageActionRow, MessageButton, Interaction } = require('discord.js');
// var trans = require('./translate');
var
disabled_var
=
{
en
:
true
,
ko
:
false
,
jp
:
false
};
function
func_disabled_var
(
input_str
){
if
(
input_str
==
"en"
){
disabled_var
.
en
=
true
;
disabled_var
.
ko
=
false
;
disabled_var
.
jp
=
false
;
}
else
if
(
input_str
==
"ko"
){
disabled_var
.
en
=
false
;
disabled_var
.
ko
=
true
;
disabled_var
.
jp
=
false
;
}
else
if
(
input_str
==
"jp"
){
disabled_var
.
en
=
false
;
disabled_var
.
ko
=
false
;
disabled_var
.
jp
=
true
;
}
}
exports
.
run
=
async
(
client
,
msg
,
args
,
prefix
)
=>
{
const
row
=
new
MessageActionRow
()
...
...
@@ -9,17 +34,20 @@ exports.run = async (client, msg, args, prefix) => {
new
MessageButton
()
.
setCustomId
(
'korean'
)
.
setLabel
(
'한국어'
)
.
setStyle
(
'PRIMARY'
),
.
setStyle
(
'PRIMARY'
)
.
setDisabled
(
disabled_var
.
ko
),
new
MessageButton
()
.
setCustomId
(
'japanese'
)
.
setLabel
(
'일본어'
)
.
setStyle
(
'PRIMARY'
),
.
setStyle
(
'PRIMARY'
)
.
setDisabled
(
disabled_var
.
jp
),
new
MessageButton
()
.
setCustomId
(
'english'
)
.
setLabel
(
'영어'
)
.
setStyle
(
'PRIMARY'
),
.
setStyle
(
'PRIMARY'
)
.
setDisabled
(
disabled_var
.
en
),
);
//버튼 생성
await
msg
.
reply
({
content
:
'번역할 나라를 골라주세요.'
,
components
:
[
row
]
});
...
...
@@ -30,14 +58,17 @@ exports.run = async (client, msg, args, prefix) => {
if
(
interaction
.
customId
===
'korean'
){
global
.
trans_var
=
'ko'
;
func_disabled_var
(
'ko'
);
}
else
if
(
interaction
.
customId
===
'japanese'
){
global
.
trans_var
=
'jp'
;
func_disabled_var
(
'jp'
);
}
else
if
(
interaction
.
customId
===
'english'
){
global
.
trans_var
=
'en'
;
func_disabled_var
(
'en'
);
}
});
...
...
Commands/Translate/translate.js
View file @
b3ba0c3
...
...
@@ -65,6 +65,5 @@ exports.config = {
/*고칠 것
1. 상호작용 실패 알림 뜨는거
2. !번역, 영어상태에서 영어 번역하면 에러 떠서 멈춰버림
3. 꾸미기(?)
*/
\ No newline at end of file
...
...
Please
register
or
login
to post a comment