Esempio n. 1
0
    async def reject(self, message: str = "") -> NoReturn:
        """拒绝对方加入指定群组的邀请.

        Args:
            message (str, optional): 附带给对方的消息. 默认为 "".

        Raises:
            LookupError: 尝试上下文外处理事件.
            InvaildSession: 应用实例没准备好!

        Returns:
            NoReturn: 没有返回.
        """
        app = application.get()
        if not app.connect_info.sessionKey:
            raise InvaildSession("you must authenticate before this.")
        async with app.session.post(app.url_gen("resp/botInvitedJoinGroupRequestEvent"), json={
            "sessionKey": app.connect_info.sessionKey,
            "eventId": self.requestId,
            "fromId": self.supplicant,
            "groupId": self.groupId,
            "operate": 1,
            "message": message
        }) as response:
            response.raise_for_status()
            data = await response.json()
            raise_for_return_code(data)
Esempio n. 2
0
 async def reject(self, message: str = "") -> NoReturn:
     app = application.get()
     if not app.connect_info.sessionKey:
         raise InvaildSession("you must authenticate before this.")
     async with app.session.post(
             app.url_gen("resp/botInvitedJoinGroupRequestEvent"),
             json={
                 "sessionKey": app.connect_info.sessionKey,
                 "eventId": self.requestId,
                 "fromId": self.supplicant,
                 "groupId": self.sourceGroup,
                 "operate": 1,
                 "message": message
             }) as response:
         response.raise_for_status()
         data = await response.json()
         raise_for_return_code(data)
Esempio n. 3
0
 async def catch(interface):
     if getattr(interface.annotation, "__name__",
                None) == "GraiaMiraiApplication":
         return application.get()