Skip to content

Commit 311ad68

Browse files
committed
fix(telegram): expand BOT_NOT_MEMBER_RE regex to match all chat types
Addresses review comment on PR #48296 The previous regex only matched 'channel chat' errors, but Telegram API returns different messages for different chat types: - Channels: 'bot is not a member of the channel chat' - Supergroups: 'bot is not a member of the supergroup chat' - Groups: 'bot is not a member of the group chat' or 'bot was kicked from the group chat' Updated regex to match all variants: /403:\s*Forbidden:\s*bot (?:is not a member|was kicked from the)/i This ensures consistent error handling across all chat types.
1 parent 2e47f9b commit 311ad68

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/telegram/send.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const THREAD_NOT_FOUND_RE = /400:\s*Bad Request:\s*message thread not found/i;
103103
const MESSAGE_NOT_MODIFIED_RE =
104104
/400:\s*Bad Request:\s*message is not modified|MESSAGE_NOT_MODIFIED/i;
105105
const CHAT_NOT_FOUND_RE = /400: Bad Request: chat not found/i;
106-
const BOT_NOT_MEMBER_RE = /403:\s*Forbidden:\s*bot is not a member of the channel chat/i;
106+
const BOT_NOT_MEMBER_RE = /403:\s*Forbidden:\s*bot (?:is not a member|was kicked from the)/i;
107107
const sendLogger = createSubsystemLogger("telegram/send");
108108
const diagLogger = createSubsystemLogger("telegram/diagnostic");
109109

0 commit comments

Comments
 (0)