fix: Improve imports in archiver_commands.py

- Add missing redbot.core.commands import
- Organize imports into standard library, discord, and local groups
- Fix CommandContext.__aenter__ to use self.ctx instead of global ctx
This commit is contained in:
pacnpal
2024-11-16 22:00:22 +00:00
parent b6e397fb95
commit 6493356670

View File

@@ -1,11 +1,13 @@
"""Module for core archiver commands""" """Module for core archiver commands"""
import discord
from redbot.core.commands import Context, hybrid_group, guild_only, admin_or_permissions
from discord import app_commands
import logging import logging
from typing import Optional, Any, Dict, TypedDict, Callable, Awaitable
from enum import Enum, auto from enum import Enum, auto
from typing import Optional, Any, Dict, TypedDict, Callable, Awaitable
import discord
from discord import app_commands
from redbot.core import commands
from redbot.core.commands import Context, hybrid_group, guild_only, admin_or_permissions
from ..response_handler import handle_response, ResponseType from ..response_handler import handle_response, ResponseType
from ...utils.exceptions import ( from ...utils.exceptions import (
@@ -44,7 +46,7 @@ class CommandContext:
async def __aenter__(self) -> 'CommandContext': async def __aenter__(self) -> 'CommandContext':
"""Set up command context""" """Set up command context"""
self.start_time = ctx.message.created_at self.start_time = self.ctx.message.created_at
logger.debug( logger.debug(
f"Starting command {self.operation} in category {self.category.name}" f"Starting command {self.operation} in category {self.category.name}"
) )