Ejemplo n.º 1
0
 async def sendGroupPic(
     self,
     user: int,
     *,
     content: str = '',
     picUrl: str = '',
     picBase64Buf: str = '',
     fileMd5: str = '',
     flashPic=False,
     atUser: Union[int, List[int]] = 0,
 ) -> dict:
     """发送群组图片消息"""
     assert any([picUrl, picBase64Buf, fileMd5]), '缺少参数'
     if atUser != 0:
         content = macro.atUser(atUser) + content
     return await self.post(
         'SendMsg',
         {
             "toUser": user,
             "sendToType": 2,
             "sendMsgType": "PicMsg",
             "content": content,
             "picUrl": picUrl,
             "picBase64Buf": picBase64Buf,
             "fileMd5": fileMd5,
             "flashPic": flashPic,
         },
     )
Ejemplo n.º 2
0
 async def sendGroupText(
     self, group: int, content: str, atUser: Union[int, List[int]] = 0
 ) -> dict:
     """发送群组文本消息"""
     if atUser != 0:
         content = macro.atUser(atUser) + content
     return await self.post(
         'SendMsgV2',
         {
             "ToUserUid": group,
             "SendToType": 2,
             "SendMsgType": "TextMsg",
             "Content": content,
         },
     )
Ejemplo n.º 3
0
 def sendGroupPic(
     self,
     group: int,
     *,
     content: str = '',
     picUrl: str = '',
     picBase64Buf: str = '',
     fileMd5: str = '',
     picMd5s: Union[str, List[str]] = '',
     flashPic=False,
     atUser: Union[int, List[int]] = 0,
 ) -> dict:
     """发送群组图片消息"""
     assert any([picUrl, picBase64Buf, fileMd5, picMd5s]), '缺少参数'
     if atUser != 0:
         content = macro.atUser(atUser) + '\n' + content
     if picMd5s:
         if not isinstance(picMd5s, collections.Sequence):
             picMd5s = [picMd5s]
         return self.post(
             'SendMsgV2',
             {
                 "ToUserUid": group,
                 "SendToType": 2,
                 "SendMsgType": "PicMsg",
                 "PicMd5s": picMd5s,
             },
         )
     return self.post(
         'SendMsg',
         {
             "toUser": group,
             "sendToType": 2,
             "sendMsgType": "PicMsg",
             "content": content,
             "picUrl": picUrl,
             "picBase64Buf": picBase64Buf,
             "fileMd5": fileMd5,
             "flashPic": flashPic,
         },
     )