mirror of
https://github.com/BEARlogin/max-telegram-bridge-bot.git
synced 2026-07-09 17:18:37 +00:00
Some checks failed
Build / build (push) Has been cancelled
- MAX→TG album: caption over Telegram's 1024 media-group limit is no longer lost — the album is sent without an inline caption and the full text follows as a separate message (sendMaxAlbumToTg, covers both direct and queued delivery). - Forwarded text: strip Telegram custom_emoji (MAX can't render them; the fallback glyph only littered the copy) in tgEntitiesToHTML, and collapse whitespace padding (runs of spaces/nbsp, trailing spaces, 3+ blank lines) in crosspost captions — cuts bloated length (MAX ~4000 char limit) and fixes ugly gaps. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ajcn7YhgeexPwbfrUNMj8u
35 lines
1.2 KiB
Go
35 lines
1.2 KiB
Go
//go:build addon
|
||
|
||
package main
|
||
|
||
import "testing"
|
||
|
||
func TestIsUnforwardable_RecipientRestrictions(t *testing.T) {
|
||
// Пост СУЩЕСТВУЕТ, но не форвардится в скретч-ЛС (приватность получателя) —
|
||
// должен трактоваться как unforwardable (exists=true), а не как фатал/«поста нет».
|
||
unforwardable := []string{
|
||
"telegram: bad request, Bad Request: VOICE_MESSAGES_FORBIDDEN (400)",
|
||
"Bad Request: VIDEO_MESSAGES_FORBIDDEN (400)",
|
||
"Bad Request: CHAT_FORWARDS_RESTRICTED",
|
||
"message can't be copied",
|
||
"This message can't be forwarded",
|
||
}
|
||
for _, s := range unforwardable {
|
||
if !isUnforwardable(s) {
|
||
t.Errorf("isUnforwardable(%q) = false, want true", s)
|
||
}
|
||
if isAddonMsgGone(s) {
|
||
t.Errorf("isAddonMsgGone(%q) = true, want false (пост есть)", s)
|
||
}
|
||
}
|
||
// Реально отсутствующий пост — НЕ unforwardable, это «поста нет».
|
||
gone := []string{"Bad Request: message to forward not found", "MESSAGE_ID_INVALID"}
|
||
for _, s := range gone {
|
||
if isUnforwardable(s) {
|
||
t.Errorf("isUnforwardable(%q) = true, want false", s)
|
||
}
|
||
if !isAddonMsgGone(s) {
|
||
t.Errorf("isAddonMsgGone(%q) = false, want true", s)
|
||
}
|
||
}
|
||
}
|