@telegram.ts/types 1.15.0 → 1.16.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telegram.ts/types",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "description": "Comprehensive Type Declarations for Telegram Bot API with telegramsjs",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "api",
12
12
  "types"
13
13
  ],
14
- "homepage": "https://telegramsjs.vercel.app/",
14
+ "homepage": "https://docs-telegramsjs.vercel.app/",
15
15
  "license": "MIT",
16
16
  "bugs": {
17
17
  "url": "https://github.com/telegramsjs/types/issues"
@@ -1,9 +1,10 @@
1
1
  import type { ReadStream } from "node:fs";
2
2
  import type { Buffer } from "node:buffer";
3
+ import type { LanguageCode } from "./languageTypes";
3
4
  import type {
4
5
  InlineQueryResult,
5
6
  InlineQueryResultsButton,
6
- } from "./inlineTypes.ts";
7
+ } from "./inlineTypes";
7
8
  import type {
8
9
  BotCommand,
9
10
  BusinessConnection,
@@ -19,13 +20,13 @@ import type {
19
20
  UserFromGetMe,
20
21
  UserProfilePhotos,
21
22
  WebhookInfo,
22
- } from "./manageTypes.ts";
23
+ } from "./manageTypes";
23
24
  import type {
24
25
  ForceReply,
25
26
  InlineKeyboardMarkup,
26
27
  ReplyKeyboardMarkup,
27
28
  ReplyKeyboardRemove,
28
- } from "./markupTypes.ts";
29
+ } from "./markupTypes";
29
30
  import type {
30
31
  File,
31
32
  GameHighScore,
@@ -42,21 +43,21 @@ import type {
42
43
  SentWebAppMessage,
43
44
  Sticker,
44
45
  StickerSet,
45
- } from "./messageTypes.ts";
46
- import type { PassportElementError } from "./passportTypes.ts";
46
+ } from "./messageTypes";
47
+ import type { PassportElementError } from "./passportTypes";
47
48
  import type {
48
49
  LabeledPrice,
49
50
  ShippingOption,
50
51
  StarTransactions,
51
- } from "./invoiceTypes.ts";
52
+ } from "./invoiceTypes";
52
53
  import type {
53
54
  BotCommandScope,
54
55
  BotDescription,
55
56
  BotName,
56
57
  BotShortDescription,
57
58
  MenuButton,
58
- } from "./botCommandTypes.ts";
59
- import type { Update } from "./updateTypes.ts";
59
+ } from "./botCommandTypes";
60
+ import type { Update } from "./updateTypes";
60
61
 
61
62
  /** Wrapper type to bundle all methods of the Telegram Bot API */
62
63
  export type ApiMethods = {
@@ -1296,7 +1297,7 @@ export type ApiMethods = {
1296
1297
  /** An object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault. */
1297
1298
  scope?: BotCommandScope;
1298
1299
  /** A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands */
1299
- language_code?: string;
1300
+ language_code?: LanguageCode;
1300
1301
  }): true;
1301
1302
 
1302
1303
  /** Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success. */
@@ -1304,7 +1305,7 @@ export type ApiMethods = {
1304
1305
  /** An object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault. */
1305
1306
  scope?: BotCommandScope;
1306
1307
  /** A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands */
1307
- language_code?: string;
1308
+ language_code?: LanguageCode;
1308
1309
  }): true;
1309
1310
 
1310
1311
  /** Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned. */
@@ -1312,7 +1313,7 @@ export type ApiMethods = {
1312
1313
  /** An object, describing scope of users. Defaults to BotCommandScopeDefault. */
1313
1314
  scope?: BotCommandScope;
1314
1315
  /** A two-letter ISO 639-1 language code or an empty string */
1315
- language_code?: string;
1316
+ language_code?: LanguageCode;
1316
1317
  }): BotCommand[];
1317
1318
 
1318
1319
  /** Use this method to change the bot's name. Returns True on success. */
