From 6d27d53623d84127c43d3146619106e540549038 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sun, 25 Jul 2021 12:38:13 -0400 Subject: cleaned up eval command, ported test command, fixed listeners, fixed workflow, changed args typings --- src/listeners/message/automodCreate.ts | 16 ++++++++++++++++ src/listeners/message/automodUpdate.ts | 17 +++++++++++++++++ src/listeners/message/level.ts | 9 +++++---- 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 src/listeners/message/automodCreate.ts create mode 100644 src/listeners/message/automodUpdate.ts (limited to 'src/listeners/message') diff --git a/src/listeners/message/automodCreate.ts b/src/listeners/message/automodCreate.ts new file mode 100644 index 0000000..f1c4ccd --- /dev/null +++ b/src/listeners/message/automodCreate.ts @@ -0,0 +1,16 @@ +import { BushListener, BushMessage } from '@lib'; +import { ClientEvents } from 'discord.js'; + +export default class AutomodMessageCreateListener extends BushListener { + public constructor() { + super('automodCreate', { + emitter: 'client', + event: 'messageCreate', + category: 'message' + }); + } + + async exec(...[message]: ClientEvents['messageCreate']): Promise { + return await this.client.util.automod(message as BushMessage) + } +} diff --git a/src/listeners/message/automodUpdate.ts b/src/listeners/message/automodUpdate.ts new file mode 100644 index 0000000..37e00bf --- /dev/null +++ b/src/listeners/message/automodUpdate.ts @@ -0,0 +1,17 @@ +import { BushListener, BushMessage } from '@lib'; +import { ClientEvents, Message } from 'discord.js'; + +export default class AutomodMessageUpdateListener extends BushListener { + public constructor() { + super('automodUpdate', { + emitter: 'client', + event: 'messageUpdate', + category: 'message' + }); + } + + async exec(...[message]: ClientEvents['messageUpdate']): Promise { + const fullMessage = message.partial ? await message.fetch() : (message as Message); + return await this.client.util.automod(fullMessage as BushMessage); + } +} diff --git a/src/listeners/message/level.ts b/src/listeners/message/level.ts index b06fdd2..1ff098e 100644 --- a/src/listeners/message/level.ts +++ b/src/listeners/message/level.ts @@ -1,5 +1,5 @@ -import { BushListener, Level } from '@lib'; -import { Message, MessageType } from 'discord.js'; +import { BushCommandHandlerEvents, BushListener, Level } from '@lib'; +import { MessageType } from 'discord.js'; export default class LevelListener extends BushListener { private levelCooldowns: Set = new Set(); @@ -7,10 +7,11 @@ export default class LevelListener extends BushListener { public constructor() { super('level', { emitter: 'commandHandler', - event: 'messageInvalid' // Using messageInvalid here so commands don't give xp + event: 'messageInvalid', // Using messageInvalid here so commands don't give xp + category: 'message' }); } - async exec(message: Message): Promise { + async exec(...[message]: BushCommandHandlerEvents['messageInvalid']): Promise { if (message.author.bot) return; if (!message.author) return; if (!message.guild) return; -- cgit