Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
go-cqhttp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
go-cqhttp
Commits
eca396af
Commit
eca396af
authored
Sep 08, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update.
parent
e5718fc4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
22 deletions
+21
-22
coolq/api.go
coolq/api.go
+17
-17
server/http.go
server/http.go
+3
-3
server/websocket.go
server/websocket.go
+1
-2
No files found.
coolq/api.go
View file @
eca396af
...
@@ -68,11 +68,19 @@ func (bot *CQBot) CQGetGroupInfo(groupId int64) MSG {
...
@@ -68,11 +68,19 @@ func (bot *CQBot) CQGetGroupInfo(groupId int64) MSG {
}
}
// https://cqhttp.cc/docs/4.15/#/API?id=get_group_member_list-%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%88%90%E5%91%98%E5%88%97%E8%A1%A8
// https://cqhttp.cc/docs/4.15/#/API?id=get_group_member_list-%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%88%90%E5%91%98%E5%88%97%E8%A1%A8
func
(
bot
*
CQBot
)
CQGetGroupMemberList
(
groupId
int64
)
MSG
{
func
(
bot
*
CQBot
)
CQGetGroupMemberList
(
groupId
int64
,
noCache
bool
)
MSG
{
group
:=
bot
.
Client
.
FindGroup
(
groupId
)
group
:=
bot
.
Client
.
FindGroup
(
groupId
)
if
group
==
nil
{
if
group
==
nil
{
return
Failed
(
100
)
return
Failed
(
100
)
}
}
if
noCache
{
t
,
err
:=
bot
.
Client
.
GetGroupMembers
(
group
)
if
err
!=
nil
{
log
.
Warnf
(
"刷新群 %v 成员列表失败: %v"
,
groupId
,
err
)
return
Failed
(
100
)
}
group
.
Members
=
t
}
members
:=
make
([]
MSG
,
0
)
members
:=
make
([]
MSG
,
0
)
for
_
,
m
:=
range
group
.
Members
{
for
_
,
m
:=
range
group
.
Members
{
members
=
append
(
members
,
convertGroupMemberInfo
(
groupId
,
m
))
members
=
append
(
members
,
convertGroupMemberInfo
(
groupId
,
m
))
...
@@ -81,19 +89,11 @@ func (bot *CQBot) CQGetGroupMemberList(groupId int64) MSG {
...
@@ -81,19 +89,11 @@ func (bot *CQBot) CQGetGroupMemberList(groupId int64) MSG {
}
}
// https://cqhttp.cc/docs/4.15/#/API?id=get_group_member_info-%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%88%90%E5%91%98%E4%BF%A1%E6%81%AF
// https://cqhttp.cc/docs/4.15/#/API?id=get_group_member_info-%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%88%90%E5%91%98%E4%BF%A1%E6%81%AF
func
(
bot
*
CQBot
)
CQGetGroupMemberInfo
(
groupId
,
userId
int64
,
noCache
bool
)
MSG
{
func
(
bot
*
CQBot
)
CQGetGroupMemberInfo
(
groupId
,
userId
int64
)
MSG
{
group
:=
bot
.
Client
.
FindGroup
(
groupId
)
group
:=
bot
.
Client
.
FindGroup
(
groupId
)
if
group
==
nil
{
if
group
==
nil
{
return
Failed
(
100
)
return
Failed
(
100
)
}
}
if
noCache
{
t
,
err
:=
bot
.
Client
.
GetGroupMembers
(
group
)
if
err
!=
nil
{
log
.
Warnf
(
"刷新群 %v 成员列表失败: %v"
,
groupId
,
err
)
return
Failed
(
100
)
}
group
.
Members
=
t
}
member
:=
group
.
FindMember
(
userId
)
member
:=
group
.
FindMember
(
userId
)
if
member
==
nil
{
if
member
==
nil
{
return
Failed
(
102
)
return
Failed
(
102
)
...
@@ -411,13 +411,13 @@ func (bot *CQBot) CQGetVipInfo(userId int64) MSG {
...
@@ -411,13 +411,13 @@ func (bot *CQBot) CQGetVipInfo(userId int64) MSG {
return
Failed
(
100
)
return
Failed
(
100
)
}
}
msg
=
MSG
{
msg
=
MSG
{
"user_id"
:
vip
.
Uin
,
"user_id"
:
vip
.
Uin
,
"nickname"
:
vip
.
Name
,
"nickname"
:
vip
.
Name
,
"level"
:
vip
.
Level
,
"level"
:
vip
.
Level
,
"level_speed"
:
vip
.
LevelSpeed
,
"level_speed"
:
vip
.
LevelSpeed
,
"vip_level"
:
vip
.
VipLevel
,
"vip_level"
:
vip
.
VipLevel
,
"vip_growth_speed"
:
vip
.
VipGrowthSpeed
,
"vip_growth_speed"
:
vip
.
VipGrowthSpeed
,
"vip_growth_total"
:
vip
.
VipGrowthTotal
,
"vip_growth_total"
:
vip
.
VipGrowthTotal
,
}
}
return
OK
(
msg
)
return
OK
(
msg
)
}
}
...
...
server/http.go
View file @
eca396af
...
@@ -233,14 +233,14 @@ func (s *httpServer) GetGroupInfo(c *gin.Context) {
...
@@ -233,14 +233,14 @@ func (s *httpServer) GetGroupInfo(c *gin.Context) {
func
(
s
*
httpServer
)
GetGroupMemberList
(
c
*
gin
.
Context
)
{
func
(
s
*
httpServer
)
GetGroupMemberList
(
c
*
gin
.
Context
)
{
gid
,
_
:=
strconv
.
ParseInt
(
getParam
(
c
,
"group_id"
),
10
,
64
)
gid
,
_
:=
strconv
.
ParseInt
(
getParam
(
c
,
"group_id"
),
10
,
64
)
c
.
JSON
(
200
,
s
.
bot
.
CQGetGroupMemberList
(
gid
))
nc
:=
getParamOrDefault
(
c
,
"no_cache"
,
"false"
)
c
.
JSON
(
200
,
s
.
bot
.
CQGetGroupMemberList
(
gid
,
nc
==
"true"
))
}
}
func
(
s
*
httpServer
)
GetGroupMemberInfo
(
c
*
gin
.
Context
)
{
func
(
s
*
httpServer
)
GetGroupMemberInfo
(
c
*
gin
.
Context
)
{
gid
,
_
:=
strconv
.
ParseInt
(
getParam
(
c
,
"group_id"
),
10
,
64
)
gid
,
_
:=
strconv
.
ParseInt
(
getParam
(
c
,
"group_id"
),
10
,
64
)
uid
,
_
:=
strconv
.
ParseInt
(
getParam
(
c
,
"user_id"
),
10
,
64
)
uid
,
_
:=
strconv
.
ParseInt
(
getParam
(
c
,
"user_id"
),
10
,
64
)
nc
:=
getParamOrDefault
(
c
,
"no_cache"
,
"false"
)
c
.
JSON
(
200
,
s
.
bot
.
CQGetGroupMemberInfo
(
gid
,
uid
))
c
.
JSON
(
200
,
s
.
bot
.
CQGetGroupMemberInfo
(
gid
,
uid
,
nc
==
"true"
))
}
}
func
(
s
*
httpServer
)
SendMessage
(
c
*
gin
.
Context
)
{
func
(
s
*
httpServer
)
SendMessage
(
c
*
gin
.
Context
)
{
...
...
server/websocket.go
View file @
eca396af
...
@@ -397,12 +397,11 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
...
@@ -397,12 +397,11 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
return
bot
.
CQGetGroupInfo
(
p
.
Get
(
"group_id"
)
.
Int
())
return
bot
.
CQGetGroupInfo
(
p
.
Get
(
"group_id"
)
.
Int
())
},
},
"get_group_member_list"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
"get_group_member_list"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
return
bot
.
CQGetGroupMemberList
(
p
.
Get
(
"group_id"
)
.
Int
())
return
bot
.
CQGetGroupMemberList
(
p
.
Get
(
"group_id"
)
.
Int
()
,
p
.
Get
(
"no_cache"
)
.
Bool
()
)
},
},
"get_group_member_info"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
"get_group_member_info"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
return
bot
.
CQGetGroupMemberInfo
(
return
bot
.
CQGetGroupMemberInfo
(
p
.
Get
(
"group_id"
)
.
Int
(),
p
.
Get
(
"user_id"
)
.
Int
(),
p
.
Get
(
"group_id"
)
.
Int
(),
p
.
Get
(
"user_id"
)
.
Int
(),
p
.
Get
(
"no_cache"
)
.
Bool
(),
)
)
},
},
"send_msg"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
"send_msg"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment