telegram-bot-api-nodejs 1.0.10 → 1.0.12

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 +12 -9
  2. package/index.js +2 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -84,6 +84,9 @@ interface PassportData {
84
84
  data: EncryptedPassportElement[];
85
85
  credentials: EncryptedCredentials;
86
86
  }
87
+ /**
88
+ * @docs https://core.telegram.org/bots/api#update
89
+ */
87
90
  export interface Update {
88
91
  update_id: number;
89
92
  message?: Message;
@@ -114,7 +117,7 @@ export interface User {
114
117
  last_name?: string;
115
118
  username?: string;
116
119
  language_code?: string;
117
- is_premium?: boolean;
120
+ is_premium: boolean;
118
121
  can_join_groups?: boolean;
119
122
  supports_inline_queries?: boolean;
120
123
  can_read_all_group_messages?: boolean;
@@ -127,6 +130,7 @@ export interface Chat {
127
130
  first_name?: string;
128
131
  last_name?: string;
129
132
  photo?: ChatPhoto;
133
+ bio?: string;
130
134
  description?: string;
131
135
  invite_link?: string;
132
136
  pinned_message?: Message;
@@ -134,6 +138,9 @@ export interface Chat {
134
138
  can_set_sticker_set?: boolean;
135
139
  sticker_set_name?: string;
136
140
  }
141
+ /**
142
+ * @docs https://core.telegram.org/bots/api#message
143
+ */
137
144
  export interface Message {
138
145
  message_id: number;
139
146
  from?: User;
@@ -241,6 +248,7 @@ interface FileBase {
241
248
  export interface PhotoSize extends FileBase {
242
249
  width: number;
243
250
  height: number;
251
+ file_unique_id: string;
244
252
  }
245
253
  export interface Audio extends FileBase {
246
254
  duration: number;
@@ -571,14 +579,7 @@ export declare function deleteMyCommands(token: string, payload: DeleteMyCommand
571
579
  */
572
580
  export declare function parseUpdate(update: any): Update;
573
581
  export declare function parseMessage(m: any): Message;
574
- export declare function parseUser(u: User): {
575
- id: string;
576
- is_bot: boolean;
577
- first_name: string;
578
- last_name: string;
579
- username: string;
580
- language_code: string;
581
- };
582
+ export declare function parseUser(u: User): User;
582
583
  export declare function parseChat(c: Chat): {
583
584
  id: number;
584
585
  type: ChatType;
@@ -589,12 +590,14 @@ export declare function parseChat(c: Chat): {
589
590
  };
590
591
  export declare function parsePhotoSizes(p: PhotoSize[]): {
591
592
  file_id: string;
593
+ file_unique_id: string;
592
594
  file_size: number;
593
595
  width: number;
594
596
  height: number;
595
597
  }[] | undefined;
596
598
  export declare function parsePhotoSize(p: PhotoSize): {
597
599
  file_id: string;
600
+ file_unique_id: string;
598
601
  file_size: number;
599
602
  width: number;
600
603
  height: number;
package/index.js CHANGED
@@ -234,6 +234,7 @@ export function parseUser(u) {
234
234
  last_name: String(u.last_name ?? ""),
235
235
  username: String(u.username ?? ""),
236
236
  language_code: String(u.language_code ?? ""),
237
+ is_premium: Boolean(u.is_premium ?? ""),
237
238
  };
238
239
  }
239
240
  export function parseChat(c) {
@@ -255,6 +256,7 @@ export function parsePhotoSizes(p) {
255
256
  export function parsePhotoSize(p) {
256
257
  return {
257
258
  file_id: String(p.file_id),
259
+ file_unique_id: String(p.file_unique_id),
258
260
  file_size: Number(p.file_size),
259
261
  width: Number(p.width),
260
262
  height: Number(p.height),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "telegram-bot-api-nodejs",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "Telegram Bot API client for nodejs",
5
5
  "type": "module",
6
6
  "main": "index.js",