aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
* Incidents tests: write tests for `process_event`Gravatar kwzrd2020-06-18-1/+101
| | | | | | | | This also breaks the helpers import statement into a vertical list, as the amount of imports has grown too much. I still believe that this is a preferred alternative to accessing the helpers via module namespace, as we use them a lot, and the added visual noise would be annoying to read - their names are already descriptive enough.
* Incidents tests: write tests for `make_confirmation_task`Gravatar kwzrd2020-06-13-0/+35
|
* Incidents tests: write tests for `on_message`Gravatar kwzrd2020-06-13-0/+27
|
* Incidents tests: test non-404 error responseGravatar kwzrd2020-06-13-0/+20
|
* Incidents: log error on non-404 responseGravatar kwzrd2020-06-13-2/+3
| | | | | | | | We do not wish to log 404 exceptions as those are expected, however, if something else goes wrong, we shouldn't silence it. This also removes the explicit None return as it only adds syntax noise.
* Incidents tests: write tests for `resolve_message`Gravatar kwzrd2020-06-13-0/+56
|
* Incidents tests: move `mock_404` into module namespaceGravatar kwzrd2020-06-13-5/+6
| | | | This will be useful for others tests as well.
* Incidents tests: write tests for `archive`Gravatar kwzrd2020-06-13-2/+63
|
* Incidents tests: set up base class for `Incidents`Gravatar kwzrd2020-06-13-2/+21
| | | | | | | For cleanliness, I've decided to make a separate class for each method. Since most tests will want to have an `Incident` instance ready, they can inherit the `setUp` from `TestIncidents`, which does not make any assertions on its own.
* Incidents tests: improve mock `Signal` name & move defGravatar kwzrd2020-06-13-6/+6
| | | | | Let's make it clear that this is our own mock. We also move the definition to the top of the module.
* Incidents tests: use our own helper mocksGravatar kwzrd2020-06-13-16/+14
| | | | | No reason to build own MagicMocks as we already have helpers that more accurately mimic the mocked behaviour.
* Incidents tests: write tests for module-level helpersGravatar kwzrd2020-06-12-0/+135
|
* Incidents tests: create new test moduleGravatar kwzrd2020-06-12-0/+0
|
* Merge branch 'origin/master' into kwzrd/incidentsGravatar kwzrd2020-06-12-22/+62
|\
| * Replace mention of Flask with DjangoGravatar Mark2020-06-11-1/+1
| | | | | | | | The site's description still stated that it was built with Flask, which is no longer accurate due to the move to Django.
| * Merge pull request #964 from ks129/bad-words-nickGravatar Joseph Banks2020-06-11-21/+61
| |\ | | | | | | Filtering: Implement bad words detection in nicknames
| | * Merge branch 'master' into bad-words-nickGravatar Joseph Banks2020-06-11-1/+35
| | |\ | | |/ | |/|
| | * Merge branch 'master' into bad-words-nickGravatar ks1292020-06-11-239/+552
| | |\
| | * | Filtering: Add user avatar thumbnail to nickname alert embedGravatar ks1292020-06-11-1/+2
| | | |
| | * | Filtering: Use walrus for better looking of codeGravatar ks1292020-06-11-4/+2
| | | |
| | * | Filtering: Fix nickname filter alert sending spacesGravatar ks1292020-06-11-0/+2
| | | | | | | | | | | | Co-authored-by: Joseph Banks <[email protected]>
| | * | Filtering: Fix some commentsGravatar ks1292020-06-11-2/+2
| | | | | | | | | | | | Co-authored-by: Joseph Banks <[email protected]>
| | * | Remove redis namespace collision testGravatar MarkKoz2020-05-31-10/+0
| | | |
| | * | Remove redis namespace collision preventionGravatar MarkKoz2020-05-31-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | When cogs reload, it would consider their namespace as a conflict with the original namespace. This feature will be removed as a fix until we come up with a better solution.
| | * | Add logging for the bad nickname filterGravatar MarkKoz2020-05-31-0/+2
| | | |
| | * | Fix missing await in bad nickname filterGravatar MarkKoz2020-05-31-18/+17
| | | |
| | * | Filtering: Small fixesGravatar ks1292020-05-31-5/+5
| | | | | | | | | | | | | | | | - Use UTC from timestamp - Rename name bad words checking function
| | * | Filtering: Fix docstringGravatar ks1292020-05-31-1/+1
| | | | | | | | | | | | Co-authored-by: Mark <[email protected]>
| | * | Merge remote-tracking branch 'origin/bad-words-nick' into bad-words-nickGravatar ks1292020-05-31-4/+1
| | |\ \
| | | * | Filtering: Create lock in `__init__`Gravatar ks1292020-05-30-4/+1
| | | | | | | | | | | | | | | Move lock creation from `bad_words_in_name` to `__init__`
| | * | | Filtering: Split name filtering to smaller functionsGravatar ks1292020-05-31-11/+24
| | | | |
| | * | | Filtering: On name filtering, replace Message with Embed as argumentGravatar ks1292020-05-31-7/+7
| | | | |
| | * | | Filtering: Add days between alerts as constantGravatar ks1292020-05-31-1/+3
| | | | |
| | * | | Filtering: Rename `bad_words_in_name` to `check_is_bad_words_in_name`Gravatar ks1292020-05-31-2/+2
| | | | |
| | * | | Filtering: Use POSIX instead ISO format to storage alert cooldownsGravatar ks1292020-05-31-3/+2
| | |/ /
| | * | Filtering: Refactor bad names checkingGravatar ks1292020-05-29-31/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Make `bad_words_in_name` and attach it to current `on_message`. - Implement `asyncio.Lock` to avoid race conditions. - Made that this first check is there matches and when there is, check for alert.
| | * | Filtering: Implement bad words detection in nicknamesGravatar ks1292020-05-29-0/+41
| | | |
* | | | Incidents: extend documentationGravatar kwzrd2020-06-12-11/+49
| | | | | | | | | | | | | | | | | | | | This adds a proper class docstring & small touch-ups to local comments where necessary.
* | | | Incidents: avoid lambda check; make regular functionGravatar kwzrd2020-06-12-5/+5
| | | |
* | | | Incidents: log `event_lock` releaseGravatar kwzrd2020-06-12-0/+1
| | | |
* | | | Incidents: do not process reaction events from botsGravatar kwzrd2020-06-12-2/+3
| | | |
* | | | Incidents: implement `process_event` coroutineGravatar kwzrd2020-06-12-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]>
* | | | Incidents: implement `make_confirmation_task` methodGravatar kwzrd2020-06-12-0/+15
| | | |
* | | | Incidents: implement `archive` methodGravatar kwzrd2020-06-12-1/+39
| | | |
* | | | Incidents: implement reaction listenerGravatar kwzrd2020-06-12-0/+46
| | | | | | | | | | | | | | | | See docstring!
* | | | Incidents: implement `resolve_message`Gravatar kwzrd2020-06-12-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.
* | | | Incidents: make `crawl_incidents` smarterGravatar kwzrd2020-06-12-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!
* | | | Incidents: move `add_signals` to module namespaceGravatar kwzrd2020-06-12-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?
* | | | Incidents: implement `has_signals` helperGravatar kwzrd2020-06-12-0/+6
| | | |
* | | | Incidents: implement `own_reactions` helperGravatar kwzrd2020-06-12-1/+6
| | | |