Skip to content

Commit

Permalink
Fix special roles not being assigned
Browse files Browse the repository at this point in the history
  • Loading branch information
Delemangi committed Dec 18, 2023
1 parent ff1348e commit fe7c01b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/utils/experience.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,19 @@ export const addExperience = async (message: Message) => {
currentLevel.experience = BigInt(currentLevel.experience) + experience;
const level = getLevelFromExperience(currentLevel.experience);

await updateExperience(currentLevel);

if (level !== currentLevel.level) {
currentLevel.level = level;

await updateExperience(currentLevel);

if (message.member === null) {
return;
}

await awardMember(message.member, level);

const channel = getChannel('activity');
await channel?.send({
allowedMentions: {
Expand All @@ -130,14 +140,6 @@ export const addExperience = async (message: Message) => {
currentLevel.level,
),
});

if (message.member === null) {
return;
}

await awardMember(message.member, currentLevel.level);
}

await updateExperience(currentLevel);
});
};

0 comments on commit fe7c01b

Please sign in to comment.