aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
* Incidents: revert latest 2 commitsGravatar kwzrd2020-06-30-75/+10
| | | | | | | | | | Decision was made to use embeds to archive incidents instead of webhooking the raw message. As such, we're reverting the branch to a state from which the adjustments will be easier to make. Reverted commits: * a8d179d9b04f54b20c5e870bcfa85c78c42c8dca * 6fa8caed037b247a7c194f58a4635de7dae21fd2
* Incidents: append `actioned_by` to webhook usernameGravatar kwzrd2020-06-21-10/+22
| | | | | | | Incident author and the moderator who actioned report are now passed through `make_username` to create the webhook username. Tests adjusted as appropriate.
* Incidents: implement `make_username` helperGravatar kwzrd2020-06-21-0/+53
| | | | | | | | | | | | | | | The justification is to incorporate the `actioned_by` name into the username in some way, and so the logical thing to do is to abstract this process into a helper so that it can easily be adjusted in the future. For now, I've chosen to separate the names by a pipe. Discord webhook username cannot exceed 80 characters in length, and so we cap it at this length by default. This is seen as more of an edge-case, but it should be accounted for, as we're not joining two names. The `max_length` param is configurable primarily for testing purposes, it probably should never be passed explicitly. This commit also provides two tests for the function.
* Incidents tests: assert webhook username is de-clydedGravatar kwzrd2020-06-20-0/+19
| | | | See: a8b4e394d9da57287cd9497cd9bb0a97fa467e84
* Incidents: de-clyde archive webhook usernameGravatar kwzrd2020-06-20-1/+2
| | | | | | | With PR #1009 merged, we now apply the same fix to our relay function. This prevents the "clyde" word from sneaking into the webhook username, which is forbidden and will return a 400.
* Merge branch 'origin/master' into kwzrd/incidentsGravatar kwzrd2020-06-20-24/+105
|\ | | | | | | Adds the `sub_clyde` function, which we'll apply to our webhook.
| * Merge pull request #1009 from python-discord/bug/mod/bot-2a/webhook-clydeGravatar kwzrd2020-06-20-8/+57
| |\ | | | | | | Fix 400 when "clyde" is in any webhook username
| | * Merge branch 'master' into bug/mod/bot-2a/webhook-clydeGravatar kwzrd2020-06-20-100/+285
| | |\ | | |/ | |/|
| * | Merge pull request #1015 from python-discord/kwzrd/pipenv-html-scriptGravatar Mark2020-06-19-0/+1
| |\ \ | | | | | | | | Add Pipenv script for html coverage report
| | * | Pipenv: add script for html coverage reportGravatar kwzrd2020-06-19-0/+1
| | | | | | | | | | | | | | | | | | | | Similarly to the `report` script, this removes the need to invoke coverage when generating the html report.
| * | | Merge pull request #1003 from ↵Gravatar Dennis Pham2020-06-19-16/+47
| |\ \ \ | | |/ / | |/| | | | | | | | | | python-discord/bug/filters/bot-58/removers-ignore-dms Ignore DMs in token and webhook removers
| | * | Merge branch 'master' into bug/filters/bot-58/removers-ignore-dmsGravatar Dennis Pham2020-06-19-85/+238
| | |\ \ | | |/ / | |/| |
| | * | Webhook remover: exit early if message already deletedGravatar MarkKoz2020-06-15-2/+8
| | | |
| | * | Webhook remover: ignore DMs and bot messagesGravatar MarkKoz2020-06-15-0/+4
| | | | | | | | | | | | | | | | Can't remove messages in DMs, so don't bother trying.
| | * | Token remover: exit early if message already deletedGravatar MarkKoz2020-06-15-3/+22
| | | |
| | * | Token remover: move bot check to on_messageGravatar MarkKoz2020-06-15-21/+10
| | | | | | | | | | | | | | | | | | | | It just makes more sense to me to filter out messages at an earlier stage.
| | * | Token remover: ignore DMsGravatar MarkKoz2020-06-15-0/+13
| | | | | | | | | | | | | | | | | | | | It's a private channel so there's no risk of a token "leaking". Furthermore, messages cannot be deleted in DMs.
| | | * Write unit test for `sub_clyde`Gravatar kwzrd2020-06-20-0/+27
| | | |
| | | * Preserve empty string when substituting clydeGravatar MarkKoz2020-06-19-0/+2
| | | |
| | | * Make sub_clyde case-sensitive and use Cyrillic e'sGravatar MarkKoz2020-06-17-2/+6
| | | | | | | | | | | | | | | | | | | | The Cyrillic characters are more likely to be rendered similarly to their Latin counterparts than the math sans-serif characters.
| | | * Fix 400 when "clyde" is in webhook usernameGravatar MarkKoz2020-06-15-8/+24
| | | | | | | | | | | | | | | | Discord just disallows this name.
* | | | Incidents tests: remove unnecessary patchGravatar kwzrd2020-06-20-1/+0
| | | | | | | | | | | | | | | | This is already being patched at class-level.
* | | | Incidents: try-except Signal creationGravatar kwzrd2020-06-20-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suggested by Mark during review. This follows the "ask for forgiveness rather than permission" paradigm, ends up being less code to read, and may be seen as more logical / safer. The `ALLOWED_EMOJI` set was renamed to `ALL_SIGNALS` as this now better communicates the set's purpose. Tests adjusted as appropriate. Co-authored-by: MarkKoz <[email protected]>
* | | | Incidents: simplify set operation in `has_signals`Gravatar kwzrd2020-06-20-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using `issubset` is a much simpler & more readable way of expressing the relationship between the two sets. Suggested by Mark during review. Co-authored-by: MarkKoz <[email protected]>
* | | | Incidents: make crawl limit & sleep module-level constantsGravatar kwzrd2020-06-20-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Requested during review. Co-authored-by: ks129 <[email protected]> Co-authored-by: Joseph Banks <[email protected]>
* | | | Incidents: make logs contain the message id they pertain toGravatar kwzrd2020-06-20-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | Suggested by Mark during review. Co-authored-by: MarkKoz <[email protected]>
* | | | Incidents: remove redundant `exc_info` passingGravatar kwzrd2020-06-20-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pointed out by Mark during review that this is unnecessary, as logging using `exception` automatically appends the `exc_info` of the handled exception when done in an except block. Co-authored-by: MarkKoz <[email protected]>
* | | | Incidents: reduce excessive whitespaceGravatar kwzrd2020-06-19-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is way too spacious for how little is happening here. Suggested by ks129. Co-authored-by: ks129 <[email protected]>
* | | | Incidents: annotate possible None typeGravatar kwzrd2020-06-19-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Caught during review by ks129. Co-authored-by: ks129 <[email protected]>
* | | | Incidents: remove broad noqaGravatar kwzrd2020-06-19-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was originally in place to silence a PyCharm warning regarding accessing the private attributes. However, since there is no corresponding error code to specify, the noqa will silence any linter warning, which is potentially dangerous, and seems to be bad practice.
* | | | Incidents: review log levels; use `trace` where appropriateGravatar kwzrd2020-06-19-19/+19
| | | | | | | | | | | | | | | | | | | | Logs useful when observing the internals but too verbose for DEBUG are reduced to TRACE.
* | | | Incidents tests: write tests for `on_raw_reaction_add`Gravatar kwzrd2020-06-19-0/+128
| | | |
* | | | Incidents tests: write tests for `crawl_incidents`Gravatar kwzrd2020-06-19-0/+58
| | | |
* | | | Incidents tests: add helper for mocking async for-loopsGravatar kwzrd2020-06-19-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | See the docstring. This does not make the ambition to be powerful enough to be included in `tests.helpers`, and is only intended for local purposes.
* | | | Merge branch 'origin/master' into kwzrd/incidentsGravatar kwzrd2020-06-19-251/+643
|\| | |
| * | | Merge pull request #892 from Akarys42/#364-offensive-msg-autodeletionGravatar Joseph Banks2020-06-17-9/+80
| |\ \ \ | | | | | | | | | | #364 offensive msg autodeletion
| | * | | Update deletion scheduler to use latest watchlist configurationGravatar Joseph Banks2020-06-17-17/+5
| | | | |
| | * | | Merge branch 'master' into #364-offensive-msg-autodeletionGravatar Joseph Banks2020-06-17-2517/+7259
| | |\ \ \ | | |/ / / | |/| | |
| * | | | Merge pull request #991 from crazygmr101/feature/cooldown-tagGravatar Mark2020-06-17-0/+20
| |\ \ \ \ | | | | | | | | | | | | Create cooldown.md
| | * | | | Update bot/resources/tags/customcooldown.mdGravatar Daniel Nash2020-06-15-3/+1
| | | | | | | | | | | | | | | | | | Co-authored-by: Mark <[email protected]>
| | * | | | Merge branch 'master' into feature/cooldown-tagGravatar Joseph Banks2020-06-12-76/+179
| | |\ \ \ \
| | * | | | | Add scheme to URLGravatar Daniel Nash2020-06-12-1/+1
| | | | | | |
| | * | | | | Update customcooldown.mdGravatar Daniel Nash2020-06-12-0/+2
| | | | | | |
| | * | | | | Make title more specificGravatar Daniel Nash2020-06-12-1/+1
| | | | | | | | | | | | | | | | | | | | | Co-authored-by: Mark <[email protected]>
| | * | | | | Update bot/resources/tags/customcooldown.mdGravatar Daniel Nash2020-06-10-3/+1
| | | | | | | | | | | | | | | | | | | | | Co-authored-by: Joseph Banks <[email protected]>
| | * | | | | change _cd to message_cooldown Gravatar Daniel Nash2020-06-10-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apply suggestions from code review Co-authored-by: Joseph Banks <[email protected]>
| | * | | | | Move the not rate-limited message into elseGravatar Daniel Nash2020-06-10-1/+3
| | | | | | |
| | * | | | | Update example to not be in a cogGravatar Daniel Nash2020-06-10-12/+10
| | | | | | |
| | * | | | | Rename to customcooldown.mdGravatar Daniel Nash2020-06-10-0/+0
| | | | | | |
| | * | | | | Update cooldown.mdGravatar Daniel Nash2020-06-07-1/+1
| | | | | | |