-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
143 lines (108 loc) · 4.55 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
const { Client, Intents, Collection, Interaction } = require("discord.js");
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
partials: ['MESSAGE', 'CHANNEL', 'REACTION']
});
const { MessageEmbed, Channel } = require('discord.js');
const { MessageActionRow, MessageButton } = require('discord.js');
const { readdirSync } = require('fs');
const config = require("./config.json");
const token = require("./token.json");
client.login(token.token);
client.on("ready", () => {
client.user.setActivity("YOUR ACTIVITY")
})
const fs = require("fs");
const internal = require('stream');
client.commands = new Collection();
const commandsFiles = fs.readdirSync("./commands").filter(file => file.endsWith(".js"));
for (const file of commandsFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
const commandsFolder = fs.readdirSync("./commands");
for (const folder of commandsFolder) {
const commandsFiles = fs.readdirSync(`./commands/${folder}`).filter(file => file.endsWith(".js"));
for (const file of commandsFiles) {
const command = require(`./commands/${folder}/${file}`);
client.commands.set(command.name, command);
}
}
const eventsFiles = fs.readdirSync("./events").filter(file => file.endsWith(".js"));
for (const file of eventsFiles) {
const event = require(`./events/${file}`);
client.on(event.name, (...args) => event.execute(...args))
}
client.on("message", message => {
const prefix = "your prefix";
if (!message.content.startsWith(prefix) || message.author.bot) return
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
if (!client.commands.has(command) && !client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(command))) return
var comando = client.commands.get(command) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(command))
if (comando.onlyStaff) {
if (!message.member.hasPermission("ADMINISTRATOR")) {
message.channel.send("You Don't Have Permission")
return
}
}
comando.execute(message, client, args);
})
// SYSTEM VERIFY
client.on('messageCreate', (message) => {
const embedverify = new MessageEmbed()
.setColor('BLUE')
.setTitle('TITLE')
.addField('DESCRIPTION1', 'DESCRIPTION2')
.setFooter('FOOTER', 'LINK')
const bottonverify = new MessageActionRow()
.setComponents(
new MessageButton()
.setCustomId('arrowL')
.setLabel('»')
.setStyle('SUCCESS')
.setDisabled(true),
new MessageButton()
.setCustomId('verify')
.setLabel('✅')
.setStyle('SUCCESS'),
new MessageButton()
.setCustomId('arrowR')
.setLabel('«')
.setStyle('SUCCESS')
.setDisabled(true),
)
if (message.content == config.prefix + "your command") {
message.delete()
message.channel.send({ embeds: [embedverify], components: [bottonverify]})
}
})
client.on('interactionCreate', (interaction) => {
const logverify = new MessageEmbed()
.setColor('GREEN')
.setTitle('VERIFY LOG')
.setDescription(`<@${interaction.member.id}> It Occurred Correctly!`)
const channelLog = client.channels.cache.get("ID CHANNEL LOG");
if (interaction.customId == 'verify') {
if(interaction.member.roles.cache.get(config.member)){
return interaction.reply({
content: '**___You have already been verified!___**',
ephemeral: true
})
}else{
interaction.reply({
content: '**___after verification there is this description___**',
ephemeral: true
})
interaction.member.roles.add(config.member)
channelLog.send({embeds: [logverify] });
return;
}
}
// EVENT WELCOME
client.on("guildMemberAdd", member => {
var embed = new MessageEmbed()
.setTitle("WELCOME")
.setDescription(`Hello ${member.toString()}, welcome in ${member.guild.name}. you are the **${member.guild.memberCount}° member**`)
client.channels.cache.get("id room tho send this embed").send({embeds: [embed]});
})