diff --git a/def.go b/def.go index f9c568e..9f6c231 100644 --- a/def.go +++ b/def.go @@ -19,19 +19,19 @@ type TGCommand struct { } type ChatWarsMessage struct { - UserID64 int64 `json:"user_id"` - SenderUserID64 int64 `json:"sender_user_id"` - Date time.Time `json:"date"` - ID64 int64 `json:"id"` - ChatID64 int64 `json:"chat_id"` - Text string `json:"text"` + TGUserID64 int64 `json:"tg_user_id"` + TGSenderUserID64 int64 `json:"tg_sender_user_id"` + Date time.Time `json:"date"` + ID64 int64 `json:"id"` + ChatID64 int64 `json:"chat_id"` + Text string `json:"text"` } type MQKeepAlive struct { - UserID64 int64 `json:"user_id"` - Nickname string `json:"nick"` - Queue string `json:"queue"` - Date time.Time `json:"date"` + TGUserID64 int64 `json:"tg_user_id"` + Nickname string `json:"nick"` + Queue string `json:"queue"` + Date time.Time `json:"date"` } const ( diff --git a/mq.go b/mq.go index 5ea4b7a..5801dce 100644 --- a/mq.go +++ b/mq.go @@ -116,10 +116,10 @@ func MQKeepAliveWorker() { for true { t := time.Now() m := MQKeepAlive{ - UserID64: ownUserID64, - Nickname: cfg.Rabbit.User, - Queue: cfg.Rabbit.ReceiveQueue, - Date: t, + TGUserID64: ownUserID64, + Nickname: cfg.Rabbit.User, + Queue: cfg.Rabbit.ReceiveQueue, + Date: t, } b, err := json.Marshal(m) if err != nil { diff --git a/td.go b/td.go index 0157c69..3e4a70c 100644 --- a/td.go +++ b/td.go @@ -52,11 +52,11 @@ func ListenMQ(c *tdlib.Client, msgs <-chan TGCommand) { txt := u.Content.(*tdlib.MessageText).Text.Text r := ChatWarsMessage{ - UserID64: ownUserID64, - SenderUserID64: int64(u.SenderUserID), - ID64: u.ID, - ChatID64: u.ChatID, - Text: txt, + TGUserID64: ownUserID64, + TGSenderUserID64: int64(u.SenderUserID), + ID64: u.ID, + ChatID64: u.ChatID, + Text: txt, } r.Date = time.Unix(int64(u.Date), 0) @@ -93,11 +93,11 @@ func ListenCW(c *tdlib.Client) { t := time.Now() m := ChatWarsMessage{ - UserID64: ownUserID64, - SenderUserID64: int64(updateMsg.Message.SenderUserID), - ID64: updateMsg.Message.ID, - ChatID64: updateMsg.Message.ChatID, - Text: txt, + TGUserID64: ownUserID64, + TgSenderUserID64: int64(updateMsg.Message.SenderUserID), + ID64: updateMsg.Message.ID, + ChatID64: updateMsg.Message.ChatID, + Text: txt, } m.Date = time.Unix(int64(updateMsg.Message.Date), 0) @@ -166,21 +166,21 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) { case tdlib.MessageTextType: if msg.ForwardInfo == nil { m = ChatWarsMessage{ - UserID64: ownUserID64, - SenderUserID64: int64(msg.SenderUserID), - ID64: msg.ID, - ChatID64: msg.ChatID, - Text: msg.Content.(*tdlib.MessageText).Text.Text, + TGUserID64: ownUserID64, + TGSenderUserID64: int64(msg.SenderUserID), + ID64: msg.ID, + ChatID64: msg.ChatID, + Text: msg.Content.(*tdlib.MessageText).Text.Text, } m.Date = time.Unix(int64(msg.Date), 0) } else { if msg.ForwardInfo.GetMessageForwardInfoEnum() == tdlib.MessageForwardedFromUserType { m = ChatWarsMessage{ - UserID64: int64(msg.SenderUserID), - SenderUserID64: int64(msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).SenderUserID), - ID64: msg.ID, - ChatID64: 0, - Text: msg.Content.(*tdlib.MessageText).Text.Text, + TGUserID64: int64(msg.SenderUserID), + TGSenderUserID64: int64(msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).SenderUserID), + ID64: msg.ID, + ChatID64: 0, + Text: msg.Content.(*tdlib.MessageText).Text.Text, } m.Date = time.Unix(int64(msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).Date), 0)