diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-25 12:38:13 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-25 12:38:13 -0400 |
commit | 6d27d53623d84127c43d3146619106e540549038 (patch) | |
tree | f797712108f295b222da6db803f175a814fa6e28 /src/listeners/message | |
parent | 432b602b5416d61d7f11ade478914fc14a8fc971 (diff) | |
download | tanzanite-6d27d53623d84127c43d3146619106e540549038.tar.gz tanzanite-6d27d53623d84127c43d3146619106e540549038.tar.bz2 tanzanite-6d27d53623d84127c43d3146619106e540549038.zip |
cleaned up eval command, ported test command, fixed listeners, fixed workflow, changed args typings
Diffstat (limited to 'src/listeners/message')
-rw-r--r-- | src/listeners/message/automodCreate.ts | 16 | ||||
-rw-r--r-- | src/listeners/message/automodUpdate.ts | 17 | ||||
-rw-r--r-- | src/listeners/message/level.ts | 9 |
3 files changed, 38 insertions, 4 deletions
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<void> { + 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<void> { + 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<string> = 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<void> { + async exec(...[message]: BushCommandHandlerEvents['messageInvalid']): Promise<void> { if (message.author.bot) return; if (!message.author) return; if (!message.guild) return; |