telegram-bot-api-nodejs
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -628,2 +628,8 @@ export type ChatType = "private" | "group" | "supergroup" | "channel"; | ||
export declare const SUPPORTED_REACTION_EMOJI: string[]; | ||
export declare function isUnauthorizedError(err: unknown): err is Error; | ||
export declare function isBotBlockedByUserError(err: unknown): err is Error; | ||
export declare function isChatNotFoundError(err: unknown): err is Error; | ||
export declare function isUserDeactivatedError(err: unknown): err is Error; | ||
export declare function isBotKickedFromSupergroupError(err: unknown): err is Error; | ||
export declare function isNotEnoughRightsError(err: unknown): err is Error; | ||
export {}; |
18
index.js
@@ -490,1 +490,19 @@ /** | ||
]; | ||
export function isUnauthorizedError(err) { | ||
return err instanceof Error && err.message === "Unauthorized"; | ||
} | ||
export function isBotBlockedByUserError(err) { | ||
return err instanceof Error && err.message.includes("Forbidden: bot was blocked by the user"); | ||
} | ||
export function isChatNotFoundError(err) { | ||
return err instanceof Error && err.message.includes("Bad Request: chat not found"); | ||
} | ||
export function isUserDeactivatedError(err) { | ||
return err instanceof Error && err.message.includes("Forbidden: user is deactivated"); | ||
} | ||
export function isBotKickedFromSupergroupError(err) { | ||
return err instanceof Error && err.message.includes("Forbidden: bot was kicked from the supergroup chat"); | ||
} | ||
export function isNotEnoughRightsError(err) { | ||
return err instanceof Error && err.message.includes("Bad Request: not enough rights to send text messages to the chat"); | ||
} |
{ | ||
"name": "telegram-bot-api-nodejs", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Telegram Bot API client for nodejs", | ||
@@ -5,0 +5,0 @@ "type": "module", |
35956
1142