From 4ad35f5b57fe69e1a4a608358039ab59838b7b40 Mon Sep 17 00:00:00 2001 From: Anthony Berg Date: Mon, 26 Aug 2024 23:11:30 +0200 Subject: [PATCH] fix(arabot): add type safety to deleting text channels --- src/listeners/verification/leaveVC.ts | 2 +- src/listeners/verification/start.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/listeners/verification/leaveVC.ts b/src/listeners/verification/leaveVC.ts index e1d4084..14cda3a 100644 --- a/src/listeners/verification/leaveVC.ts +++ b/src/listeners/verification/leaveVC.ts @@ -148,7 +148,7 @@ export class VerificationLeaveVCListener extends Listener { listTextChannels.forEach((c) => { const textChannel = c as TextChannel; // Checks if the channel topic has the user's snowflake - if (textChannel.topic!.includes(userSnowflake!)) { + if (textChannel.topic !== null && textChannel.topic.includes(userSnowflake!)) { textChannel.delete(); } }); diff --git a/src/listeners/verification/start.ts b/src/listeners/verification/start.ts index 99e6dc8..ac9da77 100644 --- a/src/listeners/verification/start.ts +++ b/src/listeners/verification/start.ts @@ -80,7 +80,7 @@ export class VerificationReady extends Listener { const textChannel = c as TextChannel; // Checks if the channel topic has the user's snowflake emptyVC.forEach((snowflake) => { - if (textChannel.topic!.includes(snowflake)) { + if (textChannel.topic !== null && textChannel.topic.includes(snowflake)) { textChannel.delete(); } });