-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(events): create Events.PreMessageParsed (#164)
BREAKING CHANGE: CoreMessageParser is not longer a message event listener
- Loading branch information
Showing
3 changed files
with
22 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { PieceContext } from '@sapphire/pieces'; | ||
import type { Message } from 'discord.js'; | ||
import { Event } from '../../lib/structures/Event'; | ||
import { Events } from '../../lib/types/Events'; | ||
|
||
export class CoreEvent extends Event<Events.Message> { | ||
public constructor(context: PieceContext) { | ||
super(context, { event: Events.Message }); | ||
} | ||
|
||
public run(message: Message) { | ||
// Stop bots and webhooks from running commands. | ||
if (message.author.bot || message.webhookID) return; | ||
|
||
// Run the message parser. | ||
this.context.client.emit(Events.PreMessageParsed, message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters