aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
| * | | | | | | | | | Merge 'master' into 'kwzrd/incidents'; resolve config conflictsGravatar kwzrd2020-07-16-351/+626
| |\ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add upstream changes & resolve config conflicts introduced by #1041. In the conflicting parts of the diff, this commit also re-sorts constants which were added upstream to lexicographical order. This does **not** re-sort all constants added upstream.
* | | | | | | | | | | Merge pull request #1046 from ItsCinnabar/patch-1Gravatar Sebastiaan Zeeff2020-07-16-1/+1
|\ \ \ \ \ \ \ \ \ \ \ | |_|_|/ / / / / / / / |/| | | | | | | | | | Update or-gotcha.md
| * | | | | | | | | | Merge branch 'master' into patch-1Gravatar Sebastiaan Zeeff2020-07-16-1/+8
| |\ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / / |/| | | | | | | | | |
* | | | | | | | | | | Merge pull request #1045 from python-discord/bug/980/fuzzy-processingGravatar Dennis Pham2020-07-15-1/+8
|\ \ \ \ \ \ \ \ \ \ \ | |_|_|/ / / / / / / / |/| | | | | | | | | | Invoke fuzzywuzzy's processor before matching
| * | | | | | | | | | Merge branch 'master' into bug/980/fuzzy-processingGravatar Dennis Pham2020-07-15-177/+427
| |\ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / / |/| | | | | | | | | |
| * | | | | | | | | | Pass processed string to `extractBests`Gravatar kosayoda2020-07-15-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes a regression where the string to be matched was not processed beforehand.
| * | | | | | | | | | Invoke fuzzywuzzy's processor before matchingGravatar kosayoda2020-07-14-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trying to match a string with only non-alphanumeric characters results in a warning by fuzzywuzzy. Processing the string before matching lets us avoid the warning, which which uses the root logger and thus isn't supressible.
| | * | | | | | | | | Merge branch 'master' into patch-1Gravatar Dennis Pham2020-07-15-175/+425
| | |\ \ \ \ \ \ \ \ \ | |_|/ / / / / / / / / |/| | | | | | | | | |
* | | | | | | | | | | Merge pull request #1054 from python-discord/dm_relayGravatar Leon Sandøy2020-07-15-6/+43
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | DM relay - minor fixes
| * \ \ \ \ \ \ \ \ \ \ Merge branch 'master' into dm_relayGravatar Leon Sandøy2020-07-15-70/+202
| |\ \ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / / / |/| | | | | | | | | | |
| * | | | | | | | | | | Oops, these prints shouldn't be here.Gravatar Leon Sandøy2020-07-15-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/python-discord/bot/issues/1041
| * | | | | | | | | | | How did that except except block get in?Gravatar Leon Sandøy2020-07-15-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Weird. https://github.com/python-discord/bot/issues/1041
| * | | | | | | | | | | Create a UserMentionOrID converter.Gravatar Leon Sandøy2020-07-15-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we're using the !reply command, using a regular UserConverter is somewhat problematic. For example, if I wanted to send the message "lemon loves you", then I'd try to write `!reply lemon loves you` - however, the optional User converter would then try to convert `lemon` into a User, which it would successfully do since there's like 60 lemons on our server. As a result, the message "loves you" would be sent to a user called lemon.. god knows which one. To solve this bit of ambiguity, I introduce a new converter which only converts user mentions or user IDs into User, not strings that may be intended as part of the message you are sending. https://github.com/python-discord/bot/issues/1041
| * | | | | | | | | | | Ves' refactorGravatar Leon Sandøy2020-07-15-15/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Sebastiaan Zeeff <[email protected]>
| * | | | | | | | | | | Add some stats for DMs sent and received.Gravatar Leon Sandøy2020-07-15-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/python-discord/bot/issues/1041
| * | | | | | | | | | | Add the user ID to the username in dm relays.Gravatar Leon Sandøy2020-07-15-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without this, it is difficult to know precisely who the user that is DMing us is, which might be useful to us. https://github.com/python-discord/bot/issues/1041
| * | | | | | | | | | | Restore DM user caching.Gravatar Leon Sandøy2020-07-15-6/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 042f472a
| | | * | | | | | | | | Update bot/resources/tags/or-gotcha.mdGravatar ItsCinnabar2020-07-14-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Sebastiaan Zeeff <[email protected]>
| | | * | | | | | | | | Update or-gotcha.mdGravatar ItsCinnabar2020-07-14-1/+0
| | | | | | | | | | | |
| | | * | | | | | | | | Update or-gotcha.mdGravatar ItsCinnabar2020-07-14-1/+1
| | | | | | | | | | | |
| | | * | | | | | | | | Update or-gotcha.mdGravatar ItsCinnabar2020-07-14-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adjust description and include link to docs
| | | | * | | | | | | | Incidents: reduce log level of 404 exceptionGravatar kwzrd2020-07-16-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| | | | * | | | | | | | Incidents: link `proxy_url` if attachment fails to downloadGravatar kwzrd2020-07-14-50/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suggested by Mark during review. If the download fails, we fallback on showing an informative message, which will link the attachment cdn link. The attachment-handling logic was moved from the `archive` coroutine into `make_embed`, which now also returns the file, if available. In the end, this appears to be the smoothest approach. Co-authored-by: MarkKoz <[email protected]>
| | | | * | | | | | | | Incidents: add `download_file` helper & testsGravatar kwzrd2020-07-13-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| | | | * | | | | | | | Merge d.py version bump from master branchGravatar kwzrd2020-07-10-3/+3
| | | | |\ \ \ \ \ \ \ \
| | | | * | | | | | | | | Config: refactor #incidents constants to lexicographical sortingGravatar kwzrd2020-07-09-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| | | | * | | | | | | | | Incidents tests: improve in-line comment wordingGravatar kwzrd2020-07-09-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| | | | * | | | | | | | | Incidents: use `moderation_roles` constantGravatar kwzrd2020-07-09-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Better than building the set manually. Tested against regression by comparing the two sets for equality. Suggested by vivax. Co-authored-by: vivax3794 <[email protected]>
| | | | * | | | | | | | | Merge 'master' into 'kwzrd/incidents'; resolve mod pkg init conflictGravatar kwzrd2020-07-08-217/+672
| | | | |\ \ \ \ \ \ \ \ \
| | | | * | | | | | | | | | Incidents: archive incident attachmentsGravatar kwzrd2020-07-03-1/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no handling of file types as explained in the `archive` docstring. Testing indicates that relaying incidents with e.g. a text file attachment is simply a noop in the Discord GUI. If there is at least one attachment, we always only relay the one at index 0, as it is believed the user-sent messages can only contain one attachment at maximum. This also adds an extra test asserting the behaviour when an incident with an attachment is archived. The existing test for `archive` is adjusted to assume no attachments. Joe helped me conceive & test this. Co-authored-by: Joseph Banks <[email protected]>
| | | | * | | | | | | | | | Incidents: trace-level log incident embed creationGravatar kwzrd2020-07-02-0/+2
| | | | | | | | | | | | | |
| | | | * | | | | | | | | | Incidents: relay incidents as embeds rather than raw contentGravatar kwzrd2020-07-01-37/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This applies the previously defined `make_embed` function. As the `archive` function is now simpler, I decided to reduce the amount of whitespace ~ it's a lot more compact now. Tests are adjusted as appropriate.
| | | | * | | | | | | | | | Incidents: implement `make_embed` helper & testsGravatar kwzrd2020-07-01-1/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See `make_embed` docstring for further information. The tests are fairly loose and should be easily adjustable in the future should changes be made.
| | | | * | | | | | | | | | Incidents: pass `actioned_by` to `archive`Gravatar kwzrd2020-06-30-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an important piece of information that shall be relayed.
| | | | * | | | | | | | | | 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.
| | | | * | | | | | | | | | | 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.