This commit is contained in:
shoopea 2019-05-06 13:43:04 +08:00
parent 27cad2827c
commit 09d786087e
2 changed files with 4 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import (
)
type ChatWarsMessage struct {
UserID64 int64 `json:"user_id"`
SenderUserID64 int64 `json:"sender_user_id"`
Date int32 `json:"date"`
ID64 int64 `json:"id"`

3
td.go
View File

@ -35,6 +35,7 @@ func ListenCW(c *tdlib.Client) {
t := time.Now()
m := ChatWarsMessage{
UserID64: ownUserID64,
SenderUserID64: int64(updateMsg.Message.SenderUserID),
Date: updateMsg.Message.Date,
ID64: updateMsg.Message.ID,
@ -112,6 +113,7 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
case tdlib.MessageTextType:
if msg.ForwardInfo == nil {
m = ChatWarsMessage{
UserID64: ownUserID64,
SenderUserID64: int64(msg.SenderUserID),
Date: msg.Date,
ID64: msg.ID,
@ -121,6 +123,7 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
} else {
if msg.ForwardInfo.GetMessageForwardInfoEnum() == tdlib.MessageForwardedFromUserType {
m = ChatWarsMessage{
UserID64: int64(msg.SenderUserID),
SenderUserID64: int64(msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).SenderUserID),
Date: msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).Date,
ID64: msg.ID,