From 649335667012c40634fef3ee26451cd199885f7e Mon Sep 17 00:00:00 2001 From: pacnpal <183241239+pacnpal@users.noreply.github.com> Date: Sat, 16 Nov 2024 22:00:22 +0000 Subject: [PATCH] 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 --- videoarchiver/core/commands/archiver_commands.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/videoarchiver/core/commands/archiver_commands.py b/videoarchiver/core/commands/archiver_commands.py index 2d9b6ea..3923ccc 100644 --- a/videoarchiver/core/commands/archiver_commands.py +++ b/videoarchiver/core/commands/archiver_commands.py @@ -1,11 +1,13 @@ """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 -from typing import Optional, Any, Dict, TypedDict, Callable, Awaitable 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 ...utils.exceptions import ( @@ -44,7 +46,7 @@ class CommandContext: async def __aenter__(self) -> 'CommandContext': """Set up command context""" - self.start_time = ctx.message.created_at + self.start_time = self.ctx.message.created_at logger.debug( f"Starting command {self.operation} in category {self.category.name}" )