From 2c530c9c31ef5dc3b62c216114e67a317ea211cf Mon Sep 17 00:00:00 2001 From: yogurtsyum <28582329+yogurtsyum@users.noreply.github.com> Date: Tue, 8 Aug 2023 17:06:10 -0500 Subject: [PATCH] Fix member count milestone triggering with decreasing value --- src/events/member.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/events/member.ts b/src/events/member.ts index 43c4457d..3db7c90d 100644 --- a/src/events/member.ts +++ b/src/events/member.ts @@ -19,13 +19,18 @@ const recordMemberCount = async () => { if(group.memberCount === lastMemberCount) return; if(config.memberCount.milestone) { - if((group.memberCount % config.memberCount.milestone === 0) || (lastRemainder > (group.memberCount % config.memberCount.milestone))) { + const currentRemainder = group.memberCount % config.memberCount.milestone; + if (lastMemberCount < group.memberCount && (currentRemainder === 0 || lastRemainder > currentRemainder)) { memberCountChannel.send({ embeds: [ getMemberCountMilestoneEmbed(group.memberCount) ] }); } else { - if(!config.memberCount.onlyMilestones) { + if (!config.memberCount.onlyMilestones) { memberCountChannel.send({ content: getMemberCountMessage(lastMemberCount, group.memberCount) }); } } + + lastRemainder = currentRemainder; + } else { + memberCountChannel.send({ content: getMemberCountMessage(lastMemberCount, group.memberCount) }); } lastMemberCount = group.memberCount;