fix: harden channel rights and sticker compatibility

Co-authored-by: HSgram <3013954224@qq.com>
This commit is contained in:
A 2026-07-01 22:28:24 +08:00
parent 6867d201ed
commit 599453a3c4
33 changed files with 1520 additions and 130 deletions

View file

@ -67,3 +67,37 @@ func TestTGChannelFullIncludesExportedInvite(t *testing.T) {
t.Fatalf("channelFull.exported_invite = %#v, want active permanent invite", invite)
}
}
func TestChannelBannedRightsRoundTripModernFields(t *testing.T) {
in := tg.ChatBannedRights{
ViewMessages: true,
SendMessages: true,
SendMedia: true,
SendStickers: true,
SendGifs: true,
SendGames: true,
SendInline: true,
EmbedLinks: true,
SendPolls: true,
ChangeInfo: true,
InviteUsers: true,
PinMessages: true,
ManageTopics: true,
SendPhotos: true,
SendVideos: true,
SendRoundvideos: true,
SendAudios: true,
SendVoices: true,
SendDocs: true,
SendPlain: true,
EditRank: true,
SendReactions: true,
UntilDate: 12345,
}
domainRights := domainChannelBannedRights(in)
out := tgChatBannedRights(domainRights)
if out != in {
t.Fatalf("banned rights round-trip = %+v, want %+v", out, in)
}
}