From 94f7a701034d53e82d04f2a08e5927f874c74f49 Mon Sep 17 00:00:00 2001 From: mbaruh Date: Sat, 13 Feb 2021 17:34:57 +0200 Subject: Prevent channel description edit from locking commands Because some parts are defined as atomic transaction, we can't use them with channel description edits which are heavily rate limited. Description edits are now run in a separate task. --- bot/exts/moderation/defcon.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/exts/moderation/defcon.py b/bot/exts/moderation/defcon.py index 17b521b00..d1b99cb35 100644 --- a/bot/exts/moderation/defcon.py +++ b/bot/exts/moderation/defcon.py @@ -1,5 +1,6 @@ from __future__ import annotations +import asyncio import logging from collections import namedtuple from datetime import datetime @@ -182,7 +183,7 @@ class Defcon(Cog): new_topic = f"{BASE_CHANNEL_TOPIC}\n(Threshold: {humanize_delta(self.threshold)})" self.mod_log.ignore(Event.guild_channel_update, Channels.defcon) - await self.channel.edit(topic=new_topic) + asyncio.create_task(self.channel.edit(topic=new_topic)) @redis_cache.atomic_transaction async def _defcon_action(self, author: User, threshold: relativedelta, expiry: Optional[Expiry] = None) -> None: -- cgit v1.2.3