From 9396e97ae551b471b057205b03da5de46c25b605 Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Wed, 31 Jan 2024 23:35:18 +1100 Subject: [PATCH] Attempt to fix regex when updating case --- src/commands/case.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/case.ts b/src/commands/case.ts index 823e6b1..b29734b 100644 --- a/src/commands/case.ts +++ b/src/commands/case.ts @@ -10,7 +10,7 @@ export default class Case { if (channel && channel.type === Discord.ChannelType.GuildText) { const messages = await channel.messages.fetch({limit: 3}); messages.forEach(async message=>{ - if (message?.embeds[0]?.title.match(new RegExp(`Case #${caseId}`))) { + if (message?.embeds[0]?.title && message?.embeds[0]?.title.match(new RegExp(`Case #${caseId}`))) { const findIndex = message?.embeds[0].fields.findIndex(x=>x.name === 'Reason'); await message.edit({embeds: [new client.embed(message.embeds[0]).spliceFields(findIndex, 1, {name: 'Reason', value: `\`${reason}\``})]}); }