Skip to content

Commit

Permalink
more actions
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyaowong committed Nov 8, 2020
1 parent c6e52c8 commit 9e719ec
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 8 deletions.
48 changes: 45 additions & 3 deletions botoy/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,46 @@ def replyFriendMsg(
},
)

def repostVideo2Group(self, group: int, forwordBuf: str) -> dict:
"""转发视频到群聊
:param group: 群号
:param forwordBuf: 原视频的forwordBuf字段
"""
return self.post(
'SendMsg',
{
"toUser": group,
"sendToType": 2,
"sendMsgType": "ForwordMsg",
"forwordBuf": forwordBuf,
"forwordField": 19,
},
)

def repostVideo2Friend(self, user: int, forwordBuf: str) -> dict:
"""转发视频到好友
:param user: 好友QQ
:param forwordBuf: 原视频的forwordBuf字段
"""
return self.post(
'SendMsg',
{
"toUser": user,
"sendToType": 1,
"sendMsgType": "ForwordMsg",
"forwordBuf": forwordBuf,
"forwordField": 19,
},
)

############获取############
def getCookies(self) -> dict:
"""获取QQ相关cookie"""
return self.get('GetUserCook')

def getUserInfo(self, UserID: int) -> dict:
def getUserInfo(self, user: int) -> dict:
"""获取任意用户信息昵称头像等"""
return self.post('GetUserInfo', {'UserID': UserID})
return self.post('GetUserInfo', {'UserID': user})

def getUserList(self) -> List[dict]: # FIXME: 目前只适用于好友较少一次获取就可以的情况,好友较多需要循环获取
"""获取好友列表"""
Expand Down Expand Up @@ -350,7 +382,7 @@ def getGroupMembers(self, group: int) -> List[dict]:
if 'LastUin' not in data or data['LastUin'] == 0:
break
lastUin = data['LastUin']
time.sleep(0.5)
time.sleep(0.6)
return members

def getGroupAdminList(self, group: int, include_owner=True) -> List[dict]:
Expand Down Expand Up @@ -511,6 +543,16 @@ def driveUserAway(self, group: int, user: int) -> dict:
{"ActionType": 3, "GroupID": group, "ActionUserID": user, "Content": ""},
)

def refreshKeys(self) -> dict:
"""刷新key二次登陆"""
return self.get('', path='/v1/RefreshKeys')

def logout(self, flag=False) -> bool:
"""退出指定QQ
:param flag: 是否删除设备信息文件
"""
return self.post('LogOut', {"Flag": flag})

############################################################################
def baseRequest(
self,
Expand Down
9 changes: 4 additions & 5 deletions docs/action.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,15 @@ port 和 host 的含义和 Botoy 实例中的一致
| driveUserAway | 移出群聊 |
| getClusterInfo | 获取当前集群信息 |
| | 搜索群组 |
| | 获取包括群主在内的所有管理员列表 |
| | 刷新 key 二次登陆 |
| refreshKeys | 刷新 key 二次登陆 |
| | 添加好友 |
| | 处理好友请求 |
| | 退出 qq |
| logout | 退出指定 qq |
| | 获取登录二维码的 base64 编码 |
| | 获取好友文件下载链接 |
| | 获取群文件下载链接 |
| | 转发视频到群聊 |
| | 转发视频给好友 |
| repostVideo2Group | 转发视频到群聊 |
| repostVideo2Friend | 转发视频给好友 |

- 除特殊说明,API 返回的都是字典类型,如果出错则返回空字典
- 没有方法名的表示还未封装,说明前面带\*号的表示还不完善
Expand Down

0 comments on commit 9e719ec

Please sign in to comment.