855 协议版本
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
from wechat_ipad import UserLoggedOut
|
||||
from wechat_ipad.client.firends import FriendMixin
|
||||
from wechat_ipad.client.group import ChatroomMixin
|
||||
from wechat_ipad.client.login import LoginMixin
|
||||
from wechat_ipad.client.message import MessageMixin
|
||||
from wechat_ipad.client.tools import ToolMixin
|
||||
from wechat_ipad.client.user import UserMixin
|
||||
|
||||
|
||||
class WechatAPIClient(LoginMixin, MessageMixin, FriendMixin, ChatroomMixin, UserMixin,
|
||||
ToolMixin):
|
||||
|
||||
# 这里都是需要结合多个功能的方法
|
||||
|
||||
async def send_at_message(self, wxid: str, content: str, at: list[str]) -> tuple[int, int, int]:
|
||||
"""发送@消息
|
||||
|
||||
Args:
|
||||
wxid (str): 接收人
|
||||
content (str): 消息内容
|
||||
at (list[str]): 要@的用户ID列表
|
||||
|
||||
Returns:
|
||||
tuple[int, int, int]: 包含以下三个值的元组:
|
||||
- ClientMsgid (int): 客户端消息ID
|
||||
- CreateTime (int): 创建时间
|
||||
- NewMsgId (int): 新消息ID
|
||||
|
||||
Raises:
|
||||
UserLoggedOut: 用户未登录时抛出
|
||||
BanProtection: 新设备登录4小时内操作时抛出
|
||||
"""
|
||||
if not self.wxid:
|
||||
raise UserLoggedOut("请先登录")
|
||||
|
||||
output = ""
|
||||
for id in at:
|
||||
nickname = await self.get_nickname(id)
|
||||
output += f"@{nickname}\u2005"
|
||||
|
||||
output += content
|
||||
|
||||
return await self.send_text_message(wxid, output, at)
|
||||
Reference in New Issue
Block a user