-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbutton_message.js
39 lines (38 loc) · 1.19 KB
/
button_message.js
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
const Discord = require('discord.js');
const fetch = require('node-fetch');
const bot = new Discord.Client();
bot.prefix = ".";
bot.token = token;
bot.on('ready', ()=>{
bot.user.setActivity("stuff");
console.on('online');
});
bot.on('message', async(msg)=>{
if (message.author.bot) return;
if (msg.content.toLowerCase() != '.batan') return;
fetch(`https://discord.com/api/v9/channels/${message.channel.id}/messages`, {
method: "POST",
body: JSON.stringify({"content":"batan",
"components": [{
"type": 1,
"components": [
{
"type": 2,
"label": "batan",
"style": 4,
"custom_id": "the_id_you_want"
"emoji":{
"name" : "the emoji name",
"id": "the emoji is"
}
}
]
}]}),
headers: {
"Authorization": `Bot ${bot.token}`,
"Content-Type": "application/json"
}
})
}
}
bot.login(bot.token);