button.js
1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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: ['!나라']
};