Kingstar
Kingstar

Reputation: 33

Messages leaderboard issue discord.js

How are you?

I'm coding a Discord bot and I'm making a message leaderboard command, which displays up to 15 members with most messages (quick.db package to store data). Basically, It's alright when I run the code, but when someone who has so much messages and should appear in the leaderboard leave the server, it returns an error when I try to get the members tag and undefined in the message.

Is it possible to hide the user or delete them from the database?

What have I tried to solve the problem?

I tried to read Discord docs. and quick.db package to see if I can delete the user when they leave (using guildMemberRemove event), but what if they get back to the server? ᅠ

Upvotes: 0

Views: 303

Answers (1)

Dreamy Player
Dreamy Player

Reputation: 615

A better way is to delete user(lefted)* data from database once user left the server in guildMemberRemove event

Upvotes: 1

Related Questions