Skip to content

Commit

Permalink
✨ support BotSpecifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamail committed Nov 24, 2023
1 parent 9096505 commit fa85307
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions nonebot_plugin_saa/adapters/qq.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,16 @@ def extract_message_event(event: Event) -> PlatformTarget:
raise ValueError(f"{type(event)} not supported")

@register_target_extractor(C2CMessageCreateEvent)
def extract_c2c_message_event(event: Event) -> PlatformTarget:
def extract_c2c_message_event(event: Event, bot: BaseBot) -> PlatformTarget:
assert isinstance(bot, Bot)
assert isinstance(event, C2CMessageCreateEvent)
return TargetQQPrivateOpenId(user_id=event.author.id)
return TargetQQPrivateOpenId(user_id=event.author.user_openid, bot_id=bot.self_id)

@register_target_extractor(GroupAtMessageCreateEvent)
def extract_group_at_message_event(event: Event) -> PlatformTarget:
def extract_group_at_message_event(event: Event, bot: BaseBot) -> PlatformTarget:
assert isinstance(bot, Bot)
assert isinstance(event, GroupAtMessageCreateEvent)
return TargetQQGroupOpenId(group_id=event.group_id)
return TargetQQGroupOpenId(group_id=event.author.member_openid, bot_id=bot.self_id)

@register_qqguild_dms(adapter)
async def get_dms(target: TargetQQGuildDirect, bot: BaseBot) -> int:
Expand Down

0 comments on commit fa85307

Please sign in to comment.