direction

This commit is contained in:
shoopea 2019-05-03 15:55:02 +08:00
parent 01a786d015
commit 0a49c2a26b

10
main.go
View File

@ -16,14 +16,14 @@ import (
type MsgDirection string type MsgDirection string
const ( const (
Incoming MsgDirection = `incoming` MsgIncoming string = `incoming`
Outgoing MsgDirection = `outgoing` MsgOutgoing string = `outgoing`
) )
type ChatWarsMessage struct { type ChatWarsMessage struct {
MsgID64 int64 `json:"msg_id"` MsgID64 int64 `json:"msg_id"`
UserID64 int64 `json:"user_id"` UserID64 int64 `json:"user_id"`
Direction MsgDirection `json:"direction"` Direction string `json:"direction"`
MsgText string `json:"msg"` MsgText string `json:"msg"`
MsgDate int32 `json:"date"` MsgDate int32 `json:"date"`
} }
@ -180,9 +180,9 @@ func ListenCW(c *tdlib.Client) {
MsgID64: updateMsg.Message.ID, MsgID64: updateMsg.Message.ID,
} }
if senderUserID == ownUserID32 { if senderUserID == ownUserID32 {
m.Direction = Outgoing m.Direction = MsgOutgoing
} else { } else {
m.Direction = Incoming m.Direction = MsgIncoming
} }
b, err := json.Marshal(m) b, err := json.Marshal(m)