@@ -1320,13 +1321,13 @@ export type ApiMethods = {
1320
1321
  /** New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language. */
1321
1322
  name?: string;
1322
1323
  /** A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name. */
1323
- language_code?: string;
1324
+ language_code?: LanguageCode;
1324
1325
  }): true;
1325
1326
 
1326
1327
  /** Use this method to get the current bot name for the given user language. Returns BotName on success. */
1327
1328
  getMyName(args: {
1328
1329
  /** A two-letter ISO 639-1 language code or an empty string */
1329
- language_code?: string;
1330
+ language_code?: LanguageCode;
1330
1331
  }): BotName;
1331
1332
 
1332
1333
  /** Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success. */
@@ -1334,13 +1335,13 @@ export type ApiMethods = {
1334
1335
  /** New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language. */
1335
1336
  description?: string;
1336
1337
  /** A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description. */
1337
- language_code?: string;
1338
+ language_code?: LanguageCode;
1338
1339
  }): true;
1339
1340
 
1340
1341
  /** Use this method to get the current bot description for the given user language. Returns BotDescription on success. */
1341
1342
  getMyDescription(args: {
1342
1343
  /** A two-letter ISO 639-1 language code or an empty string */
1343
- language_code?: string;
1344
+ language_code?: LanguageCode;
1344
1345
  }): BotDescription;
1345
1346
 
1346
1347
  /** Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns True on success. */
@@ -1348,13 +1349,13 @@ export type ApiMethods = {
1348
1349
  /** New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language. */
1349
1350
  short_description?: string;
1350
1351
  /** A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description. */
1351
- language_code?: string;
1352
+ language_code?: LanguageCode;
1352
1353
  }): true;
1353
1354
 
1354
1355
  /** Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success. */
1355
1356
  getMyShortDescription(args: {
1356
1357
  /** A two-letter ISO 639-1 language code or an empty string */
1357
- language_code?: string;
1358
+ language_code?: LanguageCode;
1358
1359
  }): BotShortDescription;
1359
1360
 
1360
1361
  /** Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success. */
@@ -1,4 +1,4 @@
1
- import type { WebAppInfo } from "./markupTypes.js";
1
+ import type { WebAppInfo } from "./markupTypes";
2
2
 
