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
06e40a94
Commit
06e40a94
authored
Oct 13, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature: offline file event.
parent
95376a8a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
coolq/bot.go
coolq/bot.go
+1
-0
coolq/event.go
coolq/event.go
+20
-0
No files found.
coolq/bot.go
View file @
06e40a94
...
...
@@ -61,6 +61,7 @@ func NewQQBot(cli *client.QQClient, conf *global.JsonConfig) *CQBot {
bot
.
Client
.
OnGroupMessageRecalled
(
bot
.
groupRecallEvent
)
bot
.
Client
.
OnGroupNotify
(
bot
.
groupNotifyEvent
)
bot
.
Client
.
OnFriendMessageRecalled
(
bot
.
friendRecallEvent
)
bot
.
Client
.
OnReceivedOfflineFile
(
bot
.
offlineFileEvent
)
bot
.
Client
.
OnJoinGroup
(
bot
.
joinGroupEvent
)
bot
.
Client
.
OnLeaveGroup
(
bot
.
leaveGroupEvent
)
bot
.
Client
.
OnGroupMemberJoined
(
bot
.
memberJoinEvent
)
...
...
coolq/event.go
View file @
06e40a94
...
...
@@ -278,6 +278,26 @@ func (bot *CQBot) friendRecallEvent(c *client.QQClient, e *client.FriendMessageR
})
}
func
(
bot
*
CQBot
)
offlineFileEvent
(
c
*
client
.
QQClient
,
e
*
client
.
OfflineFileEvent
)
{
f
:=
c
.
FindFriend
(
e
.
Sender
)
if
f
==
nil
{
return
}
log
.
Infof
(
"好友 %v(%v) 发送了离线文件 %v"
,
f
.
Nickname
,
f
.
Uin
,
e
.
FileName
)
bot
.
dispatchEventMessage
(
MSG
{
"post_type"
:
"notice"
,
"notice_type"
:
"offline_file"
,
"user_id"
:
e
.
Sender
,
"file"
:
MSG
{
"name"
:
e
.
FileName
,
"size"
:
e
.
FileSize
,
"url"
:
e
.
DownloadUrl
,
},
"self_id"
:
c
.
Uin
,
"time"
:
time
.
Now
()
.
Unix
(),
})
}
func
(
bot
*
CQBot
)
joinGroupEvent
(
c
*
client
.
QQClient
,
group
*
client
.
GroupInfo
)
{
log
.
Infof
(
"Bot进入了群 %v."
,
formatGroupName
(
group
))
bot
.
dispatchEventMessage
(
bot
.
groupIncrease
(
group
.
Code
,
0
,
c
.
Uin
))
...
...
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