fix(arabot): add type safety to deleting text channels

This commit is contained in:
Anthony Berg 2024-08-26 23:11:30 +02:00
parent 1c9f6612a3
commit 4ad35f5b57
2 changed files with 2 additions and 2 deletions

View File

@ -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();
}
});

View File

@ -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();
}
});