summary refs log tree commit diff
path: root/src/api/util/handlers/Message.ts
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-13 17:16:23 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-09-04 10:48:54 +0200
commit8769c7625cafd14e6f304601cc99a195e833d38b (patch)
tree94d37b1ef271490a032cde0605e1b1fb0fe01e0c /src/api/util/handlers/Message.ts
parentPlugins finally load! (diff)
downloadserver-8769c7625cafd14e6f304601cc99a195e833d38b.tar.xz
Fix config table, add plugin events, implement onPreMessageEvent, add
http error data field, migrations
Diffstat (limited to 'src/api/util/handlers/Message.ts')
-rw-r--r--src/api/util/handlers/Message.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts

index d760d27c..07ed11ad 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts
@@ -21,6 +21,13 @@ import { Role, ROLE_MENTION, User, + Application, + Webhook, + Attachment, + Config, + MessageCreateSchema, + PluginEventHandler, + PreMessageEventArgs, USER_MENTION, Webhook } from "@fosscord/util"; @@ -205,6 +212,10 @@ 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; + //TODO: check this, removed toJSON call await Promise.all([ Message.insert(message),