fix: catch null at other places (#252)

This commit is contained in:
Jayvin Hernandez 2022-12-18 15:05:54 -08:00 committed by GitHub
parent 658f3a1a09
commit eb1b202566
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,9 +14,9 @@ export function parseContent(
content: parseString(content.content, args), content: parseString(content.content, args),
embed: content.embed embed: content.embed
? { ? {
title: parseString(content.embed.title, args), title: content.embed.title ? parseString(content.embed.title, args) : null,
description: parseString(content.embed.description, args), description: content.embed.description ? parseString(content.embed.description, args) : null,
footer: parseString(content.embed.footer, args), footer: content.embed.footer ? parseString(content.embed.footer, args) : null,
color: content.embed.color, color: content.embed.color,
thumbnail: content.embed.thumbnail, thumbnail: content.embed.thumbnail,
timestamp: content.embed.timestamp, timestamp: content.embed.timestamp,
@ -73,7 +73,7 @@ export async function sendUpload(user: User, image: Image, raw_link: string, lin
: null, : null,
}); });
logger.debug('attempting to send shorten notification to discord', body); logger.debug('attempting to send upload notification to discord', body);
const res = await fetch(config.discord.url, { const res = await fetch(config.discord.url, {
method: 'POST', method: 'POST',
body, body,
@ -85,7 +85,7 @@ export async function sendUpload(user: User, image: Image, raw_link: string, lin
if (!res.ok) { if (!res.ok) {
const text = await res.text(); const text = await res.text();
logger logger
.error(`Failed to send shorten notification to discord: ${res.status}`) .error(`Failed to send upload notification to discord: ${res.status}`)
.error(`Received response:\n${text}`); .error(`Received response:\n${text}`);
} }