-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
51 lines (42 loc) · 1.8 KB
/
index.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
40
41
42
43
44
45
46
47
48
49
50
51
const { Collection, Client, Discord, MessageEmbed, Message } = require('discord.js');
const client = new Client({
disableMention: 'everyone'
});
require('discord-buttons')(client);
const { MessageButton, MessageActionRow } = require("discord-buttons")
const config = {
prefix: '.', // เพิ่มข้อมูล prefix ตามที่ต้องการ
roleid: 'YOUR_ROLE_ID_HERE' // เพิ่ม ID ของบทบาทที่ต้องการให้มอบหลังจากการยืนยันตัวตน
};
client.prefix = config.prefix;
client.on('clickButton', async (button) => {
if (button.id == 'AddVerifiedRole') {
button.reply.send(`You have been verified!`, true)
const role = button.guild.roles.cache.get(config.roleid)
const member = button.clicker.member
await member.roles.add(role)
}
})
client.on("ready", () => {
console.log("Bot online & ready!");
client.user.setActivity("Verify by DanLoans", {
type: "STREAMING",
url: ""
});
});
client.on('message', async (message) => {
if (message.content.startsWith(config.prefix + 'verify')) { // เปลี่ยนจาก '.verify' เป็น config.prefix + 'verify'
const embed = new MessageEmbed()
.setTitle('Verification')
.setColor("GREEN")
.setDescription('Click the button below to verify!')
const add = new MessageButton()
.setStyle("green")
.setLabel("Verify Me!")
.setID("AddVerifiedRole")
const row = new MessageActionRow()
.addComponent(add)
message.channel.send({ component: row, embed: embed })
}
})
client.login('YOUR_BOT_TOKEN_HERE'); // เพิ่มโทเคนของบอทที่นี่