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
6a0f44f6
Commit
6a0f44f6
authored
Sep 06, 2020
by
wdvxdr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add _send_group_notice
parent
5501c619
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
coolq/api.go
coolq/api.go
+8
-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 @
6a0f44f6
...
@@ -304,6 +304,14 @@ func (bot *CQBot) CQSetGroupName(groupId int64, name string) MSG {
...
@@ -304,6 +304,14 @@ func (bot *CQBot) CQSetGroupName(groupId int64, name string) MSG {
return
Failed
(
100
)
return
Failed
(
100
)
}
}
func
(
bot
*
CQBot
)
CQSetGroupMemo
(
groupId
int64
,
msg
string
)
MSG
{
if
g
:=
bot
.
Client
.
FindGroup
(
groupId
);
g
!=
nil
{
g
.
UpdateMemo
(
msg
)
return
OK
(
nil
)
}
return
Failed
(
100
)
}
// https://cqhttp.cc/docs/4.15/#/API?id=set_group_kick-%E7%BE%A4%E7%BB%84%E8%B8%A2%E4%BA%BA
// https://cqhttp.cc/docs/4.15/#/API?id=set_group_kick-%E7%BE%A4%E7%BB%84%E8%B8%A2%E4%BA%BA
func
(
bot
*
CQBot
)
CQSetGroupKick
(
groupId
,
userId
int64
,
msg
string
)
MSG
{
func
(
bot
*
CQBot
)
CQSetGroupKick
(
groupId
,
userId
int64
,
msg
string
)
MSG
{
if
g
:=
bot
.
Client
.
FindGroup
(
groupId
);
g
!=
nil
{
if
g
:=
bot
.
Client
.
FindGroup
(
groupId
);
g
!=
nil
{
...
...
server/http.go
View file @
6a0f44f6
...
@@ -131,6 +131,9 @@ func (s *httpServer) Run(addr, authToken string, bot *coolq.CQBot) {
...
@@ -131,6 +131,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
(
"/_send_group_notice"
,
s
.
SendGroupNotice
)
s
.
engine
.
Any
(
"/_send_group_notice_async"
,
s
.
SendGroupNotice
)
s
.
engine
.
Any
(
"/set_group_leave"
,
s
.
SetGroupLeave
)
s
.
engine
.
Any
(
"/set_group_leave"
,
s
.
SetGroupLeave
)
s
.
engine
.
Any
(
"/set_group_leave_async"
,
s
.
SetGroupLeave
)
s
.
engine
.
Any
(
"/set_group_leave_async"
,
s
.
SetGroupLeave
)
...
@@ -353,6 +356,11 @@ func (s *httpServer) SetGroupName(c *gin.Context) {
...
@@ -353,6 +356,11 @@ func (s *httpServer) SetGroupName(c *gin.Context) {
c
.
JSON
(
200
,
s
.
bot
.
CQSetGroupName
(
gid
,
getParam
(
c
,
"group_name"
)))
c
.
JSON
(
200
,
s
.
bot
.
CQSetGroupName
(
gid
,
getParam
(
c
,
"group_name"
)))
}
}
func
(
s
*
httpServer
)
SendGroupNotice
(
c
*
gin
.
Context
)
{
gid
,
_
:=
strconv
.
ParseInt
(
getParam
(
c
,
"group_id"
),
10
,
64
)
c
.
JSON
(
200
,
s
.
bot
.
CQSetGroupMemo
(
gid
,
getParam
(
c
,
"content"
)))
}
func
(
s
*
httpServer
)
SetGroupLeave
(
c
*
gin
.
Context
)
{
func
(
s
*
httpServer
)
SetGroupLeave
(
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
.
CQSetGroupLeave
(
gid
))
c
.
JSON
(
200
,
s
.
bot
.
CQSetGroupLeave
(
gid
))
...
...
server/websocket.go
View file @
6a0f44f6
...
@@ -479,6 +479,9 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
...
@@ -479,6 +479,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
(
"group_name"
)
.
Str
)
return
bot
.
CQSetGroupName
(
p
.
Get
(
"group_id"
)
.
Int
(),
p
.
Get
(
"group_name"
)
.
Str
)
},
},
"_send_group_notice"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
return
bot
.
CQSetGroupMemo
(
p
.
Get
(
"group_id"
)
.
Int
(),
p
.
Get
(
"content"
)
.
Str
)
},
"set_group_leave"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
"set_group_leave"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
return
bot
.
CQSetGroupLeave
(
p
.
Get
(
"group_id"
)
.
Int
())
return
bot
.
CQSetGroupLeave
(
p
.
Get
(
"group_id"
)
.
Int
())
},
},
...
...
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