GraiaProject / Ariadne

一个优雅且完备的 Python QQ 自动化框架,基于 Mirai API HTTP v2。 Powered by Graia Project.
https://graia.cn/ariadne
GNU Affero General Public License v3.0
753 stars 45 forks source link

[Feature] 当 `MemberLeaveEventKick` 的 `annotation` 为 `Member` 且 `name` 为空时缺省返回 `event.member` #81

Closed Redlnn closed 2 years ago

Redlnn commented 2 years ago

如题

@staticmethod
async def catch(interface: DispatcherInterface["MemberLeaveEventKick"]):
    if interface.annotation is Member:
        if interface.name == "target":
            return interface.event.member
        if interface.name == "operator":
            return interface.event.operator
    elif interface.annotation is Group:
        return interface.event.member.group

改为

@staticmethod
async def catch(interface: DispatcherInterface["MemberLeaveEventKick"]):
    if interface.annotation is Member:
        if interface.name == "target":
            return interface.event.member
        elif interface.name == "operator":
            return interface.event.operator
        else:
            return interface.event.member
    elif interface.annotation is Group:
        return interface.event.member.group