aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2021-10-05 23:31:55 +0200
committerGravatar GitHub <[email protected]>2021-10-05 23:31:55 +0200
commit7d7af1378d8110ffa9f8f20953121d3fb889b6d5 (patch)
treee6d2f703d67e7811a1876ea43be430c3ab9fc367
parentMerge pull request #1855 from python-discord/antispam-log-improvements (diff)
parentMerge branch 'main' into minor-changes-to-typing-patch (diff)
Merge pull request #1854 from python-discord/minor-changes-to-typing-patch
Use utcnow() and lower a logging level in patch_typing
-rw-r--r--bot/monkey_patches.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/bot/monkey_patches.py b/bot/monkey_patches.py
index 9c0a22bfb..4dbdb5eab 100644
--- a/bot/monkey_patches.py
+++ b/bot/monkey_patches.py
@@ -30,20 +30,20 @@ def patch_typing() -> None:
Handle those issues by patching the trigger_typing method so it ignores 403's in general.
"""
- log.info("Patching send_typing, which should fix things breaking when discord disables typing events. Stay safe!")
+ log.debug("Patching send_typing, which should fix things breaking when discord disables typing events. Stay safe!")
original = http.HTTPClient.send_typing
last_403 = None
async def honeybadger_type(self, channel_id: int) -> None: # noqa: ANN001
nonlocal last_403
- if last_403 and (datetime.now() - last_403) < timedelta(minutes=5):
+ if last_403 and (datetime.utcnow() - last_403) < timedelta(minutes=5):
log.warning("Not sending typing event, we got a 403 less than 5 minutes ago.")
return
try:
await original(self, channel_id)
except Forbidden:
- last_403 = datetime.now()
+ last_403 = datetime.utcnow()
log.warning("Got a 403 from typing event!")
pass