Добавлена поддержка поля threadid
This commit is contained in:
@@ -24,13 +24,14 @@ import (
|
|||||||
|
|
||||||
// Входящее сообщение из 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"`
|
||||||
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"`
|
||||||
@@ -43,13 +44,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"`
|
||||||
@@ -319,6 +321,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
|
||||||
@@ -458,6 +462,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
|
||||||
|
|||||||
Reference in New Issue
Block a user