mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 20:30:58 -05:00
Attempt to fix regex when updating case
This commit is contained in:
parent
e8cc309b9e
commit
9396e97ae5
@ -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}\``})]});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user