mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
feat: get_unidirectional_friend_list api.
This commit is contained in:
parent
eadd688e5a
commit
b8bf3f9711
20
coolq/api.go
20
coolq/api.go
@ -72,6 +72,26 @@ func (bot *CQBot) CQGetFriendList() MSG {
|
||||
return OK(fs)
|
||||
}
|
||||
|
||||
// CQGetUnidirectionalFriendList 获取单向好友列表
|
||||
//
|
||||
//
|
||||
func (bot *CQBot) CQGetUnidirectionalFriendList() MSG {
|
||||
list, err := bot.Client.GetUnidirectionalFriendList()
|
||||
if err != nil {
|
||||
log.Errorf("获取单向好友列表时出现错误: %v", err)
|
||||
return Failed(100, "API_ERROR", err.Error())
|
||||
}
|
||||
fs := make([]MSG, 0, len(list))
|
||||
for _, f := range list {
|
||||
fs = append(fs, MSG{
|
||||
"nickname": f.Nickname,
|
||||
"user_id": f.Uin,
|
||||
"source": f.Source,
|
||||
})
|
||||
}
|
||||
return OK(fs)
|
||||
}
|
||||
|
||||
// CQDeleteFriend 删除好友
|
||||
//
|
||||
//
|
||||
|
@ -32,6 +32,10 @@ func getFriendList(bot *coolq.CQBot, _ resultGetter) coolq.MSG {
|
||||
return bot.CQGetFriendList()
|
||||
}
|
||||
|
||||
func getUnidirectionalFriendList(bot *coolq.CQBot, _ resultGetter) coolq.MSG {
|
||||
return bot.CQGetUnidirectionalFriendList()
|
||||
}
|
||||
|
||||
func deleteFriend(bot *coolq.CQBot, p resultGetter) coolq.MSG {
|
||||
return bot.CQDeleteFriend(p.Get("id").Int())
|
||||
}
|
||||
@ -358,6 +362,7 @@ func markMSGAsRead(bot *coolq.CQBot, p resultGetter) coolq.MSG {
|
||||
var API = map[string]func(*coolq.CQBot, resultGetter) coolq.MSG{
|
||||
"get_login_info": getLoginInfo,
|
||||
"get_friend_list": getFriendList,
|
||||
"get_unidirectional_friend_list": getUnidirectionalFriendList,
|
||||
"delete_friend": deleteFriend,
|
||||
"get_group_list": getGroupList,
|
||||
"get_group_info": getGroupInfo,
|
||||
|
Loading…
x
Reference in New Issue
Block a user