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

Reaction Roles: Hardcode #16

Open
p5quared opened this issue Mar 17, 2023 · 3 comments
Open

Reaction Roles: Hardcode #16

p5quared opened this issue Mar 17, 2023 · 3 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@p5quared
Copy link
Owner

I set up the reaction manager function to read reaction role info from a file, but I think this is honestly a little bit overkill for our purposes. It makes sense for scalability (we could implement feature to create an infinite number of roles), but I'm afraid this system might confuse people and make changing or adding roles ironically more difficult.

I would like to change the reaction role command to have each role hardcoded in. i.e. each role is a separate function/path within $rm.

@p5quared p5quared added help wanted Extra attention is needed good first issue Good for newcomers labels Mar 17, 2023
@sayeedkhannabil
Copy link

Hi. I am interested in helping on this task. If you can provide me some additional information like what is the name of the function, how do you want me to change it, also the what would be role's names that I would have to hardcode.

@p5quared
Copy link
Owner Author

Hi! Sorry for not seeing this earlier but I appreciate your interest!

My goal for any of these is to get you going with as little assistance as possible so here's some hints to point you in the right direction:

  1. The role/react manager function is the one I mentioned is invoked with "$rm". You can find it by searching through the code (use a search like ctrl + f or cmd + f, don't try scrolling around for it as this will definitely not work for larger projects).
  2. Read through the function slowly to get a feel for what is going on, but basically right now it reads some information from a file, sends a special message, and then updates that file with some new information (a message id).
  3. I would like to stop reading/writing to a file if possible, because I think this solution is a little bit hacky/not really clean. There are many different possible solutions, most will probably use parts or combinations of these key ideas:
  • Just making a python dictionary to store the role reacts.
  • Saving react-message ID's to a new SQLite table (see how the attendance feature works).

The reason we must save the ID's somewhere 'permanent' is because if the bot restarts/we redeploy a new version, we want to 'remember' which messages are special 'role-react' messages.

There are other workarounds to avoid needing to save the ID's in the code however I can't think of any that do not come at the cost of complicating deployment.

@p5quared
Copy link
Owner Author

Keep most discussion on topics here in the Github issue, but feel free to notify me on Discord in the collaborate channel when you have updates or if you have quick questions (a lot of the time I miss notifications here). I can also meet for brief meetings ~15 minutes here and there basically any day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants