This commit is contained in:
shoopea 2019-12-12 11:34:02 +08:00
parent 8c1cb7713a
commit 470291f764
2 changed files with 8 additions and 2 deletions

2
def.go
View File

@ -21,7 +21,7 @@ type TGCommand struct {
type ChatWarsCallback struct { type ChatWarsCallback struct {
Name string `json:"name"` Name string `json:"name"`
Data string `json:"data"` Data []byte `json:"data"`
} }
type ChatWarsMessage struct { type ChatWarsMessage struct {

8
td.go
View File

@ -77,7 +77,13 @@ func ListenTG(c *tdlib.Client) {
rm := updateMsg.Message.ReplyMarkup.(*tdlib.ReplyMarkupInlineKeyboard) rm := updateMsg.Message.ReplyMarkup.(*tdlib.ReplyMarkupInlineKeyboard)
for k1, v1 := range rm.Rows { for k1, v1 := range rm.Rows {
for k2, v2 := range v1 { 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))
}
} }
} }
} }