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:
parent
1863c44d11
commit
4bcfe9b8f1
@ -126,6 +126,7 @@ func NewQQBot(cli *client.QQClient, conf *config.Config) *CQBot {
|
|||||||
bot.Client.OnGroupMessageRecalled(bot.groupRecallEvent)
|
bot.Client.OnGroupMessageRecalled(bot.groupRecallEvent)
|
||||||
bot.Client.OnGroupNotify(bot.groupNotifyEvent)
|
bot.Client.OnGroupNotify(bot.groupNotifyEvent)
|
||||||
bot.Client.OnFriendNotify(bot.friendNotifyEvent)
|
bot.Client.OnFriendNotify(bot.friendNotifyEvent)
|
||||||
|
bot.Client.OnMemberSpecialTitleUpdated(bot.memberTitleUpdatedEvent)
|
||||||
bot.Client.OnFriendMessageRecalled(bot.friendRecallEvent)
|
bot.Client.OnFriendMessageRecalled(bot.friendRecallEvent)
|
||||||
bot.Client.OnReceivedOfflineFile(bot.offlineFileEvent)
|
bot.Client.OnReceivedOfflineFile(bot.offlineFileEvent)
|
||||||
bot.Client.OnJoinGroup(bot.joinGroupEvent)
|
bot.Client.OnJoinGroup(bot.joinGroupEvent)
|
||||||
|
@ -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) {
|
func (bot *CQBot) friendRecallEvent(c *client.QQClient, e *client.FriendMessageRecalledEvent) {
|
||||||
f := c.FindFriend(e.FriendUin)
|
f := c.FindFriend(e.FriendUin)
|
||||||
gid := toGlobalID(e.FriendUin, e.MessageId)
|
gid := toGlobalID(e.FriendUin, e.MessageId)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user