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
3bb844d1
Commit
3bb844d1
authored
Jul 31, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support group quit.
parent
0fdb01e8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
1 deletion
+24
-1
README.md
README.md
+1
-0
coolq/api.go
coolq/api.go
+9
-0
go.mod
go.mod
+1
-1
go.sum
go.sum
+2
-0
server/http.go
server/http.go
+8
-0
server/websocket.go
server/websocket.go
+3
-0
No files found.
README.md
View file @
3bb844d1
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
| /set_group_kick |
[
群组T人
](
https://cqhttp.cc/docs/4.15/#/API?id=set_group_kick-群组踢人
)
|
| /set_group_kick |
[
群组T人
](
https://cqhttp.cc/docs/4.15/#/API?id=set_group_kick-群组踢人
)
|
| /set_group_ban |
[
群组单人禁言
](
https://cqhttp.cc/docs/4.15/#/API?id=set_group_ban-群组单人禁言
)
|
| /set_group_ban |
[
群组单人禁言
](
https://cqhttp.cc/docs/4.15/#/API?id=set_group_ban-群组单人禁言
)
|
| /set_group_whole_ban |
[
群组全员禁言
](
https://cqhttp.cc/docs/4.15/#/API?id=set_group_whole_ban-群组全员禁言
)
|
| /set_group_whole_ban |
[
群组全员禁言
](
https://cqhttp.cc/docs/4.15/#/API?id=set_group_whole_ban-群组全员禁言
)
|
| /set_group_leave |
[
退出群组
](
https://cqhttp.cc/docs/4.15/#/API?id=set_group_leave-退出群组
)
|
| /set_group_name | 设置群组名(拓展API) |
| /set_group_name | 设置群组名(拓展API) |
| /get_image | 获取图片信息(拓展API) |
| /get_image | 获取图片信息(拓展API) |
| /get_group_msg | 获取群组消息(拓展API) |
| /get_group_msg | 获取群组消息(拓展API) |
...
...
coolq/api.go
View file @
3bb844d1
...
@@ -273,6 +273,15 @@ func (bot *CQBot) CQSetGroupWholeBan(groupId int64, enable bool) MSG {
...
@@ -273,6 +273,15 @@ func (bot *CQBot) CQSetGroupWholeBan(groupId int64, enable bool) MSG {
return
Failed
(
100
)
return
Failed
(
100
)
}
}
// https://cqhttp.cc/docs/4.15/#/API?id=set_group_leave-%E9%80%80%E5%87%BA%E7%BE%A4%E7%BB%84
func
(
bot
*
CQBot
)
CQSetGroupLeave
(
groupId
int64
)
MSG
{
if
g
:=
bot
.
Client
.
FindGroup
(
groupId
);
g
!=
nil
{
g
.
Quit
()
return
OK
(
nil
)
}
return
Failed
(
100
)
}
// https://cqhttp.cc/docs/4.15/#/API?id=set_friend_add_request-%E5%A4%84%E7%90%86%E5%8A%A0%E5%A5%BD%E5%8F%8B%E8%AF%B7%E6%B1%82
// https://cqhttp.cc/docs/4.15/#/API?id=set_friend_add_request-%E5%A4%84%E7%90%86%E5%8A%A0%E5%A5%BD%E5%8F%8B%E8%AF%B7%E6%B1%82
func
(
bot
*
CQBot
)
CQProcessFriendRequest
(
flag
string
,
approve
bool
)
MSG
{
func
(
bot
*
CQBot
)
CQProcessFriendRequest
(
flag
string
,
approve
bool
)
MSG
{
req
,
ok
:=
bot
.
friendReqCache
.
Load
(
flag
)
req
,
ok
:=
bot
.
friendReqCache
.
Load
(
flag
)
...
...
go.mod
View file @
3bb844d1
...
@@ -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-2020073
0171208-f076f2a45730
github.com/Mrs4s/MiraiGo v0.0.0-2020073
1043935-dbb4073480bb
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
...
...
go.sum
View file @
3bb844d1
...
@@ -4,6 +4,8 @@ github.com/Mrs4s/MiraiGo v0.0.0-20200730113850-298c1bb9119f h1:+MW9qbGu9uWJc9vs6
...
@@ -4,6 +4,8 @@ github.com/Mrs4s/MiraiGo v0.0.0-20200730113850-298c1bb9119f h1:+MW9qbGu9uWJc9vs6
github.com/Mrs4s/MiraiGo v0.0.0-20200730113850-298c1bb9119f/go.mod h1:M9wh1hjd0rie3+wm27tjPZkYMbD+MBV76CGqp2G7WSU=
github.com/Mrs4s/MiraiGo v0.0.0-20200730113850-298c1bb9119f/go.mod h1:M9wh1hjd0rie3+wm27tjPZkYMbD+MBV76CGqp2G7WSU=
github.com/Mrs4s/MiraiGo v0.0.0-20200730171208-f076f2a45730 h1:ZQoh1RyCacWyyJV9+MO9S+kJ5HOQOaA9PLBEGBbL3oA=
github.com/Mrs4s/MiraiGo v0.0.0-20200730171208-f076f2a45730 h1:ZQoh1RyCacWyyJV9+MO9S+kJ5HOQOaA9PLBEGBbL3oA=
github.com/Mrs4s/MiraiGo v0.0.0-20200730171208-f076f2a45730/go.mod h1:M9wh1hjd0rie3+wm27tjPZkYMbD+MBV76CGqp2G7WSU=
github.com/Mrs4s/MiraiGo v0.0.0-20200730171208-f076f2a45730/go.mod h1:M9wh1hjd0rie3+wm27tjPZkYMbD+MBV76CGqp2G7WSU=
github.com/Mrs4s/MiraiGo v0.0.0-20200731043935-dbb4073480bb h1:L40i56EyeItfy5SN/TRtZL/aLtMDoFIjTTefJBhgU6E=
github.com/Mrs4s/MiraiGo v0.0.0-20200731043935-dbb4073480bb/go.mod h1:M9wh1hjd0rie3+wm27tjPZkYMbD+MBV76CGqp2G7WSU=
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 @
3bb844d1
...
@@ -127,6 +127,9 @@ func (s *httpServer) Run(addr, authToken string, bot *coolq.CQBot) {
...
@@ -127,6 +127,9 @@ func (s *httpServer) Run(addr, authToken string, bot *coolq.CQBot) {
s
.
engine
.
Any
(
"/set_group_name"
,
s
.
SetGroupName
)
s
.
engine
.
Any
(
"/set_group_name"
,
s
.
SetGroupName
)
s
.
engine
.
Any
(
"/set_group_name_async"
,
s
.
SetGroupName
)
s
.
engine
.
Any
(
"/set_group_name_async"
,
s
.
SetGroupName
)
s
.
engine
.
Any
(
"/set_group_leave"
,
s
.
SetGroupLeave
)
s
.
engine
.
Any
(
"/set_group_leave_async"
,
s
.
SetGroupLeave
)
s
.
engine
.
Any
(
"/get_image"
,
s
.
GetImage
)
s
.
engine
.
Any
(
"/get_image"
,
s
.
GetImage
)
s
.
engine
.
Any
(
"/get_image_async"
,
s
.
GetImage
)
s
.
engine
.
Any
(
"/get_image_async"
,
s
.
GetImage
)
...
@@ -317,6 +320,11 @@ func (s *httpServer) SetGroupName(c *gin.Context) {
...
@@ -317,6 +320,11 @@ func (s *httpServer) SetGroupName(c *gin.Context) {
c
.
JSON
(
200
,
s
.
bot
.
CQSetGroupName
(
gid
,
getParam
(
c
,
"name"
)))
c
.
JSON
(
200
,
s
.
bot
.
CQSetGroupName
(
gid
,
getParam
(
c
,
"name"
)))
}
}
func
(
s
*
httpServer
)
SetGroupLeave
(
c
*
gin
.
Context
)
{
gid
,
_
:=
strconv
.
ParseInt
(
getParam
(
c
,
"group_id"
),
10
,
64
)
c
.
JSON
(
200
,
s
.
bot
.
CQSetGroupLeave
(
gid
))
}
func
(
s
*
httpServer
)
GetForwardMessage
(
c
*
gin
.
Context
)
{
func
(
s
*
httpServer
)
GetForwardMessage
(
c
*
gin
.
Context
)
{
resId
:=
getParam
(
c
,
"message_id"
)
resId
:=
getParam
(
c
,
"message_id"
)
c
.
JSON
(
200
,
s
.
bot
.
CQGetForwardMessage
(
resId
))
c
.
JSON
(
200
,
s
.
bot
.
CQGetForwardMessage
(
resId
))
...
...
server/websocket.go
View file @
3bb844d1
...
@@ -393,6 +393,9 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
...
@@ -393,6 +393,9 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
"set_group_name"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
"set_group_name"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
return
bot
.
CQSetGroupName
(
p
.
Get
(
"group_id"
)
.
Int
(),
p
.
Get
(
"name"
)
.
Str
)
return
bot
.
CQSetGroupName
(
p
.
Get
(
"group_id"
)
.
Int
(),
p
.
Get
(
"name"
)
.
Str
)
},
},
"set_group_leave"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
return
bot
.
CQSetGroupLeave
(
p
.
Get
(
"group_id"
)
.
Int
())
},
"get_image"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
"get_image"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
return
bot
.
CQGetImage
(
p
.
Get
(
"file"
)
.
Str
)
return
bot
.
CQGetImage
(
p
.
Get
(
"file"
)
.
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