From 4b119a0fe263d065ba40a6f11db15cae12660e19 Mon Sep 17 00:00:00 2001 From: Yiwen-Chan Date: Mon, 5 Apr 2021 22:20:10 +0800 Subject: [PATCH 1/2] fix IsToMe --- bot.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/bot.go b/bot.go index 20ae197..570848f 100644 --- a/bot.go +++ b/bot.go @@ -166,15 +166,22 @@ func preprocessMessageEvent(e *Event) { // preprocessNoticeEvent 更新事件 func preprocessNoticeEvent(e *Event) { switch e.NoticeType { - case "group_upload", "friend_add", "friend_recall": + case "group_upload", "friend_add", "friend_recall", "client_status", "offline_file": // - case "group_admin", "group_decrease", "group_increase", "group_ban", "group_recall", "honor": + case "group_admin", "group_decrease", "group_increase", "group_ban", "group_recall", "group_card", "essence": if e.UserID == e.SelfID { e.IsToMe = true } - case "poke", "lucky_king": - if e.TargetID == e.SelfID { - e.IsToMe = true + case "notify": + switch e.SubType { + case "honor": + if e.TargetID == e.SelfID { + e.IsToMe = true + } + case "poke", "lucky_king": + if e.TargetID == e.SelfID { + e.IsToMe = true + } } } } From e7f201237a284ec8a35d207df38ac7f18d7c739b Mon Sep 17 00:00:00 2001 From: Yiwen-Chan Date: Tue, 6 Apr 2021 23:16:45 +0800 Subject: [PATCH 2/2] fix IsToMe --- bot.go | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/bot.go b/bot.go index 570848f..bf9545d 100644 --- a/bot.go +++ b/bot.go @@ -165,24 +165,10 @@ func preprocessMessageEvent(e *Event) { // preprocessNoticeEvent 更新事件 func preprocessNoticeEvent(e *Event) { - switch e.NoticeType { - case "group_upload", "friend_add", "friend_recall", "client_status", "offline_file": - // - case "group_admin", "group_decrease", "group_increase", "group_ban", "group_recall", "group_card", "essence": - if e.UserID == e.SelfID { - e.IsToMe = true - } - case "notify": - switch e.SubType { - case "honor": - if e.TargetID == e.SelfID { - e.IsToMe = true - } - case "poke", "lucky_king": - if e.TargetID == e.SelfID { - e.IsToMe = true - } - } + if e.SubType == "poke" || e.SubType == "lucky_king" { + e.IsToMe = e.TargetID == e.SelfID + } else { + e.IsToMe = e.UserID == e.SelfID } }