The idea of persistent roles is used in many servers. Persistent roles are roles that will stay with a member, even after they leave a server and rejoin. This is especially useful if users join a server while they had restricted access to parts of a server.
People usually make or use existing bots to handle this task, using databases to keep track of who left the server with which roles.
Why is this a problem?
A lot of bots are created to handle data for this task, even though I think it can be handled quite simply by Discord's client itself without storing any additional data.
How to solve it?
Persistent roles require keeping track of which users left a server and which roles they had when they left. However, the audit log already keeps track of these changes since it registers every role update event. To make use of persistent roles without using a database, all the Update Member Roles events have to be checked.
If a user joins a server, all these events must be filtered on whether they affected that user. The roles in these events have to be 'aggregated' such that a list of all added and removed roles over time is created. The roles that were added to the user and never removed would need to be added to the user.
Filtering all Update Member Roles events can involve a huge amount of data, especially for large servers. However, the amount of data can be greatly reduced if the audit log events can be filtered on target and would make the solution more feasible.
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.