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
cb959927
Commit
cb959927
authored
Aug 21, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update MiraiGo.
parent
322b70c6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
10 deletions
+9
-10
coolq/api.go
coolq/api.go
+4
-4
go.mod
go.mod
+1
-2
go.sum
go.sum
+2
-2
server/http.go
server/http.go
+1
-1
server/websocket.go
server/websocket.go
+1
-1
No files found.
coolq/api.go
View file @
cb959927
...
@@ -342,7 +342,7 @@ func (bot *CQBot) CQProcessFriendRequest(flag string, approve bool) MSG {
...
@@ -342,7 +342,7 @@ func (bot *CQBot) CQProcessFriendRequest(flag string, approve bool) MSG {
}
}
// https://cqhttp.cc/docs/4.15/#/API?id=set_group_add_request-%E5%A4%84%E7%90%86%E5%8A%A0%E7%BE%A4%E8%AF%B7%E6%B1%82%EF%BC%8F%E9%82%80%E8%AF%B7
// https://cqhttp.cc/docs/4.15/#/API?id=set_group_add_request-%E5%A4%84%E7%90%86%E5%8A%A0%E7%BE%A4%E8%AF%B7%E6%B1%82%EF%BC%8F%E9%82%80%E8%AF%B7
func
(
bot
*
CQBot
)
CQProcessGroupRequest
(
flag
,
subType
string
,
approve
bool
)
MSG
{
func
(
bot
*
CQBot
)
CQProcessGroupRequest
(
flag
,
subType
,
reason
string
,
approve
bool
)
MSG
{
if
subType
==
"add"
{
if
subType
==
"add"
{
req
,
ok
:=
bot
.
joinReqCache
.
Load
(
flag
)
req
,
ok
:=
bot
.
joinReqCache
.
Load
(
flag
)
if
!
ok
{
if
!
ok
{
...
@@ -352,7 +352,7 @@ func (bot *CQBot) CQProcessGroupRequest(flag, subType string, approve bool) MSG
...
@@ -352,7 +352,7 @@ func (bot *CQBot) CQProcessGroupRequest(flag, subType string, approve bool) MSG
if
approve
{
if
approve
{
req
.
(
*
client
.
UserJoinGroupRequest
)
.
Accept
()
req
.
(
*
client
.
UserJoinGroupRequest
)
.
Accept
()
}
else
{
}
else
{
req
.
(
*
client
.
UserJoinGroupRequest
)
.
Reject
()
req
.
(
*
client
.
UserJoinGroupRequest
)
.
Reject
(
false
,
reason
)
}
}
return
OK
(
nil
)
return
OK
(
nil
)
}
}
...
@@ -362,7 +362,7 @@ func (bot *CQBot) CQProcessGroupRequest(flag, subType string, approve bool) MSG
...
@@ -362,7 +362,7 @@ func (bot *CQBot) CQProcessGroupRequest(flag, subType string, approve bool) MSG
if
approve
{
if
approve
{
req
.
(
*
client
.
GroupInvitedRequest
)
.
Accept
()
req
.
(
*
client
.
GroupInvitedRequest
)
.
Accept
()
}
else
{
}
else
{
req
.
(
*
client
.
GroupInvitedRequest
)
.
Reject
()
req
.
(
*
client
.
GroupInvitedRequest
)
.
Reject
(
false
,
reason
)
}
}
return
OK
(
nil
)
return
OK
(
nil
)
}
}
...
@@ -485,7 +485,7 @@ func (bot *CQBot) CQHandleQuickOperation(context, operation gjson.Result) MSG {
...
@@ -485,7 +485,7 @@ func (bot *CQBot) CQHandleQuickOperation(context, operation gjson.Result) MSG {
bot
.
CQProcessFriendRequest
(
context
.
Get
(
"flag"
)
.
Str
,
operation
.
Get
(
"approve"
)
.
Bool
())
bot
.
CQProcessFriendRequest
(
context
.
Get
(
"flag"
)
.
Str
,
operation
.
Get
(
"approve"
)
.
Bool
())
}
}
if
reqType
==
"group"
{
if
reqType
==
"group"
{
bot
.
CQProcessGroupRequest
(
context
.
Get
(
"flag"
)
.
Str
,
context
.
Get
(
"sub_type"
)
.
Str
,
operation
.
Get
(
"approve"
)
.
Bool
())
bot
.
CQProcessGroupRequest
(
context
.
Get
(
"flag"
)
.
Str
,
context
.
Get
(
"sub_type"
)
.
Str
,
context
.
Get
(
"reason"
)
.
Str
,
operation
.
Get
(
"approve"
)
.
Bool
())
}
}
}
}
}
}
...
...
go.mod
View file @
cb959927
...
@@ -3,7 +3,7 @@ module github.com/Mrs4s/go-cqhttp
...
@@ -3,7 +3,7 @@ module github.com/Mrs4s/go-cqhttp
go 1.14
go 1.14
require (
require (
github.com/Mrs4s/MiraiGo v0.0.0-202008
19185537-8d1e5fb04c17
github.com/Mrs4s/MiraiGo v0.0.0-202008
21111822-80481f0022d5
github.com/gin-gonic/gin v1.6.3
github.com/gin-gonic/gin v1.6.3
github.com/gorilla/websocket v1.4.2
github.com/gorilla/websocket v1.4.2
github.com/guonaihong/gout v0.1.1
github.com/guonaihong/gout v0.1.1
...
@@ -15,6 +15,5 @@ require (
...
@@ -15,6 +15,5 @@ require (
github.com/tidwall/gjson v1.6.0
github.com/tidwall/gjson v1.6.0
github.com/xujiajun/nutsdb v0.5.0
github.com/xujiajun/nutsdb v0.5.0
github.com/yinghau76/go-ascii-art v0.0.0-20190517192627-e7f465a30189
github.com/yinghau76/go-ascii-art v0.0.0-20190517192627-e7f465a30189
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae // indirect
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae // indirect
)
)
go.sum
View file @
cb959927
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Mrs4s/MiraiGo v0.0.0-202008
19185537-8d1e5fb04c17 h1:sY4lwW34serGKnD26hP7ZLpnJ4NfVYKdS2SJIW1Mezs
=
github.com/Mrs4s/MiraiGo v0.0.0-202008
21111822-80481f0022d5 h1:50yz9Xgup7WgFAxeen/GQ0fCX3YUvv+ipGktZIznDuU
=
github.com/Mrs4s/MiraiGo v0.0.0-202008
19185537-8d1e5fb04c17
/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
github.com/Mrs4s/MiraiGo v0.0.0-202008
21111822-80481f0022d5
/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
...
...
server/http.go
View file @
cb959927
...
@@ -304,7 +304,7 @@ func (s *httpServer) ProcessGroupRequest(c *gin.Context) {
...
@@ -304,7 +304,7 @@ func (s *httpServer) ProcessGroupRequest(c *gin.Context) {
subType
=
getParam
(
c
,
"type"
)
subType
=
getParam
(
c
,
"type"
)
}
}
approve
:=
getParamOrDefault
(
c
,
"approve"
,
"true"
)
approve
:=
getParamOrDefault
(
c
,
"approve"
,
"true"
)
c
.
JSON
(
200
,
s
.
bot
.
CQProcessGroupRequest
(
flag
,
subType
,
approve
==
"true"
))
c
.
JSON
(
200
,
s
.
bot
.
CQProcessGroupRequest
(
flag
,
subType
,
getParam
(
c
,
"reason"
),
approve
==
"true"
))
}
}
func
(
s
*
httpServer
)
SetGroupCard
(
c
*
gin
.
Context
)
{
func
(
s
*
httpServer
)
SetGroupCard
(
c
*
gin
.
Context
)
{
...
...
server/websocket.go
View file @
cb959927
...
@@ -372,7 +372,7 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
...
@@ -372,7 +372,7 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
if
p
.
Get
(
"approve"
)
.
Exists
()
{
if
p
.
Get
(
"approve"
)
.
Exists
()
{
apr
=
p
.
Get
(
"approve"
)
.
Bool
()
apr
=
p
.
Get
(
"approve"
)
.
Bool
()
}
}
return
bot
.
CQProcessGroupRequest
(
p
.
Get
(
"flag"
)
.
Str
,
subType
,
apr
)
return
bot
.
CQProcessGroupRequest
(
p
.
Get
(
"flag"
)
.
Str
,
subType
,
p
.
Get
(
"reason"
)
.
Str
,
apr
)
},
},
"set_group_card"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
"set_group_card"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
return
bot
.
CQSetGroupCard
(
p
.
Get
(
"group_id"
)
.
Int
(),
p
.
Get
(
"user_id"
)
.
Int
(),
p
.
Get
(
"card"
)
.
Str
)
return
bot
.
CQSetGroupCard
(
p
.
Get
(
"group_id"
)
.
Int
(),
p
.
Get
(
"user_id"
)
.
Int
(),
p
.
Get
(
"card"
)
.
Str
)
...
...
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