aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py (unfollow)
Commit message (Collapse)AuthorLines
2020-06-12Incidents: implement `process_event` coroutineGravatar kwzrd-3/+52
This contains the main logic for handling reactions and glues all the helpers together. Unfortunately, gracefully handling everything that can go wrong in the process requires quite a lot of code ~ but, at least to me, it seems like this all should now be fairly safe. The idea to await the message delete event before releasing the lock was conceived by Ves, while Mark helped me refine it. Co-authored-by: Sebastiaan Zeeff <[email protected]> Co-authored-by: MarkKoz <[email protected]>
2020-06-12Incidents: implement `make_confirmation_task` methodGravatar kwzrd-0/+15
2020-06-12Incidents: implement `archive` methodGravatar kwzrd-1/+39
2020-06-12Incidents: implement reaction listenerGravatar kwzrd-0/+46
See docstring!
2020-06-12Incidents: implement `resolve_message`Gravatar kwzrd-0/+31
See docstring. The exception log is DEBUG level as failure does not necessarily indicate that we have done something wrong. We rely on the API to tell us that the message no longer exists in situations where we have 2 coroutines racing to archive the same message.
2020-06-12Incidents: make `crawl_incidents` smarterGravatar kwzrd-6/+13
The crawler now avoids making API calls for messages which: * Are not incidents * Already have all signals As a result, we can sleep only after making actual calls. This speeds up the task completion considerable, while also making it lighter on the API. Victory!
2020-06-12Incidents: move `add_signals` to module namespaceGravatar kwzrd-16/+16
Looks like we'll need quite a few helpers, and I think it's cleaner to keep them at module level. It helps avoid the question of: what do I do if a staticmethod depends on another staticmethod?
2020-06-12Incidents: implement `has_signals` helperGravatar kwzrd-0/+6
2020-06-12Incidents: implement `own_reactions` helperGravatar kwzrd-1/+6
2020-06-12Incidents: abstract incident checking into a helper methodGravatar kwzrd-24/+14
The code is now basically self-documenting, the docstring is no longer necessary. The ultimate goal is to allow `crawl_incidents` to be more smart about which messages need to be passed to `add_signals`, so that it doesn't need to sleep after each message.
2020-06-12Incidents: add `event_lock` for simple event synchronizationGravatar kwzrd-1/+3
2020-06-12Incidents: only `add_signals` if missingGravatar kwzrd-2/+10
2020-06-12Incidents: make `on_message` ignore pinned messagesGravatar kwzrd-0/+5
This is now necessary as we call the listener ourselves from the crawl task. An already existing, pinned message, can be received.
2020-06-12Incidents: implement & schedule `crawl_incidents` taskGravatar kwzrd-0/+32
See docstring for further information. This will run on start-up to retroactively add missing emoji. Ratelimit-wise this should be fine, as there should never be too many missing emoji.
2020-06-12Incidents: implement `on_message` listener & guardsGravatar kwzrd-3/+20
2020-06-12Incidents: implement `add_signals` helperGravatar kwzrd-2/+6
Looks like it can be static, at least for now.
2020-06-12Incidents: define method stubs for message event handlingGravatar kwzrd-0/+10
2020-06-11Incidents: define allowed roles and emojiGravatar kwzrd-1/+5
These serve as whitelists, i.e. any reaction using an emoji not explicitly allowed, or from a user not specifically allowed, will be rejected. Such reactions will be removed by the bot.
2020-06-11Incidents: add #incidents-archive webhook constantGravatar kwzrd-1/+2
2020-06-11Incidents: add #incidents-archive channel constantGravatar kwzrd-0/+2
2020-06-11Add cooldown to Channels in constants.pyGravatar Joseph Banks-0/+1
2020-06-11Add cooldown channel to EXCLUDED_CHANNELS tupleGravatar Joseph Banks-1/+1
2020-06-11Add cooldown channel to config-default.ymlGravatar Joseph Banks-0/+1
2020-06-11Fix trailing whitespace in Action fileGravatar Joseph Banks-1/+1