aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ItsDrike <[email protected]>2020-06-01 23:08:32 +0200
committerGravatar ItsDrike <[email protected]>2020-06-01 23:08:32 +0200
commit9b0df33c90326f62d699afc70c13d3d375affeab (patch)
treeff6afa06e0d5fcdbefa3f4a6ce21ef2d28edfcfc
parentUse Scheduler instead of asyncio.sleep on silence cog (diff)
Fix Formatting/Styling
-rw-r--r--bot/cogs/moderation/silence.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/bot/cogs/moderation/silence.py b/bot/cogs/moderation/silence.py
index a2fd39906..448f17966 100644
--- a/bot/cogs/moderation/silence.py
+++ b/bot/cogs/moderation/silence.py
@@ -6,11 +6,12 @@ from contextlib import suppress
from typing import Optional
from bot.bot import Bot
-from bot.constants import MODERATION_ROLES, Channels, Emojis, Guild, Roles
+from bot.constants import Channels, Emojis, Guild, MODERATION_ROLES, Roles
from bot.converters import HushDurationConverter
from bot.utils import time
from bot.utils.checks import with_role_check
from bot.utils.scheduling import Scheduler
+
from discord import TextChannel
from discord.ext import commands, tasks
from discord.ext.commands import Context
@@ -23,7 +24,7 @@ SilencedChannel = namedtuple(
class UnsilenceScheduler(Scheduler):
- """Scheduler for unsilencing channels"""
+ """Scheduler for unsilencing channels."""
def __init__(self, bot: Bot):
super().__init__()
@@ -31,17 +32,13 @@ class UnsilenceScheduler(Scheduler):
self.bot = bot
async def schedule_unsilence(self, channel: SilencedChannel) -> None:
- """Schedule expiration for silenced channels"""
+ """Schedule expiration for silenced channels."""
await self.bot.wait_until_guild_available()
log.debug("Scheduling unsilencer")
self.schedule_task(channel.id, channel)
async def _scheduled_task(self, channel: SilencedChannel) -> None:
- """
- Removes expired silenced channel from `silence.muted_channels`
- and calls `silence.unsilence` to unsilence the channel
- after the silence expires
- """
+ """Calls `silence.unsilence` on expired silenced channel to unsilence it."""
await time.wait_until(channel.stop)
log.info("Unsilencing channel after set delay.")