| Commit message (Collapse) | Author | Age | Lines |
| |
|
|
|
|
| |
The timestamp in the token is in seconds and is being compared against
the epoch. To make life easier, they should use the same unit.
Previously, the epoch was in milliseconds.
|
| |
|
|
|
| |
It makes more sense to use the lazy function when the loop is already
short-circuiting on the first valid token it finds.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
It felt redundant to be splitting the token in two different functions
when regex could take care of this from the outset. '
A NamedTuple was created to house the token. This is nicer than passing
an re.Match object, because it's clearer which attributes are available.
Even if the regex used named groups, it wouldn't be as obvious which
group names exist.
Without the split, `is_maybe_token` is dwindled down to a redundant
function. Therefore, it's been removed.
|
| |
|
|
|
| |
They need to be escaped when they're in a character set. By default,
they are interpreted as part of the character range syntax.
|
| |
|
|
|
|
|
| |
Making the regex more accurate reduces false positives at an earlier
stage. There's no benefit to matching non-base64 as that would
just be weeded out as invalid at a later stage anyway when it tries to
decode it.
|
| |
|
|
|
| |
Though I've not seen an ID with neither + and \ nor - and _, given that
the timestamp uses URL-safe encoding, the ID probably does too.
|
| | |
|
| |
|
|
|
|
|
| |
`isnumeric` would be true for a wide range of characters in Unicode,
but the ID must only consist of the characters 0-9 (ASCII digits). In
fact, `isdigit` on its own would also match other Unicode characters
too.
|
| |
|
|
|
|
| |
The timestamp calculation was incorrect. The bytes need to be
interpreted as big-endian and the result is just a timestamp rather than
a snowflake.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
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
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
It's annotated as returning a bool and when the split fails it already
returns False. To be consistent, it should always return a bool.
|
| |
|
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
It's not possible to test this via asserting the return value of
`on_message` since it never returns anything. Instead, the actual
relevant unit, `find_token_in_message,` should be tested.
|
| |
|
|
|
| |
This gives the caller more flexibility. Sometimes attribute names are
too long or they don't follow a naming scheme accepted by the linter.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
This helper reduces redundancy/boilerplate by setting default values.
It also has the consequence of shortening the length of the invocation,
which makes it faster to use and easier to read.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
The token uses base64 and base64 only allows ASCII characters. Thus, if
a match has non-ASCII characters, it's not a valid token. Catching the
ValueError is simpler than trying to adjust the regex to only match
valid base64.
Fixes #928
Fixes BOT-3X
|
| |\
| |
| |
| |
| | |
python-discord/feature/hemlock/perma-ban-override-temp
Perma Bans now Overwrite Temp Bans
|
| | |\
| |/
|/| |
|
| |\ \
| | |
| | | |
Add remindme alias for the remind command
|
| |/ / |
|
| |\ \
| | |
| | | |
Remove the mention command and configuration settings for it
|
| | |\ \
| |/ /
|/| | |
|
| |\ \ \
| | | |
| | | | |
Use selector event loop on Windows
|
| | |\ \ \
| |/ / /
|/| | | |
|
| |\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
python-discord/bug/backend/911/log-listener-exceptions
Log unhandled errors from event listeners
|
| | |\ \ \ \
| |/ / / /
|/| | | | |
|