mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 08:20:58 -05:00
Attempt to fix regex when updating case
This commit is contained in:
parent
1a09781bcc
commit
baa5d9406a
@ -10,7 +10,7 @@ export default class Case {
|
|||||||
if (channel && channel.type === Discord.ChannelType.GuildText) {
|
if (channel && channel.type === Discord.ChannelType.GuildText) {
|
||||||
const messages = await channel.messages.fetch({limit: 3});
|
const messages = await channel.messages.fetch({limit: 3});
|
||||||
messages.forEach(async message=>{
|
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');
|
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}\``})]});
|
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