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

Save pronoun messages #272

Merged
merged 3 commits into from
Aug 4, 2024
Merged

Conversation

daniel-panhead
Copy link
Contributor

@daniel-panhead daniel-panhead commented Jul 28, 2024

TL;DR

Reactions to pronoun messages now work after restarting the bot

Description

When the /pronoun command is run, it now saves a copy of the message ID and channel ID to Firebase under the InitBotInfo > [server ID] > SavedMessages -> pronouns document. When the bot is restarted, it will check for this document, and if there is an existing message/channel saved, it will use those to start emoji reaction listeners, allowing the old message to continue to be used for pronoun role reactions.

In addition, the bot startup was also changed so that each server is initialized sequentially instead of in parallel. This just makes the debug messages less confusing since they're not being logged asynchronously.

Why

If the bot crashes, we will lose emoji reaction listeners on messages that have already been sent. This change will allow us to more easily recover from bot crashes.

User Changes

None :D

Tests Done

Tested restarting the bot and adding/removing reaction emojis, then verifying that roles are added/removed correspondingly

Breaking Changes

None - if no existing saved message is found, the bot just continues as normal

@daniel-panhead daniel-panhead requested review from byronwang93 and DonaldKLee and removed request for byronwang93 July 28, 2024 01:41
@byronwang93
Copy link
Contributor

hmm not sure if you ran into this but when I run /pronouns I get this message

the steps I'm doing is running /init-bot and using this for the roles.json file:

[
{
"name": "hacker",
"roleId": "1192271647634374748"
},
{
"name": "sponsor",
"roleId": "1192271647634374752"
},
{
"name": "mentor",
"roleId": "1192271647634374750"
},
{
"name": "volunteer",
"roleId": "1212287630893387784"
},
{
"name": "photographer",
"roleId": "1212287630893387783"
}
]

Screen Shot 2024-07-29 at 2 45 42 PM

@daniel-panhead
Copy link
Contributor Author

hmm not sure if you ran into this but when I run /pronouns I get this message

the steps I'm doing is running /init-bot and using this for the roles.json file:

[ { "name": "hacker", "roleId": "1192271647634374748" }, { "name": "sponsor", "roleId": "1192271647634374752" }, { "name": "mentor", "roleId": "1192271647634374750" }, { "name": "volunteer", "roleId": "1212287630893387784" }, { "name": "photographer", "roleId": "1212287630893387783" } ]
Screen Shot 2024-07-29 at 2 45 42 PM

That's really weird - this would only happen if the server didn't have the roles that perfectly matched all four pronoun strings she/her, he/him, they/them, and other pronouns. I didn't run into this issue

@byronwang93
Copy link
Contributor

Ay ya that fixed it I needed to go into the server and manually create the new roles ^^

I also just committed some code in your PR to change up pronouns.js to create the roles if they don't already exist in the server, if you think this change is good feel free to merge your PR!

@daniel-panhead
Copy link
Contributor Author

Nice!!

@daniel-panhead daniel-panhead merged commit 99ed057 into hc2023-updates Aug 4, 2024
@daniel-panhead daniel-panhead deleted the daniel/save-pronoun-messages branch August 4, 2024 16:05
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.

2 participants