1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-05 19:43:49 +08:00

feat: member special title updated event.

This commit is contained in:
Mrs4s 2021-08-09 06:17:12 +08:00
parent 1863c44d11
commit 4bcfe9b8f1
No known key found for this signature in database
GPG Key ID: 3186E98FA19CE3A7
2 changed files with 16 additions and 0 deletions

View File

@ -126,6 +126,7 @@ func NewQQBot(cli *client.QQClient, conf *config.Config) *CQBot {
bot.Client.OnGroupMessageRecalled(bot.groupRecallEvent)
bot.Client.OnGroupNotify(bot.groupNotifyEvent)
bot.Client.OnFriendNotify(bot.friendNotifyEvent)
bot.Client.OnMemberSpecialTitleUpdated(bot.memberTitleUpdatedEvent)
bot.Client.OnFriendMessageRecalled(bot.friendRecallEvent)
bot.Client.OnReceivedOfflineFile(bot.offlineFileEvent)
bot.Client.OnJoinGroup(bot.joinGroupEvent)

View File

@ -282,6 +282,21 @@ func (bot *CQBot) friendNotifyEvent(c *client.QQClient, e client.INotifyEvent) {
}
}
func (bot *CQBot) memberTitleUpdatedEvent(c *client.QQClient, e *client.MemberSpecialTitleUpdatedEvent) {
group := c.FindGroup(e.GroupCode)
mem := group.FindMember(e.Uin)
log.Infof("群 %v(%v) 内成员 %v(%v) 获得了新的头衔: %v", group.Name, group.Code, mem.DisplayName(), mem.Uin, e.NewTitle)
bot.dispatchEventMessage(MSG{
"post_type": "notice",
"notice_type": "notify",
"sub_type": "title",
"self_id": c.Uin,
"user_id": e.Uin,
"time": time.Now().Unix(),
"title": e.NewTitle,
})
}
func (bot *CQBot) friendRecallEvent(c *client.QQClient, e *client.FriendMessageRecalledEvent) {
f := c.FindFriend(e.FriendUin)
gid := toGlobalID(e.FriendUin, e.MessageId)