| Commit message (Collapse) | Author | Age | Lines |
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
See `make_embed` docstring for further information.
The tests are fairly loose and should be easily adjustable in
the future should changes be made.
|
| |
|
|
| |
This is an important piece of information that shall be relayed.
|
| |
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
| |
Incident author and the moderator who actioned report are now passed
through `make_username` to create the webhook username.
Tests adjusted as appropriate.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
See: a8b4e394d9da57287cd9497cd9bb0a97fa467e84
|
| |\
| |
| |
| | |
Adds the `sub_clyde` function, which we'll apply to our webhook.
|
| | |\ |
|
| | | |\ |
|
| | | | | |
|
| | | | |
| | | |
| | | |
| | | |
| | | | |
It just makes more sense to me to filter out messages at an earlier
stage.
|
| | | | |
| | | |
| | | |
| | | |
| | | | |
It's a private channel so there's no risk of a token "leaking".
Furthermore, messages cannot be deleted in DMs.
|
| | |/ / |
|
| | | |
| | |
| | |
| | | |
This is already being patched at class-level.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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]>
|
| | | | |
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| |\ \ \
| | |/
| |/| |
|
| | |\| |
|
| | | |\
| | | |
| | | | |
Make token detection more robust and completely rewrite its tests
|
| | | | |\
| | | | |
| | | | |
| | | | | |
bug/filters/928/non-ascii-token
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
It's redundant; there's no benefit here in abstracting two lines of code
into a function.
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This covers the case when a token is matched, but its user ID and
timestamp turn out to be invalid.
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
It now supports the changes that switched to finditer, added match
groups, and added the Token NamedTuple. It also accounts for the
is_maybe_token function being removed.
For the sake of simplicity, call assertions on is_valid_user_id and
is_valid_timestamp were not made.
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The function was removed due to redundancy. Therefore, its tests are
obsolete.
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The tests for valid inputs and invalid inputs were split to make them
more readable.
|
| | | | | | |
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
`find_token_in_message` now uses the latter so the tests should adjust
accordingly.
|
| | | | | | |
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
It has to account for the addition of groups. It's easiest to compare
the entire string so `finditer` is used to return re.Match objects;
the tuples of `findall` would be cumbersome. Also threw in a change
to use `assertCountEqual` cause the order doesn't really matter.
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
It was broken due to the addition of groups. Rather than returning the
full match, `findall` returns groups if any exist. The test was
comparing a tuple of groups to the token string, which was of course
failing. Now `fullmatch` is used cause it's simpler - just check for
`None` and don't worry about iterating matches to search.
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The test now ensures the cog is instantiated and that the instance is
passed as an argument to `add_cog`.
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
* Remove `bot.get_cog` mocks in `setUp`
* Mock the logger cause it's easier to assert logs
* Remove subtests
* Assert helper functions were called
* Create an autospec for ModLog
|
| | | | | | |
|
| | | | | | |
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
* Rely on default values for the author
* Set the content to a non-empty string
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
In practice, this won't ever happen since the regex wouldn't match
strings with missing parts. However, the function does check it so may
as well test it. It's not necessarily bound to always use inputs from
the regex either I suppose.
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The original approach of messing with the `attribute_name` didn't work
for reasons I won't discuss here (would require knowledge of patcher
internals). The new approach doesn't use patch.multiple but mimics it by
applying multiple patch decorators to the function. As a consequence,
this can no longer be used as a context manager.
|