From 70764bb26be395a99a8d7e81f9d1449637085498 Mon Sep 17 00:00:00 2001 From: William Harrison Date: Thu, 29 Aug 2024 08:21:00 +0800 Subject: [PATCH] fix some stuff --- src/commands/reminders/remindme.ts | 4 ++-- src/events/client/ready.ts | 4 ++-- src/util/setReminder.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/commands/reminders/remindme.ts b/src/commands/reminders/remindme.ts index bd6838a..c5301cb 100644 --- a/src/commands/reminders/remindme.ts +++ b/src/commands/reminders/remindme.ts @@ -103,7 +103,7 @@ const command: Command = { const reminder = await new Reminder({ reminder_id: id, user: interaction.user.id, - channel: interaction.channel.id, + channel: interaction.channel.id ? interaction.channel.id : null, set: Date.now(), due: Date.now() + time, delay: time, @@ -127,7 +127,7 @@ const command: Command = { .setTimestamp() - if(sendInChannel) { + if(sendInChannel && interaction.channel.id) { try { const channel = client.channels.cache.get(interaction.channel.id) as TextChannel; diff --git a/src/events/client/ready.ts b/src/events/client/ready.ts index c3d70b3..6070107 100644 --- a/src/events/client/ready.ts +++ b/src/events/client/ready.ts @@ -50,7 +50,7 @@ const event: Event = { .setFooter({ text: `ID: ${reminder.reminder_id}` }) .setTimestamp() - if(reminder?.send_in_channel) { + if(reminder?.send_in_channel && reminder?.channel) { try { const channel = client.channels.cache.get(reminder.channel) as Discord.TextChannel; @@ -71,7 +71,7 @@ const event: Event = { await user.send({ embeds: [embed] }); } catch { try { - const channel = client.channels.cache.get(reminder.channel) as Discord.TextChannel; + const channel = client.channels.cache.get(reminder?.channel) as Discord.TextChannel; if(!channel) return; diff --git a/src/util/setReminder.ts b/src/util/setReminder.ts index 3d05875..7b45719 100644 --- a/src/util/setReminder.ts +++ b/src/util/setReminder.ts @@ -20,7 +20,7 @@ export default async function (reminder: any, client: ExtendedClient): Promise