| Commit message (Collapse) | Author | Age | Lines |
| ... | |
| | | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
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
|
| | |\ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
Use Scheduler instead of asyncio.sleep on silence cog
|
| | | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
- Using a class is more readable than using a NamedTuple
|
| | | | | | | | | | |
|
| | | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
- As suggested, `was` is more fitting in the message than `is`
|
| | | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
- as sugested notifier.remove_channel and muted_channels.discard should be together
|
| | | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
- self.schedule_task shouldn't be awaited as it isn't a coroutine
|
| | | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
- As suggested, this function is not necessary
- Also fixed no longer valid`stop`in SilencedChannel NamedTuple
|
| | | | | | | | | | |
|
| | | | | | | | | | |
|
| | | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
- There shouldn't be another class only for Scheduler
instead, we can implement it directly into Silence class
|
| | | | | | | | | | |
|
| | | | | | | | | | |
|
| | | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
`asyncio.sleep` doesn't provide us with the ability to stop that timer,
while in most of the cases, this is fine, there is a possibility that
channel will be unsilenced manually and silenced again, but this sleep from
the first silence will cancel the second (new) silence.
This will replace this `asyncio.sleep` with Scheduler which provides the
ability to cancel the unsilencing task when aborted manually.
That means we also have the ability to send a response if the channel is
not silenced and someone tries to unsilence it.
|
| | |\ \ \ \ \ \ \ \
| | |_|_|_|_|_|/ /
| |/| | | | | | | |
Escape markdown in charinfo embed
|
| | |/ / / / / / /
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
The embed displays the original character. If it's a markdown char,
it would interfere with the embed's actual markdown. The backtick was
especially troublesome.
Fixes #996
|
| | | | | | | | | |
|
| | | | | | | | | |
|
| | | | | | | | | |
|
| | | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Using the cache is more efficient since it can check only the users it
expects to have a cooldown rather than searching all guild members.
Furthermore, re-scheduling the cooldowns ensures members experience the
full duration of the cooldown. Previously, all cooldowns were removed,
regardless of whether they were expired.
|
| | | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Moving this code into a separate function reduces redundancy down the
line. This will also get used to re-scheduled cooldowns after a restart.
|
| | | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Future code will also need to get this time, so moving it out to a
separate function reduces redundancy.
|
| | | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
The datetime module returns a local timestamp for naïve datetimes.
It has to be timezone-aware to ensure it will always be in UTC.
|
| | | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Since help_channel_claimants.delete will never raise a KeyError, it's
not necessary to suppress one.
|
| | | | | | |\| | |
|
| | | | | | |\ \ \ |
|
| | | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
Instead of first checking if the channel.id exists and then checking
what it is, we just do a single API call, to prevent cases where
something fucky might happen inbetween the first and the second call.
|
| | | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
We're also switching from datetime.now() to datetime.utcnow().
|
| | | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
This means we don't need to rely on strtobool, and is a cleaner
implementation overall. Thanks @MarkKoz.
|
| | | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
More specifically, we're turning three
dicts into RedisCaches:
- help_channel_claimants
- unanswered
- claim_times
These will still work the same way, but will now persist their contents
across restarts.
|
| | | | |_|/ / / /
| | |/| | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
We're gonna need this for the help channel handling, and it seems like a
reasonable type to support anyway. It requires a tiny bit of special
handling, but nothing outrageous.
|
| | | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
The function doesn't take the loop as an argument anymore
|
| | | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Recent changes to the scheduler requires this line to be removed.
|
| | | | | | | | |\ |
|
| | | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
It could have caused an issue later with a mix of naive and aware datetime
Co-Authored-By: Sebastiaan Zeeff <[email protected]>
|
| | | | | | | | |\ \ |
|
| | | | | | | | | | | |
|