REPOSITORY / ScuroNeko/Laniakea

Compare commits

DIFF REPOSITORY

Compare commits

...
Author SHA1 Message Date
ScuroNeko 5d3199dc21 fix(tgapi): accept string chat boost IDs 2026-03-25 18:20:20 +03:00
4 changed files with 32 additions and 5 deletions
+6 -1
View File
@@ -1,6 +1,11 @@
# Changelog
## Unreleased
## v1.0.0-rc.11
### Fixed
- `chat_boost` update decoding now accepts string `boost_id` values, matching the current Telegram Bot API schema and preventing polling failures on boosted-chat updates.
## v1.0.0-rc.10
### Added
- `Plugin.AddUpdateHandler` for routing non-command Telegram updates by `tgapi.UpdateType`.
+1 -1
View File
@@ -224,7 +224,7 @@ type ChatBoostSource struct {
// ChatBoost represents a boost added to a chat.
// See https://core.telegram.org/bots/api#chatboost
type ChatBoost struct {
BoostID int `json:"boost_id"`
BoostID string `json:"boost_id"`
AddDate int `json:"add_date"`
ExpirationDate int `json:"expiration_date"`
Source ChatBoostSource `json:"source"`
+23 -1
View File
@@ -37,9 +37,28 @@ func TestUpdateUnmarshalSetsType(t *testing.T) {
}`,
want: UpdateTypeCallbackQuery,
},
{
name: "chat boost",
body: `{
"update_id": 3,
"chat_boost": {
"chat": {"id": -1001, "type": "supergroup", "title": "Boosted"},
"boost": {
"boost_id": "boost-1",
"add_date": 1735689600,
"expiration_date": 1738291600,
"source": {
"source": "premium",
"user": {"id": 1, "is_bot": false, "first_name": "Test"}
}
}
}
}`,
want: UpdateTypeChatBoost,
},
{
name: "unknown",
body: `{"update_id":3}`,
body: `{"update_id":4}`,
want: UpdateTypeUnknown,
},
}
@@ -53,6 +72,9 @@ func TestUpdateUnmarshalSetsType(t *testing.T) {
if update.Type != tt.want {
t.Fatalf("unexpected update type: got %q want %q", update.Type, tt.want)
}
if tt.want == UpdateTypeChatBoost && update.ChatBoost.Boost.BoostID != "boost-1" {
t.Fatalf("unexpected boost id: got %q want %q", update.ChatBoost.Boost.BoostID, "boost-1")
}
})
}
}
+2 -2
View File
@@ -2,7 +2,7 @@ package utils
const (
// VersionString is the module version string.
VersionString = "1.0.0-rc.10"
VersionString = "1.0.0-rc.11"
// VersionMajor is the module major version.
VersionMajor = 1
// VersionMinor is the module minor version.
@@ -10,5 +10,5 @@ const (
// VersionPatch is the module patch version.
VersionPatch = 0
// VersionBeta is the prerelease counter for the current version.
VersionBeta = 10
VersionBeta = 11
)