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
b104b21a
Commit
b104b21a
authored
Sep 05, 2020
by
wdvxdr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: api _get_vip_info
parent
d79cb0b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
0 deletions
+29
-0
coolq/api.go
coolq/api.go
+18
-0
server/http.go
server/http.go
+8
-0
server/websocket.go
server/websocket.go
+3
-0
No files found.
coolq/api.go
View file @
b104b21a
...
@@ -396,6 +396,24 @@ func (bot *CQBot) CQDeleteMessage(messageId int32) MSG {
...
@@ -396,6 +396,24 @@ func (bot *CQBot) CQDeleteMessage(messageId int32) MSG {
return
OK
(
nil
)
return
OK
(
nil
)
}
}
func
(
bot
*
CQBot
)
CQGetVipInfo
(
userId
int64
)
MSG
{
msg
:=
MSG
{}
vip
,
err
:=
bot
.
Client
.
GetVipInfo
(
userId
)
if
err
!=
nil
{
return
Failed
(
100
)
}
msg
=
MSG
{
"user_id"
:
vip
.
Uin
,
"nickname"
:
vip
.
Name
,
"level"
:
vip
.
Level
,
"level_speed"
:
vip
.
LevelSpeed
,
"vip_level"
:
vip
.
VipLevel
,
"vip_growth_speed"
:
vip
.
VipGrowthSpeed
,
"vip_growth_total"
:
vip
.
VipGrowthTotal
,
}
return
OK
(
msg
)
}
// https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#get_group_honor_info-%E8%8E%B7%E5%8F%96%E7%BE%A4%E8%8D%A3%E8%AA%89%E4%BF%A1%E6%81%AF
// https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#get_group_honor_info-%E8%8E%B7%E5%8F%96%E7%BE%A4%E8%8D%A3%E8%AA%89%E4%BF%A1%E6%81%AF
func
(
bot
*
CQBot
)
CQGetGroupHonorInfo
(
groupId
int64
,
t
string
)
MSG
{
func
(
bot
*
CQBot
)
CQGetGroupHonorInfo
(
groupId
int64
,
t
string
)
MSG
{
msg
:=
MSG
{
"group_id"
:
groupId
}
msg
:=
MSG
{
"group_id"
:
groupId
}
...
...
server/http.go
View file @
b104b21a
...
@@ -154,6 +154,9 @@ func (s *httpServer) Run(addr, authToken string, bot *coolq.CQBot) {
...
@@ -154,6 +154,9 @@ func (s *httpServer) Run(addr, authToken string, bot *coolq.CQBot) {
s
.
engine
.
Any
(
"/get_version_info"
,
s
.
GetVersionInfo
)
s
.
engine
.
Any
(
"/get_version_info"
,
s
.
GetVersionInfo
)
s
.
engine
.
Any
(
"/get_version_info_async"
,
s
.
GetVersionInfo
)
s
.
engine
.
Any
(
"/get_version_info_async"
,
s
.
GetVersionInfo
)
s
.
engine
.
Any
(
"/_get_vip_info"
,
s
.
GetVipInfo
)
s
.
engine
.
Any
(
"/_get_vip_info_async"
,
s
.
GetVipInfo
)
s
.
engine
.
Any
(
"/.handle_quick_operation"
,
s
.
HandleQuickOperation
)
s
.
engine
.
Any
(
"/.handle_quick_operation"
,
s
.
HandleQuickOperation
)
go
func
()
{
go
func
()
{
...
@@ -381,6 +384,11 @@ func (s *httpServer) GetVersionInfo(c *gin.Context) {
...
@@ -381,6 +384,11 @@ func (s *httpServer) GetVersionInfo(c *gin.Context) {
c
.
JSON
(
200
,
s
.
bot
.
CQGetVersionInfo
())
c
.
JSON
(
200
,
s
.
bot
.
CQGetVersionInfo
())
}
}
func
(
s
*
httpServer
)
GetVipInfo
(
c
*
gin
.
Context
)
{
uid
,
_
:=
strconv
.
ParseInt
(
getParam
(
c
,
"user_id"
),
10
,
64
)
c
.
JSON
(
200
,
s
.
bot
.
CQGetVipInfo
(
uid
))
}
func
(
s
*
httpServer
)
HandleQuickOperation
(
c
*
gin
.
Context
)
{
func
(
s
*
httpServer
)
HandleQuickOperation
(
c
*
gin
.
Context
)
{
if
c
.
Request
.
Method
!=
"POST"
{
if
c
.
Request
.
Method
!=
"POST"
{
c
.
AbortWithStatus
(
404
)
c
.
AbortWithStatus
(
404
)
...
...
server/websocket.go
View file @
b104b21a
...
@@ -506,6 +506,9 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
...
@@ -506,6 +506,9 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
"get_version_info"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
"get_version_info"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
return
bot
.
CQGetVersionInfo
()
return
bot
.
CQGetVersionInfo
()
},
},
"_get_vip_info"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
return
bot
.
CQGetVipInfo
(
p
.
Get
(
"user_id"
)
.
Int
())
},
".handle_quick_operation"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
".handle_quick_operation"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
return
bot
.
CQHandleQuickOperation
(
p
.
Get
(
"context"
),
p
.
Get
(
"operation"
))
return
bot
.
CQHandleQuickOperation
(
p
.
Get
(
"context"
),
p
.
Get
(
"operation"
))
},
},
...
...
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