mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-18 00:31:00 -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) {
|
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