diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c0f6e818..a22fe2ee2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## Next (WIP) + +- Fixed notices getting created and deleted in a loop. + ## 5.1.0 - Fixed modal composers not passing through the right data. diff --git a/source/library/services/notices/service.ts b/source/library/services/notices/service.ts index 4012c50b3..0473e4057 100644 --- a/source/library/services/notices/service.ts +++ b/source/library/services/notices/service.ts @@ -155,8 +155,13 @@ abstract class NoticeService extends Loca return; } + // If embeds are absent from the update payload (partial update unrelated to embeds), do nothing. + if (message.embeds === undefined) { + return; + } + // If the embed is still present, it wasn't an embed having been deleted. Do not do anything. - if ((message.embeds?.length ?? 0) > 0) { + if (message.embeds.length > 0) { return; } diff --git a/source/library/services/prompts/service.ts b/source/library/services/prompts/service.ts index af6841dac..34e951177 100644 --- a/source/library/services/prompts/service.ts +++ b/source/library/services/prompts/service.ts @@ -286,8 +286,13 @@ abstract class PromptService< return; } + // If embeds are absent from the update payload (partial update unrelated to embeds), do nothing. + if (message.embeds === undefined) { + return; + } + // If the embed is still present, it wasn't an embed having been deleted. Do not do anything. - if (message.embeds?.length === 1) { + if (message.embeds.length === 1) { return; }