diff --git a/def.go b/def.go index 51c9c69..3e36bbe 100644 --- a/def.go +++ b/def.go @@ -21,7 +21,7 @@ type TGCommand struct { type ChatWarsCallback struct { Name string `json:"name"` - Data string `json:"data"` + Data []byte `json:"data"` } type ChatWarsMessage struct { diff --git a/td.go b/td.go index 3f02f1c..d24b71b 100644 --- a/td.go +++ b/td.go @@ -77,7 +77,13 @@ func ListenTG(c *tdlib.Client) { rm := updateMsg.Message.ReplyMarkup.(*tdlib.ReplyMarkupInlineKeyboard) for k1, v1 := range rm.Rows { for k2, v2 := range v1 { - fmt.Printf("ReplyMarkupInlineKeyboard[%d][%d][%s] : %s\n", k1, k2, v2.Type.GetInlineKeyboardButtonTypeEnum(), v2.Text) + if v2.Type.GetInlineKeyboardButtonTypeEnum() == tdlib.InlineKeyboardButtonTypeCallbackType { + cwcb := ChatWarsCallback{ + Name: v2.Text, + Data: v2.(*tdlib.InlineKeyboardButtonTypeCallback).Data, + } + fmt.Printf("ReplyMarkupInlineKeyboard : %s => %s\n", cwcb.Name, string(cwcb.Data)) + } } } }