diff --git a/commands/utils.py b/commands/utils.py index 49ce7c6..92251e9 100644 --- a/commands/utils.py +++ b/commands/utils.py @@ -1,9 +1,9 @@ -import enum +from enum import Enum import constants -class Command(enum.Enum): +class Command(Enum): CLEAR = "clear" CURRENT = "current" EXECUTE = "execute" diff --git a/core.py b/core.py index f757a54..3555622 100644 --- a/core.py +++ b/core.py @@ -13,6 +13,7 @@ import disnake_paginator import commands import constants import utils +from commands import Command as C from state import client, command_locks, idle_tracker @@ -42,7 +43,6 @@ async def on_message(message, edited=False): if message.guild.id not in command_locks: command_locks[message.guild.id] = asyncio.Lock() - C = commands.Command try: match matched[0]: case C.RELOAD if message.author.id in constants.OWNERS: @@ -136,13 +136,13 @@ async def on_voice_state_update(_, before, after): def is_empty(channel): return [m.id for m in (channel.members if channel else [])] == [client.user.id] - c = None + channel = None if is_empty(before.channel): - c = before.channel + channel = before.channel elif is_empty(after.channel): - c = after.channel - if c: - await c.guild.voice_client.disconnect() + channel = after.channel + if channel: + await channel.guild.voice_client.disconnect() def rreload(reloaded_modules, module): diff --git a/state.py b/state.py index ff6db80..cf7feea 100644 --- a/state.py +++ b/state.py @@ -1,13 +1,13 @@ -import collections import time +from collections import OrderedDict import disnake -class LimitedSizeDict(collections.OrderedDict): - def __init__(self, *args, **kwds): - self.size_limit = kwds.pop("size_limit", 1000) - super().__init__(*args, **kwds) +class LimitedSizeDict(OrderedDict): + def __init__(self, *args, **kwargs): + self.size_limit = kwargs.pop("size_limit", 1000) + super().__init__(*args, **kwargs) self._check_size_limit() def __setitem__(self, key, value):