-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
85 lines (61 loc) · 2.67 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
const Discord = require('discord.js');
global.client = new Discord.Client({ intents: 32767 , partials: ['MESSAGE', 'CHANNEL', 'REACTION']})
//'DIRECT_MESSAGES', 'DIRECT_MESSAGE_TYPING', 'DIRECT_MESSAGE_REACTIONS', 'GUILDS', 'GUILD_MESSAGES', 'GUILD_MEMBERS', 'GUILD_BANS', 'GUILD_EMOJIS_AND_STICKERS', 'GUILD_INTEGRATIONS', 'MANAGE_ROLES'
client.login(process.env.token);
const fs = require('fs');
client.commands= new Discord.Collection();
//file
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);
}
//cartelle
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);
}
}
//eventi
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))
}
//eseguire comando
client.on("messageCreate", message => {
const prefix = "!";
if(!message.content.startsWith(prefix)) 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.permissions.has('ADMINISTRATOR')){
return message.channel.send("Non puoi eseguire questo comando perchè non hai il permesso");
}else if(message.channel.type == "DM"){
return
}
}
comando.execute(message, args);
})
setInterval(function () {
var canale = client.channels.cache.get("969232878057689118");
canale.setName(`👾members: ${canale.guild.memberCount}`);
}, 1000 * 60 * 5)
setInterval(function () {
var canale = client.channels.cache.get('964927790954725478');
canale.bulkDelete(100, true)
}, 1000 * 604800)
//-----asegna
//interaction.member.roles.add("965223293789548575")
//---only channennel
//client.on("messageCreate", message => {
// if(message.channel.id != "IdChannel") return
// if(message.content == "!test"){
// message.channel.send("Ciao")
// }
//}