summary refs log tree commit diff
path: root/src/api/util/handlers
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-01-05 17:12:21 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-01-05 17:16:55 +1100
commita3f2f997a3ddfafdff19bd8911f7b610326c02d8 (patch)
tree7086d2a6971ed06c6d09cda6c277fb544c3c608d /src/api/util/handlers
parentchannel flags whoops (diff)
downloadserver-a3f2f997a3ddfafdff19bd8911f7b610326c02d8.tar.xz
Prettier
Diffstat (limited to 'src/api/util/handlers')
-rw-r--r--src/api/util/handlers/Message.ts21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts
index 37269185..93dc3bf4 100644
--- a/src/api/util/handlers/Message.ts
+++ b/src/api/util/handlers/Message.ts
@@ -53,7 +53,7 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> {
 		channel_id: opts.channel_id,
 		attachments: opts.attachments || [],
 		embeds: opts.embeds || [],
-		reactions: /*opts.reactions ||*/[],
+		reactions: /*opts.reactions ||*/ [],
 		type: opts.type ?? 0,
 	});
 
@@ -180,7 +180,7 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> {
 
 // TODO: cache link result in db
 export async function postHandleMessage(message: Message) {
-	const content = message.content?.replace(/ *\`[^)]*\` */g, "");	// remove markdown
+	const content = message.content?.replace(/ *\`[^)]*\` */g, ""); // remove markdown
 	var links = content?.match(LINK_REGEX);
 	if (!links) return;
 
@@ -201,8 +201,12 @@ export async function postHandleMessage(message: Message) {
 		}
 
 		// bit gross, but whatever!
-		const endpointPublic = Config.get().cdn.endpointPublic || "http://127.0.0.1";	// lol
-		const handler = url.hostname == new URL(endpointPublic).hostname ? EmbedHandlers["self"] : EmbedHandlers[url.hostname] || EmbedHandlers["default"];
+		const endpointPublic =
+			Config.get().cdn.endpointPublic || "http://127.0.0.1"; // lol
+		const handler =
+			url.hostname == new URL(endpointPublic).hostname
+				? EmbedHandlers["self"]
+				: EmbedHandlers[url.hostname] || EmbedHandlers["default"];
 
 		try {
 			let res = await handler(url);
@@ -218,11 +222,10 @@ export async function postHandleMessage(message: Message) {
 				cachePromises.push(cache.save());
 				data.embeds.push(embed);
 			}
-		}
-		catch (e) {
-			Sentry.captureException(e, scope => {
+		} catch (e) {
+			Sentry.captureException(e, (scope) => {
 				scope.clear();
-				scope.setContext("request", { url })
+				scope.setContext("request", { url });
 				return scope;
 			});
 			continue;
@@ -257,7 +260,7 @@ export async function sendMessage(opts: MessageOptions) {
 		} as MessageCreateEvent),
 	]);
 
-	postHandleMessage(message).catch((e) => { }); // no await as it should catch error non-blockingly
+	postHandleMessage(message).catch((e) => {}); // no await as it should catch error non-blockingly
 
 	return message;
 }