Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support limiting users to one reaction #60

Merged
merged 11 commits into from
Feb 19, 2021
Merged

Conversation

eibex
Copy link
Owner

@eibex eibex commented Feb 16, 2021

Describe the PR changes

  • Adds a new step in the message creation process asking if the message needs to have mutually exclusive roles or not
  • Adds new limit_to_one column to messages table
  • Adds check in on_raw_reaction_add() if a user has already selected a reaction (and the message is marked as unique), if so the reaction is removed, which causes on_raw_reaction_remove() to trigger, leading to the removal of the role

What could be better
Changing the "unique" status with the rl!edit command. The problem here would be iterating through existing reactions and arbitrarily removing all of them but one per user. I just think it's easier for admins to delete the message and recreate it.

Known Issues
If you select multiple reactions really fast all of them will get removed. This is due to the API latency, cannot circumvent this.

Closes #44

@eibex
Copy link
Owner Author

eibex commented Feb 16, 2021

I will merge this next week since I released 2.3.0 a few hours ago, I didn't think this PR would be so quick

@eibex eibex merged commit 89ae735 into master Feb 19, 2021
@eibex eibex deleted the limit-user-to-one-reaction branch February 19, 2021 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to limit users to only select one reaction
3 participants