klothoplatform / slack-notifier

Slack notification bot
MIT License
3 stars 0 forks source link

ignore channel join/removes we've already seen #30

Closed ghost closed 2 years ago

ghost commented 2 years ago

Slack sometimes resends old messages. This can cause the bot to think it's not in a channel, when it is:

  1. bot leaves the channel; this triggers notification left-1, which we process
  2. bot rejoins channel; this triggers notification joined-2, which we process
  3. slack re-sends left-1; we process this, and think we've left the room

To solve this, we now record the timestamp for each join/leave message, on a per-channel basis. If we see an event with a lower timestamp than the recorded one, we ignore it.