Games-Gamers / FamBot

FAM
3 stars 0 forks source link

Add limits to experience gain to prevent farming/spamming #7

Open WikiWikiWasp opened 2 years ago

WikiWikiWasp commented 2 years ago

Description

Currently, there are no limitations on how often a member can earn experience. If they wanted, they could spam fam messages or reacts to farm experience.

Discord does put a rate limiter suspension if reacts are done too quickly, but not for message spamming

Need to add limitations to help prevent farming.

Suggestions

Acceptance Criteria

Notes

Doc Links:

mulchbutler commented 2 years ago

The obvious solution is to log each xp gaining activity, and limit based on those numbers. However, we'd have to implement data retention policies to make sure that we don't blow out the storage size.

Another option would be storing just the timestamp for each xp activity type per user. Then for each activity we refer to the timestamp and make sure enough time has passed before rewarding xp.

If we make the cool down times aggressive enough, we can possible avoid daily limits. Or we can add an activity_daily field.

Get the latest timestamp across all activity types.  
If the latest timestamp isn't today, then reset activity_daily to 0 and move on.
If the latest timestamp is today, compare activity_daily to the max. If we're over the limit, return.

Add the incoming xp to activity_daily, user experience, and set the activity timestamp to now