Skip to content

Commit 8f5178d

Browse files
authored
fix: restore star context typing (#8659)
1 parent 05c137e commit 8f5178d

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

astrbot/core/star/base.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
from __future__ import annotations
22

33
import logging
4-
from typing import Any, Protocol
4+
from typing import TYPE_CHECKING, Any
55

66
from astrbot.core import html_renderer
77
from astrbot.core.utils.command_parser import CommandParserMixin
88
from astrbot.core.utils.plugin_kv_store import PluginKVStoreMixin
99

1010
from .star import StarMetadata, star_map, star_registry
1111

12+
if TYPE_CHECKING:
13+
from .context import Context
14+
1215
logger = logging.getLogger("astrbot")
1316

1417

@@ -17,11 +20,9 @@ class Star(CommandParserMixin, PluginKVStoreMixin):
1720

1821
author: str
1922
name: str
23+
context: Context
2024

21-
class _ContextLike(Protocol):
22-
def get_config(self, umo: str | None = None) -> Any: ...
23-
24-
def __init__(self, context: _ContextLike, config: dict | None = None) -> None:
25+
def __init__(self, context: Context, config: dict | None = None) -> None:
2526
self.context = context
2627

2728
def _get_context_config(self) -> Any:

0 commit comments

Comments
 (0)