From 133c7f74df01eb1f4aa308221e5bde31fcb68118 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Mon, 8 Jun 2026 00:23:07 +0800 Subject: [PATCH] fix: restore star context typing --- astrbot/core/star/base.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/astrbot/core/star/base.py b/astrbot/core/star/base.py index dd3ae3f0e..b375abb82 100644 --- a/astrbot/core/star/base.py +++ b/astrbot/core/star/base.py @@ -1,7 +1,7 @@ from __future__ import annotations import logging -from typing import Any, Protocol +from typing import TYPE_CHECKING, Any from astrbot.core import html_renderer from astrbot.core.utils.command_parser import CommandParserMixin @@ -9,6 +9,9 @@ from astrbot.core.utils.plugin_kv_store import PluginKVStoreMixin from .star import StarMetadata, star_map, star_registry +if TYPE_CHECKING: + from .context import Context + logger = logging.getLogger("astrbot") @@ -17,11 +20,9 @@ class Star(CommandParserMixin, PluginKVStoreMixin): author: str name: str + context: Context - class _ContextLike(Protocol): - def get_config(self, umo: str | None = None) -> Any: ... - - def __init__(self, context: _ContextLike, config: dict | None = None) -> None: + def __init__(self, context: Context, config: dict | None = None) -> None: self.context = context def _get_context_config(self) -> Any: