diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-01-12 02:06:15 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-01-12 02:06:15 -0500 |
commit | 9cc951ea2d0c245a6bd6c02941697d3d80b46aa7 (patch) | |
tree | 722161240d3f27024ceac53031e319e353c1ec5d /src/listeners/guild | |
parent | 883bb298e7070e98db41b5a588f932f54d6a1876 (diff) | |
download | tanzanite-9cc951ea2d0c245a6bd6c02941697d3d80b46aa7.tar.gz tanzanite-9cc951ea2d0c245a6bd6c02941697d3d80b46aa7.tar.bz2 tanzanite-9cc951ea2d0c245a6bd6c02941697d3d80b46aa7.zip |
add better guild join and leave logging
Diffstat (limited to 'src/listeners/guild')
-rw-r--r-- | src/listeners/guild/guildCreate.ts | 15 | ||||
-rw-r--r-- | src/listeners/guild/guildDelete.ts | 19 |
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 } + } + ] + }); } } |