This commit is contained in:
shoopea 2019-06-11 09:49:16 +08:00
parent 9ae3c17cbd
commit 4ec1eb5f9b
2 changed files with 20 additions and 12 deletions

31
def.go
View File

@ -5,13 +5,15 @@ import (
)
type TGCommand struct {
Type int64 `json:"type"`
FromChatID64 int64 `json:"from_chat_id"`
FromUserID64 int64 `json:"from_user_id"`
FromMsgID64 int64 `json:"from_msg_id"`
ToChatID64 int64 `json:"to_chat_id"`
ToUserID64 int64 `json:"to_user_id"`
Text string `json:"text"`
Type int64 `json:"type"`
FromChatID64 int64 `json:"from_chat_id"`
FromUserID64 int64 `json:"from_user_id"`
FromMsgID64 int64 `json:"from_msg_id"`
ToChatID64 int64 `json:"to_chat_id"`
ToUserID64 int64 `json:"to_user_id"`
Text string `json:"text"`
Document tb.Document `json:"document"`
ParseMode int64 `json:"parse_mode"`
}
type ChatWarsMessage struct {
@ -31,9 +33,14 @@ type MQKeepAlive struct {
}
const (
commandForwardMsg = 1
commandReplyMsg = 2
commandSendMsg = 3
commandDeleteMsg = 4
commandRefreshMsg = 5
commandForwardMsg = 1
commandReplyMsg = 2
commandSendMsg = 3
commandDeleteMsg = 4
commandRefreshMsg = 5
commandSendDocument = 6
cmdParseModePlain = 1
cmdParseModeMarkDown = 2
cmdParseModeHTML = 3
)

1
td.go
View File

@ -48,6 +48,7 @@ func ListenMQ(c *tdlib.Client, msgs <-chan TGCommand) {
case commandRefreshMsg:
u, err := c.GetMessage(m.FromChatID64, m.FromMsgID64)
logOnError(err, "ListenMQ : commandRefreshMsg")
log.Printf("ListenMQ : commandRefreshMsg (%d - %d)\n", m.FromChatID64, m.FromMsgID64)
if err != nil && u.Content.GetMessageContentEnum() == tdlib.MessageTextType {
txt := u.Content.(*tdlib.MessageText).Text.Text