-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
110 lines (93 loc) · 4.51 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
const Discord = require("discord.js");
const { Client, Collection } = require("discord.js");
const db = require("quick.db")
const fs = require("fs");
const { MessageEmbed } = require("discord.js")
const token = "";
const client = new Client({
disableEveryone: true
});
client.commands = new Collection();
client.aliases = new Collection();
["command"].forEach(handler => {
require(`./handlers/${handler}`)(client);
});
client.categories = fs.readdirSync("./komendy/");
client.on("guildDelete", guild => {
client.channels.cache.get("835235989613051965").send("**Wyrzucono bota z serwera!**\n Serwer: `" + guild.name + " || " + guild.id + "`\n Osoby: `" + guild.members.cache.size + "`")
db.delete(`reklama_do_${guild.id}`)
db.delete(`reklama_do_${guild.id}_osoba`)
db.delete(`reklama_do_${guild.id}_name`)
db.delete(`reklama_${guild.id}_serwera`)
db.delete(`kanal_reklama_${guild.id}`)
})
client.on("ready", async message => {
client.user.setPresence({ activity: { name: `🔗 @ClyeBOT | 1.1` }, status: 'online' })
console.log(`${client.user.tag}`);
console.log(db.get(`numer`))
setInterval(() => {
let numer = db.get(`numer`)
if (!db.get(`reklama_${numer}`)) {
return db.set(`numer`, 1), console.log("Koniec kolejki!")
}
let id_rek = db.get(`reklama_${numer}_id`)
client.guilds.cache.forEach(servers_each => {
if (db.get(`premium_${id_rek}`)) {
if (!db.get(`kanal_reklama_${servers_each.id}`)) return;
if (!client.channels.cache.get(db.get(`kanal_reklama_${servers_each.id}`))) return;
if (!client.guilds.cache.get(servers_each.id)) return;
const embed = new Discord.MessageEmbed()
.setAuthor(`Reklama __PREMIUM NUMER:__${numer} || ${id_rek}`, "https://cdn.discordapp.com/attachments/809356941255901200/810239355121041458/konfetti.gif")
.setColor("RANDOM")
.setDescription(db.get(`reklama_${numer}`))
client.channels.cache.get(db.get(`kanal_reklama_${servers_each.id}`)).send(embed)
} else {
if (!db.get(`kanal_reklama_${servers_each.id}`)) return;
if (!client.channels.cache.get(db.get(`kanal_reklama_${servers_each.id}`))) return;
if (!client.guilds.cache.get(servers_each.id)) return;
client.channels.cache.get(db.get(`kanal_reklama_${servers_each.id}`)).send(`**🔗 Numer:** **${numer}** \n **🧪 Id:** **${db.get(`reklama_${numer}_id`)}** \n\n${db.get(`reklama_${numer}`)}`)
}
})
db.add(`numer`, 1)
}, 300000)
});
client.on(`guildMemberAdd`, async member => {
if (!(member.guild.id === `832544901245698099`)) return
else {
const channel = member.guild.channels.cache.find(ch => ch.id === `835235961344098388`)
if (!channel) return
const embed = new Discord.MessageEmbed()
embed
.setTitle(`Witamy cię użytkowniku!`)
.setColor(`#8138ff`)
.setDescription(`Witaj ${member.user} na **${member.guild.name}**! Jesteś naszym ${member.guild.memberCount} użytkownikiem.`)
.setThumbnail(member.user.displayAvatarURL({ dynamic: true }))
.setImage(`http://patryczekktv.pl/img/MaciexWitamy.png`)
.setFooter(`${member.user.tag} (${member.user.id})`, member.user.displayAvatarURL({ dynamic: true }))
channel.send(embed)
}
})
client.on("guildCreate", guild => {
console.log(`Dodano na Serwer ${guild.name}`)
client.channels.cache.get("835235989613051965").send("**Dodano bota na serwer!**\n Serwer: `" + guild.name + " || " + guild.id + "`\n Osoby: `" + guild.members.cache.size + "`")
})
client.on("message", async message => {
if (message.content == `<@!${client.user.id}>`) {
message.channel.send("Witaj! Mój prefix to **c!** Moje komendy znajdziesz pod **c!pomoc**")
}
})
client.on("message", async message => {
const prefix = "c!"
if (message.author.bot) return;
if (!message.guild) return;
if (!message.content.startsWith(prefix)) return;
if (!message.member) message.member = await message.guild.fetchMember(message);
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const cmd = args.shift().toLowerCase();
if (cmd.length === 0) return;
let command = client.commands.get(cmd);
if (!command) command = client.commands.get(client.aliases.get(cmd));
if (command)
command.run(client, message, args);
});
client.login(token);