From 8a568d45a17e0aab69282402ec78e77bf7f549bb Mon Sep 17 00:00:00 2001 From: eleksir Date: Sun, 6 Nov 2022 17:34:12 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=B6=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BF=D0=BE=D0=BB=D1=8F=20threadid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aleesa-phrases.go | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/aleesa-phrases.go b/aleesa-phrases.go index db5eda5..7cffd34 100644 --- a/aleesa-phrases.go +++ b/aleesa-phrases.go @@ -24,13 +24,14 @@ import ( // Входящее сообщение из pubsub-канала redis-ки type rMsg struct { - From string `json:"from,omitempty"` - ChatID string `json:"chatid,omitempty"` - UserID string `json:"userid,omitempty"` - Message string `json:"message,omitempty"` - Plugin string `json:"plugin,omitempty"` - Mode string `json:"mode,omitempty"` - Misc struct { + From string `json:"from,omitempty"` + ChatID string `json:"chatid,omitempty"` + UserID string `json:"userid,omitempty"` + ThreadID string `json:"threadid"` + Message string `json:"message,omitempty"` + Plugin string `json:"plugin,omitempty"` + Mode string `json:"mode,omitempty"` + Misc struct { Answer int64 `json:"answer,omitempty"` BotNick string `json:"bot_nick,omitempty"` CSign string `json:"csign,omitempty"` @@ -43,13 +44,14 @@ type rMsg struct { // Исходящее сообщение в pubsub-канал redis-ки type sMsg struct { - From string `json:"from"` - ChatID string `json:"chatid"` - Userid string `json:"userid"` - Message string `json:"message"` - Plugin string `json:"plugin"` - Mode string `json:"mode"` - Misc struct { + From string `json:"from"` + ChatID string `json:"chatid"` + Userid string `json:"userid"` + ThreadID string `json:"threadid"` + Message string `json:"message"` + Plugin string `json:"plugin"` + Mode string `json:"mode"` + Misc struct { Answer int64 `json:"answer"` BotNick string `json:"bot_nick"` CSign string `json:"csign"` @@ -319,6 +321,8 @@ func msgParser(ctx context.Context, msg string) { return } + // j.ThreadID может быть пустым, это нормально + if exist := j.Message; exist == "" { log.Warnf("Incorrect msg from redis, no message field: %s", msg) return @@ -458,6 +462,7 @@ func msgParser(ctx context.Context, msg string) { message.From = j.From message.Userid = j.UserID message.ChatID = j.ChatID + message.ThreadID = j.ThreadID message.Message = j.Message message.Plugin = j.Plugin message.Mode = j.Mode