mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 00:55:07 +08:00
🐛 fix bad type hinting
This commit is contained in:
parent
abcdbc4de9
commit
bdd9f5ae30
@ -421,10 +421,10 @@ def on_command(cmd: Union[str, Tuple[str, ...]],
|
||||
"""
|
||||
|
||||
async def _strip_cmd(bot: "Bot", event: "Event", state: T_State):
|
||||
message: Iterable[MessageSegment] = event.get_message()
|
||||
message = event.get_message()
|
||||
text_processed = False
|
||||
for index, segment in enumerate(message):
|
||||
segment: MessageSegment = message.pop(index)
|
||||
segment: "MessageSegment" = message.pop(index)
|
||||
if segment.is_text() and not text_processed:
|
||||
segment, *_ = message.__class__(
|
||||
str(segment)[len(state["_prefix"]["raw_command"]):].lstrip(
|
||||
|
@ -137,7 +137,7 @@ class TrieRule:
|
||||
prefix = None
|
||||
suffix = None
|
||||
message = event.get_message()
|
||||
message_seg: Optional[MessageSegment] = next(
|
||||
message_seg: Optional["MessageSegment"] = next(
|
||||
filter(lambda x: x.is_text(), message), None)
|
||||
if message_seg is not None:
|
||||
prefix = cls.prefix.longest_prefix(str(message_seg).lstrip())
|
||||
|
Loading…
Reference in New Issue
Block a user