Merge e9c69ff1df8c92bc6606ab64ec1b352b7a3fcc1b into 6b4c24c2e55b5b4013277bd799525086f6a0c40f

This commit is contained in:
w-sss 2026-03-21 12:41:31 +08:00 committed by GitHub
commit 496590d499
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -494,7 +494,20 @@ function createTelegramRequestWithDiag(params: {
}
function wrapTelegramChatNotFoundError(err: unknown, params: { chatId: string; input: string }) {
if (!CHAT_NOT_FOUND_RE.test(formatErrorMessage(err))) {
const errorMsg = formatErrorMessage(err);
// Check for 403 "bot is not a member" or "bot was blocked" errors
if (/403.*(bot.*not.*member|bot was blocked)/i.test(errorMsg)) {
return new Error(
[
`Telegram send failed: bot is not a member of the chat or was blocked (chat_id=${params.chatId}).`,
"Fix: Add the bot to the channel/group, or ensure it has not been removed/blocked by the user.",
`Input was: ${JSON.stringify(params.input)}.`,
].join(" "),
);
}
if (!CHAT_NOT_FOUND_RE.test(errorMsg)) {
return err;
}
return new Error(