diff --git a/def.go b/def.go index 23b0d1f..1db0463 100644 --- a/def.go +++ b/def.go @@ -17,6 +17,8 @@ type TGCommand struct { Document tb.Document `json:"document"` ParseMode int64 `json:"parse_mode"` Delay time.Duration `json:"delay"` + CallbackName string `json:"callback_name"` + CallbackData []byte `json:"callback_data"` } type ChatWarsCallback struct { @@ -50,6 +52,7 @@ const ( commandDeleteMsg = 4 commandRefreshMsg = 5 commandSendDocument = 6 + commandCallback = 7 cmdParseModePlain = 1 cmdParseModeMarkDown = 2 diff --git a/td.go b/td.go index 2359159..4d1d281 100644 --- a/td.go +++ b/td.go @@ -295,8 +295,16 @@ func clientMsg(c *tdlib.Client, m TGCommand) { MQCWMsgQueue <- r } + case commandCallback: + p := CallbackQueryPayloadData{ + Data: m.CallbackData, + } + a, err := c.GetCallbackQueryAnswer(m.FromChatID64, m.FromMsgID64, p) + logOnError(err, "clientMsg : GetCallbackQueryAnswer") + b, _ := json.Marshal(a) + log.Printf("GetCallbackQueryAnswer :\n%s\n", string(b)) default: - log.Printf("ListenMQ : No handler for command %d.\n", m.Type) + log.Printf("clientMsg : No handler for command %d.\n", m.Type) } }