From 3a5883b728a021fa1ecc6286e0e8e3716b2f737c Mon Sep 17 00:00:00 2001 From: Derock Date: Sun, 19 Jun 2022 12:51:06 -0400 Subject: [PATCH] fix: check if isThread exists (fixed #41) --- src/exporthtml.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/exporthtml.ts b/src/exporthtml.ts index 356afbe..eb33755 100644 --- a/src/exporthtml.ts +++ b/src/exporthtml.ts @@ -43,8 +43,13 @@ async function generateTranscript( if( (isDJSv14 ? channelTemp.type === 1 // djs v14 uses 1 for dm - : channelTemp.type === "DM") - || inputChannel.isThread() + : channelTemp.type === "DM" + ) + || + ( + typeof inputChannel.isThread === "function" + && inputChannel.isThread() + ) ) throw new Error("Cannot operate on DM channels or thread channels"); const channel = inputChannel as (discordv13.NewsChannel | discordv13.TextChannel); @@ -158,7 +163,6 @@ async function generateTranscript( // message content if(message.content) { - console.log(message.content, validateURL(message.content)); if (validateURL(message.content)) { var link = document.createElement('a'); link.classList.add('chatlog__content');