From f0a9f894575871d498447c5de2b5f0f826b117b7 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Wed, 29 Dec 2021 22:14:04 -0500 Subject: events --- src/listeners/guild-custom/bushLockdown.ts | 27 +++++++++++++++++++++++++++ src/listeners/guild-custom/bushUnlockdown.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/listeners/guild-custom/bushLockdown.ts create mode 100644 src/listeners/guild-custom/bushUnlockdown.ts (limited to 'src/listeners/guild-custom') diff --git a/src/listeners/guild-custom/bushLockdown.ts b/src/listeners/guild-custom/bushLockdown.ts new file mode 100644 index 0000000..be55a07 --- /dev/null +++ b/src/listeners/guild-custom/bushLockdown.ts @@ -0,0 +1,27 @@ +import { BushListener, type BushClientEvents } from '#lib'; +import { MessageEmbed } from 'discord.js'; + +export default class BushLockdownListener extends BushListener { + public constructor() { + super('bushLockdown', { + emitter: 'client', + event: 'bushLockdown', + category: 'guild-custom' + }); + } + + public override async exec(...[moderator, reason, channel, _all]: BushClientEvents['bushLockdown']) { + const logChannel = await moderator.guild.getLogChannel('moderation'); + if (!logChannel) return; + + const logEmbed = new MessageEmbed() + .setColor(util.colors.discord.BLURPLE) + .setTimestamp() + .addField('**Action**', `${'Lockdown'}`) + .addField('**Moderator**', `${moderator} (${moderator.user.tag})`) + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + .addField('**Reason**', `${reason || '[No Reason Provided]'}`) + .addField('**Channel**', `${channel?.id ? `<#${channel.id}>` : '[All Configured Channels]'}`); + return await logChannel.send({ embeds: [logEmbed] }); + } +} diff --git a/src/listeners/guild-custom/bushUnlockdown.ts b/src/listeners/guild-custom/bushUnlockdown.ts new file mode 100644 index 0000000..d5831c6 --- /dev/null +++ b/src/listeners/guild-custom/bushUnlockdown.ts @@ -0,0 +1,27 @@ +import { BushListener, type BushClientEvents } from '#lib'; +import { MessageEmbed } from 'discord.js'; + +export default class BushUnlockdownListener extends BushListener { + public constructor() { + super('bushUnlockdown', { + emitter: 'client', + event: 'bushUnlockdown', + category: 'guild-custom' + }); + } + + public override async exec(...[moderator, reason, channel, _all]: BushClientEvents['bushUnlockdown']) { + const logChannel = await moderator.guild.getLogChannel('moderation'); + if (!logChannel) return; + + const logEmbed = new MessageEmbed() + .setColor(util.colors.discord.BLURPLE) + .setTimestamp() + .addField('**Action**', `${'Unlockdown'}`) + .addField('**Moderator**', `${moderator} (${moderator.user.tag})`) + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + .addField('**Reason**', `${reason || '[No Reason Provided]'}`) + .addField('**Channel**', `${channel?.id ? `<#${channel.id}>` : '[All Configured Channels]'}`); + return await logChannel.send({ embeds: [logEmbed] }); + } +} -- cgit