3
3
  /**
4
4
  * This interface represents the name of the bot.
package/src/index.d.ts CHANGED
@@ -6,5 +6,6 @@ export * from "./messageTypes";
6
6
  export * from "./apiMethodsTypes";
7
7
  export * from "./passportTypes";
8
8
  export * from "./invoiceTypes";
9
+ export * from "./languageTypes";
9
10
  export * from "./botCommandTypes";
10
11
  export * from "./updateTypes";
@@ -0,0 +1,194 @@
1
+ /** A two-letter ISO 639-1 language code.
2
+ * @see https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes
3
+ * @see https://www.loc.gov/standards/iso639-2/php/code_list.php
4
+ */
5
+ export type LanguageCode = (typeof LanguageCodes)[keyof typeof LanguageCodes];
6
+
7
+ /**
8
+ * @see {@link LanguageCode}
9
+ */
10
+ export declare const LanguageCodes: {
11
+ Abkhazian: "ab";
12
+ Afar: "aa";
13
+ Afrikaans: "af";
14
+ Akan: "ak";
15
+ Albanian: "sq";
16
+ Amharic: "am";
17
+ Arabic: "ar";
18
+ Aragonese: "an";
19
+ Armenian: "hy";
20
+ Assamese: "as";
21
+ Avaric: "av";
22
+ Avestan: "ae";
23
+ Aymara: "ay";
24
+ Azerbaijani: "az";
25
+ Bambara: "bm";
26
+ Bashkir: "ba";
27
+ Basque: "eu";
28
+ Belarusian: "be";
29
+ Bengali: "bn";
30
+ Bislama: "bi";
31
+ Bosnian: "bs";
32
+ Breton: "br";
33
+ Bulgarian: "bg";
34
+ Burmese: "my";
35
+ Catalan: "ca";
36
+ Chamorro: "ch";
37
+ Chechen: "ce";
38
+ Chichewa: "ny";
39
+ Chinese: "zh";
40
+ ChurchSlavonic: "cu";
41
+ Chuvash: "cv";
42
+ Cornish: "kw";
43
+ Corsican: "co";
44
+ Cree: "cr";
45
+ Croatian: "hr";
46
+ Czech: "cs";
47
+ Danish: "da";
48
+ Divehi: "dv";
49
+ Dutch: "nl";
50
+ Dzongkha: "dz";
51
+ English: "en";
52
+ Esperanto: "eo";
53
+ Estonian: "et";
54
+ Ewe: "ee";
55
+ Faroese: "fo";
56
+ Fijian: "fj";
57
+ Finnish: "fi";
58
+ French: "fr";
59
+ WesternFrisian: "fy";
60
+ Fulah: "ff";
61
+ Gaelic: "gd";
62
+ Galician: "gl";
63
+ Ganda: "lg";
64
+ Georgian: "ka";
65
+ German: "de";
66
+ Greek: "el";
67
+ Kalaallisut: "kl";
68
+ Guarani: "gn";
69
+ Gujarati: "gu";
70
+ Haitian: "ht";
71
+ Hausa: "ha";
72
+ Hebrew: "he";
73
+ Herero: "hz";
74
+ Hindi: "hi";
75
+ HiriMotu: "ho";
76
+ Hungarian: "hu";
77
+ Icelandic: "is";
78
+ Ido: "io";
79
+ Igbo: "ig";
80
+ Indonesian: "id";
81
+ Interlingua: "ia";
82
+ Interlingue: "ie";
83
+ Inuktitut: "iu";
84
+ Inupiaq: "ik";
85
+ Irish: "ga";
86
+ Italian: "it";
87
+ Japanese: "ja";
88
+ Javanese: "jv";
89
+ Kannada: "kn";
90
+ Kanuri: "kr";
91
+ Kashmiri: "ks";
92
+ Kazakh: "kk";
93
+ CentralKhmer: "km";
94
+ Kikuyu: "ki";
95
+ Kinyarwanda: "rw";
96
+ Kirghiz: "ky";
97
+ Komi: "kv";
98
+ Kongo: "kg";
99
+ Korean: "ko";
100
+ Kuanyama: "kj";
101
+ Kurdish: "ku";
102
+ Lao: "lo";
103
+ Latin: "la";
104
+ Latvian: "lv";
105
+ Limburgan: "li";
106
+ Lingala: "ln";
107
+ Lithuanian: "lt";
108
+ LubaKatanga: "lu";
109
+ Luxembourgish: "lb";
110
+ Macedonian: "mk";
111
+ Malagasy: "mg";
112
+ Malay: "ms";
113
+ Malayalam: "ml";
114
+ Maltese: "mt";
115
+ Manx: "gv";
116
+ Maori: "mi";
117
+ Marathi: "mr";
118
+ Marshallese: "mh";
119
+ Mongolian: "mn";
120
+ Nauru: "na";
121
+ Navajo: "nv";
122
+ NorthNdebele: "nd";
123
+ SouthNdebele: "nr";
124
+ Ndonga: "ng";
125
+ Nepali: "ne";
126
+ Norwegian: "no";
127
+ NorwegianBokmål: "nb";
128
+ NorwegianNynorsk: "nn";
129
+ SichuanYi: "ii";
130
+ Occitan: "oc";
131
+ Ojibwa: "oj";
132
+ Oriya: "or";
133
+ Oromo: "om";
134
+ Ossetian: "os";
135
+ Pali: "pi";
136
+ Pashto: "ps";
137
+ Persian: "fa";
138
+ Polish: "pl";
139
+ Portuguese: "pt";
140
+ Punjabi: "pa";
141
+ Quechua: "qu";
142
+ Romanian: "ro";
143
+ Romansh: "rm";
144
+ Rundi: "rn";
145
+ Russian: "ru";
146
+ NorthernSami: "se";
147
+ Samoan: "sm";
148
+ Sango: "sg";
149
+ Sanskrit: "sa";
150
+ Sardinian: "sc";
151
+ Serbian: "sr";
152
+ Shona: "sn";
153
+ Sindhi: "sd";
154
+ Sinhala: "si";
155
+ Slovak: "sk";
156
+ Slovenian: "sl";
157
+ Somali: "so";
158
+ SouthernSotho: "st";
159
+ Spanish: "es";
160
+ Sundanese: "su";
161
+ Swahili: "sw";
162
+ Swati: "ss";
163
+ Swedish: "sv";
164
+ Tagalog: "tl";
165
+ Tahitian: "ty";
166
+ Tajik: "tg";
167
+ Tamil: "ta";
168
+ Tatar: "tt";
169
+ Telugu: "te";
170
+ Thai: "th";
171
+ Tibetan: "bo";
172
+ Tigrinya: "ti";
173
+ Tonga: "to";
174
+ Tsonga: "ts";
175
+ Tswana: "tn";
176
+ Turkish: "tr";
177
+ Turkmen: "tk";
178
+ Twi: "tw";
179
+ Uighur: "ug";
180
+ Ukrainian: "uk";
181
+ Urdu: "ur";
182
+ Uzbek: "uz";
183
+ Venda: "ve";
184
+ Vietnamese: "vi";
185
+ Volapük: "vo";
186
+ Walloon: "wa";
187
+ Welsh: "cy";
188
+ Wolof: "wo";
189
+ Xhosa: "xh";
190
+ Yiddish: "yi";
191
+ Yoruba: "yo";
192
+ Zhuang: "za";
193
+ Zulu: "zu";
194
+ };
@@ -5,6 +5,7 @@ import type {
5
5
  ReactionType,
6
6
  Sticker,
7
7
  } from "./messageTypes";
