summary refs log tree commit diff
path: root/src/api/util/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/util/handlers')
-rw-r--r--src/api/util/handlers/Message.ts21
-rw-r--r--src/api/util/handlers/Voice.ts4
2 files changed, 12 insertions, 13 deletions
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) diff --git a/src/api/util/handlers/Voice.ts b/src/api/util/handlers/Voice.ts
index 4d60eb91..624c868a 100644 --- a/src/api/util/handlers/Voice.ts +++ b/src/api/util/handlers/Voice.ts
@@ -1,5 +1,5 @@ import { Config } from "@fosscord/util"; -import { distanceBetweenLocations, IPAnalysis } from "../utility/ipAddress"; +import { distanceBetweenLocations, IPAnalysis } from "../../../util/util/ipAddress"; export async function getVoiceRegions(ipAddress: string, vip: boolean) { const regions = Config.get().regions; @@ -12,7 +12,7 @@ export async function getVoiceRegions(ipAddress: string, vip: boolean) { let min = Number.POSITIVE_INFINITY; for (let ar of availableRegions) { - //TODO the endpoint location should be saved in the database if not already present to prevent IPAnalysis call + //TODO: the endpoint location should be saved in the database if not already present to prevent IPAnalysis call const dist = distanceBetweenLocations(clientIpAnalysis, ar.location || (await IPAnalysis(ar.endpoint))); if (dist < min) {