From 6fe13e86055c53988385ce00c74d79b8d60f3665 Mon Sep 17 00:00:00 2001 From: eleksir Date: Sun, 6 Nov 2022 17:50:55 +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=20=D0=B2=20json=20?= =?UTF-8?q?message=20protocol?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aleesa-misc-lib.go | 3 +++ types.go | 30 ++++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/aleesa-misc-lib.go b/aleesa-misc-lib.go index 3151b15..f88972a 100644 --- a/aleesa-misc-lib.go +++ b/aleesa-misc-lib.go @@ -42,6 +42,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 @@ -193,6 +195,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 diff --git a/types.go b/types.go index 880c9cb..0edeced 100644 --- a/types.go +++ b/types.go @@ -19,13 +19,14 @@ type myConfig struct { // Входящее сообщение из 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,omitempty"` + 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"` @@ -38,13 +39,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"`