aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-01-12 02:06:15 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-01-12 02:06:15 -0500
commit9cc951ea2d0c245a6bd6c02941697d3d80b46aa7 (patch)
tree722161240d3f27024ceac53031e319e353c1ec5d /src
parent883bb298e7070e98db41b5a588f932f54d6a1876 (diff)
downloadtanzanite-9cc951ea2d0c245a6bd6c02941697d3d80b46aa7.tar.gz
tanzanite-9cc951ea2d0c245a6bd6c02941697d3d80b46aa7.tar.bz2
tanzanite-9cc951ea2d0c245a6bd6c02941697d3d80b46aa7.zip
add better guild join and leave logging
Diffstat (limited to 'src')
-rw-r--r--src/config/example-options.ts3
-rw-r--r--src/lib/utils/Config.ts1
-rw-r--r--src/listeners/guild/guildCreate.ts15
-rw-r--r--src/listeners/guild/guildDelete.ts19
4 files changed, 35 insertions, 3 deletions
diff --git a/src/config/example-options.ts b/src/config/example-options.ts
index 21c99ad..338428e 100644
--- a/src/config/example-options.ts
+++ b/src/config/example-options.ts
@@ -20,7 +20,8 @@ export default new Config({
channels: {
log: '1000000000000000',
error: '1000000000000000',
- dm: '1000000000000000'
+ dm: '1000000000000000',
+ servers: '1000000000000000'
},
db: {
host: 'localhost',
diff --git a/src/lib/utils/Config.ts b/src/lib/utils/Config.ts
index 0d44924..bc31964 100644
--- a/src/lib/utils/Config.ts
+++ b/src/lib/utils/Config.ts
@@ -70,6 +70,7 @@ interface Channels {
log: Snowflake;
error: Snowflake;
dm: Snowflake;
+ servers: Snowflake;
}
interface DataBase {
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 }
+ }
+ ]
+ });
}
}