gib-potato icon indicating copy to clipboard operation
gib-potato copied to clipboard

Potato backfill command

Open untitaker opened this issue 2 years ago • 3 comments

When I receive potatoes in a channel, I realize too late that GibPotato isn't invited in the channel yet.

Idea: When GibPotato is invited, it fetches msgs from the past (up to a point, 24h should be more than enough) and backfills potatoes. Preferrably skipping (or batching) all the notifications that generates.

untitaker avatar Jun 21 '23 07:06 untitaker

Not a terrible idea, as this is something I also encountered quite often 😅

A few things we would need to consider when implementing this:

  • Currently, we do not store the message content anywhere. To make this feature work, we could think about hashing the raw message string and adding it to a new messages table column. Otherwise, we would not know which messages we have already processed. There might be some edge cases with edited messages, not a big one in the case of Sentry's Slack (You can edit a message up to 5 minutes after posting) but maybe for others.
  • From a Slack API perspective, this would require one API call only, as far as I can tell, so this solves some concerns about getting rate-limited https://api.slack.com/methods/conversations.history

cleptric avatar Jun 21 '23 08:06 cleptric

Otherwise, we would not know which messages we have already processed.

do we store all messages from slack regardless of whether they have a reaction? that's a really large table!

we could store a timestamp per-channel of the last message we processed, that should be enough to deduplicate when the bot leaves and joins repeatedly

untitaker avatar Jun 21 '23 10:06 untitaker

No, we only create a message record if the message was sampled by potal. So it either needs to contain a 🥔 or a 🥔 reaction was added.

cleptric avatar Jun 21 '23 10:06 cleptric