🐛 fix bad type hinting

This commit is contained in:
Mix 2021-02-07 02:27:09 +08:00
parent abcdbc4de9
commit bdd9f5ae30
2 changed files with 3 additions and 3 deletions

View File

@ -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(

View File

@ -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())