2021-11-18 18:56:42 +01:00
|
|
|
const client = require("../");
|
2022-10-26 12:38:28 +02:00
|
|
|
const { EmbedBuilder } = require("discord.js");
|
2021-09-17 18:28:39 +02:00
|
|
|
const db = require("../models/guilds");
|
|
|
|
client.on("guildCreate", guild => {
|
2021-11-18 18:56:42 +01:00
|
|
|
client.channels.cache.get(client.config.ServerLog).send({
|
2021-09-17 18:28:39 +02:00
|
|
|
embeds: [
|
2022-10-26 12:38:28 +02:00
|
|
|
new EmbedBuilder()
|
2021-09-17 18:28:39 +02:00
|
|
|
.setTitle("New Server")
|
|
|
|
.addField(
|
|
|
|
"Server Info",
|
|
|
|
`**>Server Name**: \n${guild.name}
|
|
|
|
**>Server ID**: \n${guild.id}
|
|
|
|
**>Server Member Count**: \n${guild.memberCount}`
|
|
|
|
)
|
2022-10-26 12:38:28 +02:00
|
|
|
.setFooter({
|
|
|
|
text: `${client.user.username} Currently in ${client.guilds.cache.size} servers`,
|
|
|
|
iconURL: client.user.displayAvatarURL(),
|
|
|
|
})
|
2021-09-17 18:28:39 +02:00
|
|
|
.setTimestamp()
|
|
|
|
.setThumbnail(guild.iconURL({ dynamic: true }))
|
|
|
|
.setColor("GREEN"),
|
|
|
|
],
|
|
|
|
});
|
|
|
|
const newdb = new db({
|
|
|
|
Guild: guild.id,
|
2021-11-18 18:56:42 +01:00
|
|
|
Prefix: client.config.prefix,
|
2021-09-17 18:28:39 +02:00
|
|
|
});
|
|
|
|
newdb.save();
|
2021-06-12 12:53:51 +02:00
|
|
|
});
|
|
|
|
|
2021-09-17 18:28:39 +02:00
|
|
|
client.on("guildDelete", async guild => {
|
|
|
|
client.data.DelGuild(guild.id);
|
2021-11-18 18:56:42 +01:00
|
|
|
client.channels.cache.get(client.config.ServerLog).send({
|
2021-09-17 18:28:39 +02:00
|
|
|
embeds: [
|
2022-10-26 12:38:28 +02:00
|
|
|
new EmbedBuilder()
|
2021-09-17 18:28:39 +02:00
|
|
|
.setTitle("Deleted Server")
|
|
|
|
.addField(
|
|
|
|
"Server Info",
|
|
|
|
`**>Server Name**: \n${guild.name}
|
|
|
|
**>Server ID**: \n${guild.id}
|
|
|
|
**>Server Member Count**: \n${guild.memberCount}`
|
|
|
|
)
|
2022-10-26 12:38:28 +02:00
|
|
|
.setFooter({
|
|
|
|
text: `${client.user.username} Currently in ${client.guilds.cache.size} servers`,
|
|
|
|
iconURL: client.user.displayAvatarURL(),
|
|
|
|
})
|
2021-09-17 18:28:39 +02:00
|
|
|
.setTimestamp()
|
|
|
|
.setThumbnail(guild.iconURL({ dynamic: true }))
|
|
|
|
.setColor("RED"),
|
|
|
|
],
|
|
|
|
});
|
2021-06-12 12:53:51 +02:00
|
|
|
});
|
2021-09-17 18:28:39 +02:00
|
|
|
client.prefix = async function (message) {
|
|
|
|
let custom;
|
|
|
|
if (!message.guild) return;
|
|
|
|
const data = await db
|
|
|
|
.findOne({ Guild: message.guild.id })
|
|
|
|
.catch(err => console.log(err));
|
|
|
|
if (data) custom = data.Prefix;
|
2021-09-21 01:51:56 +02:00
|
|
|
else custom = client.config.prefix;
|
2021-09-17 18:28:39 +02:00
|
|
|
return custom;
|
|
|
|
};
|