aboutsummaryrefslogtreecommitdiff
path: root/src/listeners
diff options
context:
space:
mode:
Diffstat (limited to 'src/listeners')
-rw-r--r--src/listeners/guild/guildCreate.ts15
-rw-r--r--src/listeners/guild/guildDelete.ts19
2 files changed, 32 insertions, 2 deletions
diff --git a/src/listeners/guild/guildCreate.ts b/src/listeners/guild/guildCreate.ts
index 16b0862..418df3a 100644
--- a/src/listeners/guild/guildCreate.ts
+++ b/src/listeners/guild/guildCreate.ts
@@ -13,5 +13,20 @@ export default class GuildCreateListener extends BushListener {
void client.console.info('guildCreate', `Joined <<${guild.name}>> with <<${guild.memberCount?.toLocaleString()}>> members.`);
const g = await Guild.findByPk(guild.id);
if (!g) void Guild.create({ id: guild.id });
+
+ const channel = await util.getConfigChannel('log');
+ if (!channel) return;
+ return await channel.send({
+ embeds: [
+ {
+ color: util.colors.discord.GREEN,
+ description: `${util.emojis.join} Joined ${util.format.input(
+ guild.name
+ )} with **${guild.memberCount?.toLocaleString()}** members. I am now in **${client.guilds.cache.size}** guilds.`,
+ timestamp: new Date(),
+ footer: { text: `${guild.id}`, iconURL: guild.iconURL() ?? undefined }
+ }
+ ]
+ });
}
}
diff --git a/src/listeners/guild/guildDelete.ts b/src/listeners/guild/guildDelete.ts
index 5480a7b..f036a8d 100644
--- a/src/listeners/guild/guildDelete.ts
+++ b/src/listeners/guild/guildDelete.ts
@@ -4,12 +4,27 @@ export default class GuildDeleteListener extends BushListener {
public constructor() {
super('guildDelete', {
emitter: 'client',
- event: 'guildDelete', //when the bot leaves a guild
+ event: 'guildDelete', // when the bot leaves a guild
category: 'guild'
});
}
- public override exec(...[guild]: BushClientEvents['guildDelete']): void {
+ public override async exec(...[guild]: BushClientEvents['guildDelete']) {
void client.console.info('guildDelete', `Left <<${guild.name}>> with <<${guild.memberCount?.toLocaleString()}>> members.`);
+
+ const channel = await util.getConfigChannel('log');
+ if (!channel) return;
+ return await channel.send({
+ embeds: [
+ {
+ color: util.colors.discord.RED,
+ description: `${util.emojis.leave} Left ${util.format.input(
+ guild.name
+ )} with **${guild.memberCount?.toLocaleString()}** members. I am now in **${client.guilds.cache.size}** guilds.`,
+ timestamp: new Date(),
+ footer: { text: `${guild.id}`, iconURL: guild.iconURL() ?? undefined }
+ }
+ ]
+ });
}
}