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
151e4462
Commit
151e4462
authored
Oct 27, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #376.
parent
d32f4273
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
26 deletions
+38
-26
coolq/api.go
coolq/api.go
+33
-19
coolq/bot.go
coolq/bot.go
+5
-7
No files found.
coolq/api.go
View file @
151e4462
...
...
@@ -384,29 +384,43 @@ 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
func
(
bot
*
CQBot
)
CQProcessGroupRequest
(
flag
,
subType
,
reason
string
,
approve
bool
)
MSG
{
msgs
,
err
:=
bot
.
Client
.
GetGroupSystemMessages
()
if
err
!=
nil
{
log
.
Errorf
(
"获取群系统消息失败: %v"
,
err
)
return
Failed
(
100
)
}
if
subType
==
"add"
{
req
,
ok
:=
bot
.
joinReqCache
.
Load
(
flag
)
if
!
ok
{
for
_
,
req
:=
range
msgs
.
JoinRequests
{
if
strconv
.
FormatInt
(
req
.
RequestId
,
10
)
==
flag
{
if
req
.
Checked
{
log
.
Errorf
(
"处理群系统消息失败: 无法操作已处理的消息."
)
return
Failed
(
100
)
}
bot
.
joinReqCache
.
Delete
(
flag
)
if
approve
{
req
.
(
*
client
.
UserJoinGroupRequest
)
.
Accept
()
req
.
Accept
()
}
else
{
req
.
(
*
client
.
UserJoinGroupRequest
)
.
Reject
(
false
,
reason
)
req
.
Reject
(
false
,
reason
)
}
return
OK
(
nil
)
}
req
,
ok
:=
bot
.
invitedReqCache
.
Load
(
flag
)
if
ok
{
bot
.
invitedReqCache
.
Delete
(
flag
)
}
}
else
{
for
_
,
req
:=
range
msgs
.
InvitedRequests
{
if
strconv
.
FormatInt
(
req
.
RequestId
,
10
)
==
flag
{
if
req
.
Checked
{
log
.
Errorf
(
"处理群系统消息失败: 无法操作已处理的消息."
)
return
Failed
(
100
)
}
if
approve
{
req
.
(
*
client
.
GroupInvitedRequest
)
.
Accept
()
req
.
Accept
()
}
else
{
req
.
(
*
client
.
GroupInvitedRequest
)
.
Reject
(
false
,
reason
)
req
.
Reject
(
false
,
reason
)
}
return
OK
(
nil
)
}
}
}
log
.
Errorf
(
"处理群系统消息失败: 消息 %v 不存在."
,
flag
)
return
Failed
(
100
)
}
...
...
coolq/bot.go
View file @
151e4462
...
...
@@ -26,8 +26,6 @@ type CQBot struct {
events
[]
func
(
MSG
)
db
*
leveldb
.
DB
friendReqCache
sync
.
Map
invitedReqCache
sync
.
Map
joinReqCache
sync
.
Map
tempMsgCache
sync
.
Map
oneWayMsgCache
sync
.
Map
}
...
...
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