-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add support for multi-post messages #45
Add support for multi-post messages #45
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, but we'll need to hold off on merging this until we can reinitialize the db on Jim's instance for a proper deploy
Thank you so much! 😄 |
If you want to drop some commands to run on the production app, then I can run them whenever. |
@allella Thank you! Does the VM already have If not, and if it's running a Debian-based OS, then Opening the SQLite console: sqlite3 path/to/slack-events-bot.db Queries to execute -- Add the new sequence_position column to the messages table.
ALTER TABLE messages ADD sequence_position INTEGER DEFAULT 0 NOT NULL;
-- Backfill sequence_position values for messages created prior to this release.
UPDATE messages SET sequence_position = 0 WHERE sequence_position IS NULL; After those queries are run then these set of changes should be good to deploy! I think watchtower should pick up on them automatically once they are merged. |
Yes, we have SQLite3 installed. It sounds like Olivia said we'd do this in person at the HG Labs event, but I'll double-check in the Slack. |
If this works with you all, I think next week may be an opportune time to deploy this piece. Something that may occur whenever these changes are shipped is that any weeks still in range could have their events posts "chunked", which could cause things to become slightly out of order (a post 2 of 2 being newly placed at the end of the channel). Since next week should be light on events due to Thanksgiving it should make it less jarring. |
I can run the SQLite commands now, or early tomorrow, if that's the pre-requisite for the merge and deployment of the image. |
@allella Thank you! That would be wonderful. Adding the new column will not affect the bot as it stands currently, and we could then merge in these changes maybe Sunday morning? I think if it were merged prior then the second half of the events for the week of the 12th would be reposted. |
@ThorntonMatthewD I've run the two SQL commands above. |
@allella Thank you! I will proceed with the merge. 🙌 |
Fixes #11
Summary
Adds the ability to split events over multiple Slack messages to skirt around Slack's message size restrictions.
chunked_messages2.mp4
Testing
https://events.openupstate.org/api/gtc
on this line of code to the following:http://localhost:5544/events
part_1.json
as the data source:npx json-server --port 5544 --watch part_1.json
part_2.json
this time. Restart your Slack bot.part_2.json
for events that are set to take place this week. Restart the Slack botrm slack-events-bot.db
) or move (mv slack-events-bot.db something-different.db
) your sqlite DB.messages
table with aweek
value that's the datetime of the next week.2messages
table for the next week.1 curl commands for convenience:
2 Query for adding a new message for next week (at the time of posting this):
Deployment Considerations
A new column has been added to the
messages
table. The following query will need to be executed.