8
+ import type { LanguageCode } from "./languageTypes";
8
9
  import type { Update } from "./updateTypes";
9
10
 
10
11
  /** Describes the current status of a webhook. */
@@ -42,7 +43,7 @@ export interface User {
42
43
  /** User's or bot's username */
43
44
  username?: string;
44
45
  /** IETF language tag of the user's language */
45
- language_code?: string;
46
+ language_code?: LanguageCode;
46
47
  /** True, if this user is a Telegram Premium user */
47
48
  is_premium?: true;
48
49
  /** True, if this user added the bot to the attachment menu */
@@ -559,6 +560,10 @@ export interface ChatInviteLink {
559
560
  member_limit?: number;
560
561
  /** Number of pending join requests created using this link */
561
562
  pending_join_request_count?: number;
563
+ /** The number of seconds the subscription will be active for before the next payment */
564
+ subscription_period?: number;
565
+ /** The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat using the link */
566
+ subscription_price?: number;
562
567
  }
563
568
 
564
569
  /** Represents the rights of an administrator in a chat. */
@@ -1,4 +1,5 @@
1
1
  import type { Chat, User } from "./manageTypes";
2
+ import type { LanguageCode } from "./languageTypes";
2
3
  import type { InlineKeyboardMarkup } from "./markupTypes";
3
4
  import type { PassportData } from "./passportTypes";
4
5
  import type {
@@ -458,7 +459,7 @@ export declare namespace MessageEntity {
458
459
  export interface PreMessageEntity extends AbstractMessageEntity {
459
460
  type: "pre";
460
461
  /** For “pre” only, the programming language of the entity text */
461
- language?: string;
462
+ language?: LanguageCode;
462
463
  }
463
464
  export interface TextLinkMessageEntity extends AbstractMessageEntity {
464
465
  type: "text_link";