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
ae58d260
Commit
ae58d260
authored
Aug 10, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
supported event: friend_add.
parent
47cb3a52
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
9 deletions
+16
-9
coolq/bot.go
coolq/bot.go
+1
-0
coolq/event.go
coolq/event.go
+12
-0
go.mod
go.mod
+1
-1
go.sum
go.sum
+2
-8
No files found.
coolq/bot.go
View file @
ae58d260
...
@@ -60,6 +60,7 @@ func NewQQBot(cli *client.QQClient, conf *global.JsonConfig) *CQBot {
...
@@ -60,6 +60,7 @@ func NewQQBot(cli *client.QQClient, conf *global.JsonConfig) *CQBot {
bot
.
Client
.
OnGroupMemberLeaved
(
bot
.
memberLeaveEvent
)
bot
.
Client
.
OnGroupMemberLeaved
(
bot
.
memberLeaveEvent
)
bot
.
Client
.
OnGroupMemberPermissionChanged
(
bot
.
memberPermissionChangedEvent
)
bot
.
Client
.
OnGroupMemberPermissionChanged
(
bot
.
memberPermissionChangedEvent
)
bot
.
Client
.
OnNewFriendRequest
(
bot
.
friendRequestEvent
)
bot
.
Client
.
OnNewFriendRequest
(
bot
.
friendRequestEvent
)
bot
.
Client
.
OnNewFriendAdded
(
bot
.
friendAddedEvent
)
bot
.
Client
.
OnGroupInvited
(
bot
.
groupInvitedEvent
)
bot
.
Client
.
OnGroupInvited
(
bot
.
groupInvitedEvent
)
bot
.
Client
.
OnUserWantJoinGroup
(
bot
.
groupJoinReqEvent
)
bot
.
Client
.
OnUserWantJoinGroup
(
bot
.
groupJoinReqEvent
)
return
bot
return
bot
...
...
coolq/event.go
View file @
ae58d260
...
@@ -261,6 +261,18 @@ func (bot *CQBot) friendRequestEvent(c *client.QQClient, e *client.NewFriendRequ
...
@@ -261,6 +261,18 @@ func (bot *CQBot) friendRequestEvent(c *client.QQClient, e *client.NewFriendRequ
})
})
}
}
func
(
bot
*
CQBot
)
friendAddedEvent
(
c
*
client
.
QQClient
,
e
*
client
.
NewFriendEvent
)
{
log
.
Infof
(
"添加了新好友: %v(%v)"
,
e
.
Friend
.
Nickname
,
e
.
Friend
.
Uin
)
bot
.
tempMsgCache
.
Delete
(
e
.
Friend
.
Uin
)
bot
.
dispatchEventMessage
(
MSG
{
"post_type"
:
"notice"
,
"notice_type"
:
"friend_add"
,
"self_id"
:
c
.
Uin
,
"user_id"
:
e
.
Friend
.
Uin
,
"time"
:
time
.
Now
()
.
Unix
(),
})
}
func
(
bot
*
CQBot
)
groupInvitedEvent
(
c
*
client
.
QQClient
,
e
*
client
.
GroupInvitedRequest
)
{
func
(
bot
*
CQBot
)
groupInvitedEvent
(
c
*
client
.
QQClient
,
e
*
client
.
GroupInvitedRequest
)
{
log
.
Infof
(
"收到来自群 %v(%v) 内用户 %v(%v) 的加群邀请."
,
e
.
GroupName
,
e
.
GroupCode
,
e
.
InvitorNick
,
e
.
InvitorUin
)
log
.
Infof
(
"收到来自群 %v(%v) 内用户 %v(%v) 的加群邀请."
,
e
.
GroupName
,
e
.
GroupCode
,
e
.
InvitorNick
,
e
.
InvitorUin
)
flag
:=
strconv
.
FormatInt
(
e
.
RequestId
,
10
)
flag
:=
strconv
.
FormatInt
(
e
.
RequestId
,
10
)
...
...
go.mod
View file @
ae58d260
...
@@ -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-202008092
13751-626638e899eb
github.com/Mrs4s/MiraiGo v0.0.0-202008092
21224-7a84cfae6795
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 @
ae58d260
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-20200807030850-ed30f7ad5934 h1:LoNjIsnyEQFGP9IchIQ65yHRCfNKSru3BAOguRepkCM=
github.com/Mrs4s/MiraiGo v0.0.0-20200809221224-7a84cfae6795 h1:Bu4k9ZS/IIy9Shwd9lS/C2P/2I8fYUwg1OpRF91hr1w=
github.com/Mrs4s/MiraiGo v0.0.0-20200807030850-ed30f7ad5934/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
github.com/Mrs4s/MiraiGo v0.0.0-20200809221224-7a84cfae6795/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
github.com/Mrs4s/MiraiGo v0.0.0-20200808003732-2a32e623270d h1:K9jHdcO13mLqQB0xm0/ZlY852FoVQJ/WSDwfdmfhDlU=
github.com/Mrs4s/MiraiGo v0.0.0-20200808003732-2a32e623270d/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
github.com/Mrs4s/MiraiGo v0.0.0-20200808044635-cd20d7d43dbb h1:XLe/UreYJRT65GStA3+irRL1Ao0pHZwBtCmTc+4prwA=
github.com/Mrs4s/MiraiGo v0.0.0-20200808044635-cd20d7d43dbb/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
github.com/Mrs4s/MiraiGo v0.0.0-20200809213751-626638e899eb h1:Upu/wTiTri0hMotSR76APxFo5PQX76iD5nMfl2/Ykt4=
github.com/Mrs4s/MiraiGo v0.0.0-20200809213751-626638e899eb/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=
...
...
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