From 7d936efb2f37db42c3e57ee9a915ed4d5ab8e25f Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Sat, 27 Aug 2022 05:18:48 +0200 Subject: Cleanup, reformat, fix some todos, git hook fixup! Cleanup, reformat, fix some todos, git hook --- src/api/util/handlers/Message.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/api/util/handlers/Message.ts') diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts index 07ed11ad..5237b26a 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts @@ -18,16 +18,11 @@ import { MessageType, MessageUpdateEvent, OrmUtils, + PluginEventHandler, + PreMessageEventArgs, Role, ROLE_MENTION, User, - Application, - Webhook, - Attachment, - Config, - MessageCreateSchema, - PluginEventHandler, - PreMessageEventArgs, USER_MENTION, Webhook } from "@fosscord/util"; @@ -212,11 +207,15 @@ export async function postHandleMessage(message: Message) { export async function sendMessage(opts: MessageOptions) { const message = await handleMessage({ ...opts, timestamp: new Date() }); - if((await PluginEventHandler.preMessageEvent({ - message - } as PreMessageEventArgs)).filter(x=>x.cancel).length > 0) return; + if ( + ( + await PluginEventHandler.preMessageEvent({ + message + } as PreMessageEventArgs) + ).filter((x) => x.cancel).length > 0 + ) + return; - //TODO: check this, removed toJSON call await Promise.all([ Message.insert(message), emitEvent({ event: "MESSAGE_CREATE", channel_id: opts.channel_id, data: message } as MessageCreateEvent) -- cgit 1.5.1