deps: bump github.com/iamxvbaba/td to v1.3.2
Matches upstream owpengram/owpengram-server's version. v1.3.2 collapses the old per-kind KeyboardButtonClass sum type (KeyboardButton, KeyboardButtonURL, KeyboardButtonCallback, KeyboardButtonRequestPeer, ...) into two unified structs mirroring Telegram's actual current MTProto layer: KeyboardButton (reply keyboards) and KeyboardInlineButton (inline keyboards), each carrying a Text/Style pair plus a Type field (ButtonTypeClass / InlineButtonTypeClass) that now holds what used to be the concrete Go type. Migrated the two call sites (internal/rpc/convert_markup.go, internal/rpc/bots_longtail.go) and their tests to the new shape. Behavior is unchanged -- every button kind (callback, url, url_auth, web_view, switch_inline, copy, request_phone, request_geo_location, request_poll, request_peer, simple_web_view) still round-trips the same domain fields, just read from/written to Type instead of the button's own concrete type. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
ecdb14aaca
commit
7fef8438c5
9 changed files with 166 additions and 174 deletions
|
|
@ -230,9 +230,9 @@ func TestBotInlineKeyboardCallbackFlow(t *testing.T) {
|
|||
return fmt.Errorf("bot getUsers(owner) = %d, want 1", len(got))
|
||||
}
|
||||
ownerSeen := got[0].(*tg.User)
|
||||
markup := &tg.ReplyInlineMarkup{Rows: []tg.KeyboardButtonRow{{Buttons: []tg.KeyboardButtonClass{
|
||||
&tg.KeyboardButtonCallback{Text: "Press", Data: callbackData},
|
||||
&tg.KeyboardButtonURL{Text: "Site", URL: "https://example.com/x"},
|
||||
markup := &tg.ReplyInlineMarkup{Rows: []tg.KeyboardInlineButtonRow{{Buttons: []tg.KeyboardInlineButton{
|
||||
{Text: "Press", Type: &tg.InlineButtonTypeCallback{Data: callbackData}},
|
||||
{Text: "Site", Type: &tg.InlineButtonTypeURL{URL: "https://example.com/x"}},
|
||||
}}}}
|
||||
req := &tg.MessagesSendMessageRequest{
|
||||
Peer: &tg.InputPeerUser{UserID: ownerSeen.ID, AccessHash: ownerSeen.AccessHash},
|
||||
|
|
@ -312,15 +312,15 @@ func TestBotInlineKeyboardCallbackFlow(t *testing.T) {
|
|||
if !ok || len(inline.Rows) != 1 || len(inline.Rows[0].Buttons) != 2 {
|
||||
t.Fatalf("unexpected markup shape: %#v", rm)
|
||||
}
|
||||
cbBtn, ok := inline.Rows[0].Buttons[0].(*tg.KeyboardButtonCallback)
|
||||
cbBtn, ok := inline.Rows[0].Buttons[0].Type.(*tg.InlineButtonTypeCallback)
|
||||
if !ok {
|
||||
t.Fatalf("first button not callback: %#v", inline.Rows[0].Buttons[0])
|
||||
t.Fatalf("first button not callback: %#v", inline.Rows[0].Buttons[0].Type)
|
||||
}
|
||||
if string(cbBtn.Data) != string(callbackData) {
|
||||
t.Fatalf("callback data round-trip mismatch: got %v want %v", cbBtn.Data, callbackData)
|
||||
}
|
||||
if _, ok := inline.Rows[0].Buttons[1].(*tg.KeyboardButtonURL); !ok {
|
||||
t.Fatalf("second button not url: %#v", inline.Rows[0].Buttons[1])
|
||||
if _, ok := inline.Rows[0].Buttons[1].Type.(*tg.InlineButtonTypeURL); !ok {
|
||||
t.Fatalf("second button not url: %#v", inline.Rows[0].Buttons[1].Type)
|
||||
}
|
||||
msgID = msg.ID
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue