Добавлена поддержка поля threadid в json message protocol
This commit is contained in:
@@ -42,6 +42,8 @@ func msgParser(ctx context.Context, msg string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// j.Threadid может быит пустымб значит либо нам его не дали, либо дали пустым. Это нормально.
|
||||||
|
|
||||||
if exist := j.Message; exist == "" {
|
if exist := j.Message; exist == "" {
|
||||||
log.Warnf("Incorrect msg from redis, no message field: %s", msg)
|
log.Warnf("Incorrect msg from redis, no message field: %s", msg)
|
||||||
return
|
return
|
||||||
@@ -193,6 +195,7 @@ func msgParser(ctx context.Context, msg string) {
|
|||||||
message.From = j.From
|
message.From = j.From
|
||||||
message.Userid = j.Userid
|
message.Userid = j.Userid
|
||||||
message.Chatid = j.Chatid
|
message.Chatid = j.Chatid
|
||||||
|
message.Threadid = j.Threadid
|
||||||
message.Message = j.Message
|
message.Message = j.Message
|
||||||
message.Plugin = j.Plugin
|
message.Plugin = j.Plugin
|
||||||
message.Mode = j.Mode
|
message.Mode = j.Mode
|
||||||
|
|||||||
30
types.go
30
types.go
@@ -19,13 +19,14 @@ type myConfig struct {
|
|||||||
|
|
||||||
// Входящее сообщение из pubsub-канала redis-ки
|
// Входящее сообщение из pubsub-канала redis-ки
|
||||||
type rMsg struct {
|
type rMsg struct {
|
||||||
From string `json:"from,omitempty"`
|
From string `json:"from,omitempty"`
|
||||||
Chatid string `json:"chatid,omitempty"`
|
Chatid string `json:"chatid,omitempty"`
|
||||||
Userid string `json:"userid,omitempty"`
|
Userid string `json:"userid,omitempty"`
|
||||||
Message string `json:"message,omitempty"`
|
Threadid string `json:"threadid,omitempty"`
|
||||||
Plugin string `json:"plugin,omitempty"`
|
Message string `json:"message,omitempty"`
|
||||||
Mode string `json:"mode,omitempty"`
|
Plugin string `json:"plugin,omitempty"`
|
||||||
Misc struct {
|
Mode string `json:"mode,omitempty"`
|
||||||
|
Misc struct {
|
||||||
Answer int64 `json:"answer,omitempty"`
|
Answer int64 `json:"answer,omitempty"`
|
||||||
Botnick string `json:"bot_nick,omitempty"`
|
Botnick string `json:"bot_nick,omitempty"`
|
||||||
Csign string `json:"csign,omitempty"`
|
Csign string `json:"csign,omitempty"`
|
||||||
@@ -38,13 +39,14 @@ type rMsg struct {
|
|||||||
|
|
||||||
// Исходящее сообщение в pubsub-канал redis-ки
|
// Исходящее сообщение в pubsub-канал redis-ки
|
||||||
type sMsg struct {
|
type sMsg struct {
|
||||||
From string `json:"from"`
|
From string `json:"from"`
|
||||||
Chatid string `json:"chatid"`
|
Chatid string `json:"chatid"`
|
||||||
Userid string `json:"userid"`
|
Userid string `json:"userid"`
|
||||||
Message string `json:"message"`
|
Threadid string `json:"threadid"`
|
||||||
Plugin string `json:"plugin"`
|
Message string `json:"message"`
|
||||||
Mode string `json:"mode"`
|
Plugin string `json:"plugin"`
|
||||||
Misc struct {
|
Mode string `json:"mode"`
|
||||||
|
Misc struct {
|
||||||
Answer int64 `json:"answer"`
|
Answer int64 `json:"answer"`
|
||||||
Botnick string `json:"bot_nick"`
|
Botnick string `json:"bot_nick"`
|
||||||
Csign string `json:"csign"`
|
Csign string `json:"csign"`
|
||||||
|
|||||||
Reference in New Issue
Block a user