mirror of
https://github.com/xHyroM/bun-discord-bot.git
synced 2024-11-22 06:31:06 +01:00
fix: return if remap is null
This commit is contained in:
parent
e5bcf61676
commit
dbf7fcdd87
2 changed files with 3 additions and 1 deletions
|
@ -124,6 +124,7 @@ async function handleBunReportLink(message: Message): Promise<void> {
|
||||||
if (!match?.[0]) return;
|
if (!match?.[0]) return;
|
||||||
|
|
||||||
const data = await getBunReportDetailsInMarkdown(match[0]);
|
const data = await getBunReportDetailsInMarkdown(match[0]);
|
||||||
|
if (!data) return;
|
||||||
|
|
||||||
// @ts-expect-error allowed_mentions
|
// @ts-expect-error allowed_mentions
|
||||||
message.reply({
|
message.reply({
|
||||||
|
|
|
@ -52,8 +52,9 @@ export function sliceIfStartsWith(input: string, startsWith: string) {
|
||||||
|
|
||||||
export async function getBunReportDetailsInMarkdown(
|
export async function getBunReportDetailsInMarkdown(
|
||||||
url: string
|
url: string
|
||||||
): Promise<string> {
|
): Promise<string | undefined> {
|
||||||
const remap = await parseAndRemap(url);
|
const remap = await parseAndRemap(url);
|
||||||
|
if (!remap) return;
|
||||||
if (!Array.isArray(remap.features)) remap.features = []; // temporary fix
|
if (!Array.isArray(remap.features)) remap.features = []; // temporary fix
|
||||||
|
|
||||||
let content = formatMarkdown(remap, {
|
let content = formatMarkdown(remap, {
|
||||||
|
|
Loading…
Reference in a new issue