telegram-bot-api-nodejs 1.2.2 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +20 -15
  2. package/index.js +5 -9
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -686,8 +686,12 @@ export interface ChatPermissions {
686
686
  }
687
687
  export interface Sticker {
688
688
  file_id: string;
689
+ file_unique_id: string;
690
+ type: "regular" | "mask" | "custom_emoji";
689
691
  width: number;
690
692
  height: number;
693
+ is_animated: boolean;
694
+ is_video: boolean;
691
695
  thumbnail?: PhotoSize;
692
696
  /** @deprecated */
693
697
  thumb?: PhotoSize;
@@ -1162,21 +1166,22 @@ export declare class TelegramError extends Error {
1162
1166
  */
1163
1167
  export declare function fetch(url: string, param?: RequestInit): Promise<Response>;
1164
1168
  export declare const SUPPORTED_REACTION_EMOJI: string[];
1165
- export declare function isUnauthorizedError(err: unknown): boolean;
1166
- export declare function isBotBlockedByUserError(err: unknown): boolean;
1167
- export declare function isChatNotFoundError(err: unknown): boolean;
1168
- export declare function isUserDeactivatedError(err: unknown): boolean;
1169
- export declare function isBotKickedFromSupergroupError(err: unknown): boolean;
1170
- export declare function isNotEnoughRightsError(err: unknown): boolean;
1171
- export declare function isUpgradeToSupergroupChatError(err: unknown): boolean;
1172
- export declare function isTextMustBeNonEmptyError(err: unknown): boolean;
1173
- export declare function isTooManyRequestsError(err: unknown): boolean;
1174
- export declare function isMessageTooLongError(err: unknown): boolean;
1175
- export declare function isMessageCaptionTooLongError(err: unknown): boolean;
1176
- export declare function isWebpageCurlFailedError(err: unknown): boolean;
1177
- export declare function isWrongFileUrlError(err: unknown): boolean;
1178
- export declare function isBadGatewayError(err: unknown): boolean;
1179
- export declare function isMessageToEditNotFoundError(err: unknown): boolean;
1169
+ export declare function isUnauthorizedError(err: unknown): err is Error;
1170
+ export declare function isBotBlockedByUserError(err: unknown): err is Error;
1171
+ export declare function isChatNotFoundError(err: unknown): err is Error;
1172
+ export declare function isUserDeactivatedError(err: unknown): err is Error;
1173
+ export declare function isBotKickedFromSupergroupError(err: unknown): err is Error;
1174
+ export declare function isBotKickedFromGroupError(err: unknown): err is Error;
1175
+ export declare function isNotEnoughRightsError(err: unknown): err is Error;
1176
+ export declare function isUpgradeToSupergroupChatError(err: unknown): err is Error;
1177
+ export declare function isTextMustBeNonEmptyError(err: unknown): err is Error;
1178
+ export declare function isTooManyRequestsError(err: unknown): err is Error;
1179
+ export declare function isMessageTooLongError(err: unknown): err is Error;
1180
+ export declare function isMessageCaptionTooLongError(err: unknown): err is Error;
1181
+ export declare function isWebpageCurlFailedError(err: unknown): err is Error;
1182
+ export declare function isWrongFileUrlError(err: unknown): err is Error;
1183
+ export declare function isBadGatewayError(err: unknown): err is Error;
1184
+ export declare function isMessageToEditNotFoundError(err: unknown): err is Error;
1180
1185
  export declare function isMessageToDeleteNotFoundError(err: unknown): boolean;
1181
1186
  export declare function isMessageNotModifiedError(err: unknown): boolean;
1182
1187
  export declare function isWrongTypeOfTheWebPageContentError(err: unknown): boolean;
package/index.js CHANGED
@@ -302,14 +302,7 @@ function parsePhotoSize(p) {
302
302
  };
303
303
  }
304
304
  function parseSticker(v) {
305
- return {
306
- file_id: String(v.file_id),
307
- width: Number(v.width),
308
- height: Number(v.height),
309
- thumb: v.thumb ? parsePhotoSize(v.thumb) : void 0,
310
- thumbnail: v.thumbnail ? parsePhotoSize(v.thumbnail) : void 0,
311
- emoji: String(v.emoji),
312
- };
305
+ return v;
313
306
  }
314
307
  function parseVideo(v) {
315
308
  return {
@@ -576,7 +569,10 @@ export function isUserDeactivatedError(err) {
576
569
  return err instanceof Error && err.message.includes("Forbidden: user is deactivated");
577
570
  }
578
571
  export function isBotKickedFromSupergroupError(err) {
579
- return err instanceof Error && err.message.includes("Forbidden: bot was kicked from the supergroup chat");
572
+ return err instanceof Error && err.message === "Forbidden: bot was kicked from the supergroup chat";
573
+ }
574
+ export function isBotKickedFromGroupError(err) {
575
+ return err instanceof Error && err.message === "Forbidden: bot was kicked from the group chat";
580
576
  }
581
577
  export function isNotEnoughRightsError(err) {
582
578
  return err instanceof Error && err.message.includes("Bad Request: not enough rights to send text messages to the chat");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "telegram-bot-api-nodejs",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Telegram Bot API client for nodejs",
5
5
  "type": "module",
6
6
  "main": "index.js",