bug: Wrong age in Birthday message with {age}
Diyagi opened this issue · 1 comments
Diyagi commented
Describe the bug
So, today is my birthday, and i had configured it on the bot previously, today the message the bot sent had the wrong age in it,
my birthday is 02/03/1998, im now 24 yo, but the message the bot sent was saying that i was 23 yo.
To Reproduce
- Configure your birthday
- Configure a bot message for birthday using {age}
- Wait for your birthday
Expected behavior
When using {age} in the message, i expected that i would be replaced with the new age (in my case, 24, not 23).
Screenshots
Additional context
Since i had free time, i decided to explore the code, after understanding how getAge function works, I then went to the tasks, and saw this:
// tasks/birthday.ts Lines 96-102
if (canSendMessages(channel)) {
await channel.send({
content: this.transformMessage(content, member.user, getAge(data), t),
allowedMentions: { users: [member.id] }
});
}
Sorry if im wrong, but shouldn't getAge(data)
be add +1 ? since it will return the old age if the day and month are the same.