@grom.js/bot-api-spec 0.7.1 → 0.9.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,7 +1,7 @@
1
1
  {
2
2
  "name": "@grom.js/bot-api-spec",
3
3
  "type": "module",
4
- "version": "0.7.1",
4
+ "version": "0.9.0",
5
5
  "description": "Telegram Bot API specification as a collection of JavaScript objects in a custom format.",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -26,16 +26,16 @@
26
26
  "node": ">=22.18"
27
27
  },
28
28
  "devDependencies": {
29
- "@antfu/eslint-config": "7.3.0",
30
- "@types/node": "22.19.10",
29
+ "@antfu/eslint-config": "7.7.3",
30
+ "@types/node": "22.19.17",
31
31
  "@types/turndown": "5.0.6",
32
- "bumpp": "10.4.1",
32
+ "bumpp": "11.0.1",
33
33
  "cheerio": "1.2.0",
34
- "domhandler": "5.0.3",
35
- "eslint": "9.39.2",
36
- "eslint-plugin-format": "1.4.0",
37
- "taze": "19.9.2",
38
- "turndown": "7.2.2",
34
+ "domhandler": "6.0.1",
35
+ "eslint": "9.39.4",
36
+ "eslint-plugin-format": "2.0.1",
37
+ "taze": "19.11.0",
38
+ "turndown": "7.2.4",
39
39
  "typescript": "5.9.3",
40
40
  "zod": "4.3.6"
41
41
  },
@@ -3962,17 +3962,60 @@ const sendPoll: ApiMethod = {
3962
3962
  type: 'bool',
3963
3963
  },
3964
3964
  description: {
3965
- markdown: '_True_, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to _False_',
3965
+ markdown: 'Pass _True_, if the poll allows multiple answers, defaults to _False_',
3966
3966
  },
3967
3967
  required: false,
3968
3968
  },
3969
3969
  {
3970
- name: 'correct_option_id',
3970
+ name: 'allows_revoting',
3971
3971
  type: {
3972
- type: 'int32',
3972
+ type: 'bool',
3973
+ },
3974
+ description: {
3975
+ markdown: 'Pass _True_, if the poll allows to change chosen answer options, defaults to _False_ for quizzes and to _True_ for regular polls',
3976
+ },
3977
+ required: false,
3978
+ },
3979
+ {
3980
+ name: 'shuffle_options',
3981
+ type: {
3982
+ type: 'bool',
3983
+ },
3984
+ description: {
3985
+ markdown: 'Pass _True_, if the poll options must be shown in random order',
3986
+ },
3987
+ required: false,
3988
+ },
3989
+ {
3990
+ name: 'allow_adding_options',
3991
+ type: {
3992
+ type: 'bool',
3993
+ },
3994
+ description: {
3995
+ markdown: 'Pass _True_, if answer options can be added to the poll after creation; not supported for anonymous polls and quizzes',
3996
+ },
3997
+ required: false,
3998
+ },
3999
+ {
4000
+ name: 'hide_results_until_closes',
4001
+ type: {
4002
+ type: 'bool',
3973
4003
  },
3974
4004
  description: {
3975
- markdown: '0-based identifier of the correct answer option, required for polls in quiz mode',
4005
+ markdown: 'Pass _True_, if poll results must be shown only after the poll closes',
4006
+ },
4007
+ required: false,
4008
+ },
4009
+ {
4010
+ name: 'correct_option_ids',
4011
+ type: {
4012
+ type: 'array',
4013
+ of: {
4014
+ type: 'int32',
4015
+ },
4016
+ },
4017
+ description: {
4018
+ markdown: 'An array of monotonically increasing 0-based identifiers of the correct answer options, required for polls in quiz mode',
3976
4019
  },
3977
4020
  required: false,
3978
4021
  },
@@ -4030,7 +4073,7 @@ const sendPoll: ApiMethod = {
4030
4073
  type: 'int32',
4031
4074
  },
4032
4075
  description: {
4033
- markdown: 'Amount of time in seconds the poll will be active after creation, 5-600. Can\'t be used together with _close\\_date_.',
4076
+ markdown: 'Amount of time in seconds the poll will be active after creation, 5-2628000. Can\'t be used together with _close\\_date_.',
4034
4077
  },
4035
4078
  required: false,
4036
4079
  },
@@ -4040,7 +4083,7 @@ const sendPoll: ApiMethod = {
4040
4083
  type: 'int32',
4041
4084
  },
4042
4085
  description: {
4043
- markdown: 'Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can\'t be used together with _open\\_period_.',
4086
+ markdown: 'Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 2628000 seconds in the future. Can\'t be used together with _open\\_period_.',
4044
4087
  },
4045
4088
  required: false,
4046
4089
  },
@@ -4054,6 +4097,40 @@ const sendPoll: ApiMethod = {
4054
4097
  },
4055
4098
  required: false,
4056
4099
  },
4100
+ {
4101
+ name: 'description',
4102
+ type: {
4103
+ type: 'str',
4104
+ },
4105
+ description: {
4106
+ markdown: 'Description of the poll to be sent, 0-1024 characters after entities parsing',
4107
+ },
4108
+ required: false,
4109
+ },
4110
+ {
4111
+ name: 'description_parse_mode',
4112
+ type: {
4113
+ type: 'str',
4114
+ },
4115
+ description: {
4116
+ markdown: 'Mode for parsing entities in the poll description. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.',
4117
+ },
4118
+ required: false,
4119
+ },
4120
+ {
4121
+ name: 'description_entities',
4122
+ type: {
4123
+ type: 'array',
4124
+ of: {
4125
+ type: 'api-type',
4126
+ name: 'MessageEntity',
4127
+ },
4128
+ },
4129
+ description: {
4130
+ markdown: 'An array of special entities that appear in the poll description, which can be specified instead of _description\\_parse\\_mode_',
4131
+ },
4132
+ required: false,
4133
+ },
4057
4134
  {
4058
4135
  name: 'disable_notification',
4059
4136
  type: {
@@ -4225,7 +4302,7 @@ const sendChecklist: ApiMethod = {
4225
4302
  name: 'InlineKeyboardMarkup',
4226
4303
  },
4227
4304
  description: {
4228
- markdown: 'An object for an inline keyboard',
4305
+ markdown: 'An object for an [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards)',
4229
4306
  },
4230
4307
  required: false,
4231
4308
  },
@@ -4426,7 +4503,7 @@ const sendDice: ApiMethod = {
4426
4503
  const sendMessageDraft: ApiMethod = {
4427
4504
  name: 'sendMessageDraft',
4428
4505
  description: {
4429
- markdown: 'Use this method to stream a partial message to a user while the message is being generated; supported only for bots with forum topic mode enabled. Returns _True_ on success.',
4506
+ markdown: 'Use this method to stream a partial message to a user while the message is being generated. Returns _True_ on success.',
4430
4507
  },
4431
4508
  parameters: [
4432
4509
  {
@@ -5216,6 +5293,16 @@ const promoteChatMember: ApiMethod = {
5216
5293
  },
5217
5294
  required: false,
5218
5295
  },
5296
+ {
5297
+ name: 'can_manage_tags',
5298
+ type: {
5299
+ type: 'bool',
5300
+ },
5301
+ description: {
5302
+ markdown: 'Pass _True_ if the administrator can edit the tags of regular members; for groups and supergroups only',
5303
+ },
5304
+ required: false,
5305
+ },
5219
5306
  ],
5220
5307
  returnType: {
5221
5308
  type: 'bool',
@@ -5274,6 +5361,57 @@ const setChatAdministratorCustomTitle: ApiMethod = {
5274
5361
  },
5275
5362
  }
5276
5363
 
5364
+ const setChatMemberTag: ApiMethod = {
5365
+ name: 'setChatMemberTag',
5366
+ description: {
5367
+ markdown: 'Use this method to set a tag for a regular member in a group or a supergroup. The bot must be an administrator in the chat for this to work and must have the _can\\_manage\\_tags_ administrator right. Returns _True_ on success.',
5368
+ },
5369
+ parameters: [
5370
+ {
5371
+ name: 'chat_id',
5372
+ type: {
5373
+ type: 'union',
5374
+ types: [
5375
+ {
5376
+ type: 'int32',
5377
+ },
5378
+ {
5379
+ type: 'str',
5380
+ },
5381
+ ],
5382
+ },
5383
+ description: {
5384
+ markdown: 'Unique identifier for the target chat or username of the target supergroup (in the format `@supergroupusername`)',
5385
+ },
5386
+ required: true,
5387
+ },
5388
+ {
5389
+ name: 'user_id',
5390
+ type: {
5391
+ type: 'int32',
5392
+ },
5393
+ description: {
5394
+ markdown: 'Unique identifier of the target user',
5395
+ },
5396
+ required: true,
5397
+ },
5398
+ {
5399
+ name: 'tag',
5400
+ type: {
5401
+ type: 'str',
5402
+ },
5403
+ description: {
5404
+ markdown: 'New tag for the member; 0-16 characters, emoji are not allowed',
5405
+ },
5406
+ required: false,
5407
+ },
5408
+ ],
5409
+ returnType: {
5410
+ type: 'bool',
5411
+ literal: true,
5412
+ },
5413
+ }
5414
+
5277
5415
  const banChatSenderChat: ApiMethod = {
5278
5416
  name: 'banChatSenderChat',
5279
5417
  description: {
@@ -7012,6 +7150,50 @@ const getBusinessConnection: ApiMethod = {
7012
7150
  },
7013
7151
  }
7014
7152
 
7153
+ const getManagedBotToken: ApiMethod = {
7154
+ name: 'getManagedBotToken',
7155
+ description: {
7156
+ markdown: 'Use this method to get the token of a managed bot. Returns the token as _String_ on success.',
7157
+ },
7158
+ parameters: [
7159
+ {
7160
+ name: 'user_id',
7161
+ type: {
7162
+ type: 'int32',
7163
+ },
7164
+ description: {
7165
+ markdown: 'User identifier of the managed bot whose token will be returned',
7166
+ },
7167
+ required: true,
7168
+ },
7169
+ ],
7170
+ returnType: {
7171
+ type: 'str',
7172
+ },
7173
+ }
7174
+
7175
+ const replaceManagedBotToken: ApiMethod = {
7176
+ name: 'replaceManagedBotToken',
7177
+ description: {
7178
+ markdown: 'Use this method to revoke the current token of a managed bot and generate a new one. Returns the new token as _String_ on success.',
7179
+ },
7180
+ parameters: [
7181
+ {
7182
+ name: 'user_id',
7183
+ type: {
7184
+ type: 'int32',
7185
+ },
7186
+ description: {
7187
+ markdown: 'User identifier of the managed bot whose token will be replaced',
7188
+ },
7189
+ required: true,
7190
+ },
7191
+ ],
7192
+ returnType: {
7193
+ type: 'str',
7194
+ },
7195
+ }
7196
+
7015
7197
  const setMyCommands: ApiMethod = {
7016
7198
  name: 'setMyCommands',
7017
7199
  description: {
@@ -7545,7 +7727,7 @@ const sendGift: ApiMethod = {
7545
7727
  ],
7546
7728
  },
7547
7729
  description: {
7548
- markdown: 'Mode for parsing entities in the text. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom\\_emoji” are ignored.',
7730
+ markdown: 'Mode for parsing entities in the text. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, “custom\\_emoji”, and “date\\_time” are ignored.',
7549
7731
  },
7550
7732
  required: false,
7551
7733
  },
@@ -7664,7 +7846,7 @@ const giftPremiumSubscription: ApiMethod = {
7664
7846
  ],
7665
7847
  },
7666
7848
  description: {
7667
- markdown: 'Mode for parsing entities in the text. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom\\_emoji” are ignored.',
7849
+ markdown: 'Mode for parsing entities in the text. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, “custom\\_emoji”, and “date\\_time” are ignored.',
7668
7850
  },
7669
7851
  required: false,
7670
7852
  },
@@ -9052,6 +9234,148 @@ const deleteStory: ApiMethod = {
9052
9234
  },
9053
9235
  }
9054
9236
 
9237
+ const answerWebAppQuery: ApiMethod = {
9238
+ name: 'answerWebAppQuery',
9239
+ description: {
9240
+ markdown: 'Use this method to set the result of an interaction with a [Web App](https://core.telegram.org/bots/webapps) and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a [SentWebAppMessage](https://core.telegram.org/bots/api#sentwebappmessage) object is returned.',
9241
+ },
9242
+ parameters: [
9243
+ {
9244
+ name: 'web_app_query_id',
9245
+ type: {
9246
+ type: 'str',
9247
+ },
9248
+ description: {
9249
+ markdown: 'Unique identifier for the query to be answered',
9250
+ },
9251
+ required: true,
9252
+ },
9253
+ {
9254
+ name: 'result',
9255
+ type: {
9256
+ type: 'api-type',
9257
+ name: 'InlineQueryResult',
9258
+ },
9259
+ description: {
9260
+ markdown: 'An object describing the message to be sent',
9261
+ },
9262
+ required: true,
9263
+ },
9264
+ ],
9265
+ returnType: {
9266
+ type: 'api-type',
9267
+ name: 'SentWebAppMessage',
9268
+ },
9269
+ }
9270
+
9271
+ const savePreparedInlineMessage: ApiMethod = {
9272
+ name: 'savePreparedInlineMessage',
9273
+ description: {
9274
+ markdown: 'Stores a message that can be sent by a user of a Mini App. Returns a [PreparedInlineMessage](https://core.telegram.org/bots/api#preparedinlinemessage) object.',
9275
+ },
9276
+ parameters: [
9277
+ {
9278
+ name: 'user_id',
9279
+ type: {
9280
+ type: 'int32',
9281
+ },
9282
+ description: {
9283
+ markdown: 'Unique identifier of the target user that can use the prepared message',
9284
+ },
9285
+ required: true,
9286
+ },
9287
+ {
9288
+ name: 'result',
9289
+ type: {
9290
+ type: 'api-type',
9291
+ name: 'InlineQueryResult',
9292
+ },
9293
+ description: {
9294
+ markdown: 'An object describing the message to be sent',
9295
+ },
9296
+ required: true,
9297
+ },
9298
+ {
9299
+ name: 'allow_user_chats',
9300
+ type: {
9301
+ type: 'bool',
9302
+ },
9303
+ description: {
9304
+ markdown: 'Pass _True_ if the message can be sent to private chats with users',
9305
+ },
9306
+ required: false,
9307
+ },
9308
+ {
9309
+ name: 'allow_bot_chats',
9310
+ type: {
9311
+ type: 'bool',
9312
+ },
9313
+ description: {
9314
+ markdown: 'Pass _True_ if the message can be sent to private chats with bots',
9315
+ },
9316
+ required: false,
9317
+ },
9318
+ {
9319
+ name: 'allow_group_chats',
9320
+ type: {
9321
+ type: 'bool',
9322
+ },
9323
+ description: {
9324
+ markdown: 'Pass _True_ if the message can be sent to group and supergroup chats',
9325
+ },
9326
+ required: false,
9327
+ },
9328
+ {
9329
+ name: 'allow_channel_chats',
9330
+ type: {
9331
+ type: 'bool',
9332
+ },
9333
+ description: {
9334
+ markdown: 'Pass _True_ if the message can be sent to channel chats',
9335
+ },
9336
+ required: false,
9337
+ },
9338
+ ],
9339
+ returnType: {
9340
+ type: 'api-type',
9341
+ name: 'PreparedInlineMessage',
9342
+ },
9343
+ }
9344
+
9345
+ const savePreparedKeyboardButton: ApiMethod = {
9346
+ name: 'savePreparedKeyboardButton',
9347
+ description: {
9348
+ markdown: 'Stores a keyboard button that can be used by a user within a Mini App. Returns a [PreparedKeyboardButton](https://core.telegram.org/bots/api#preparedkeyboardbutton) object.',
9349
+ },
9350
+ parameters: [
9351
+ {
9352
+ name: 'user_id',
9353
+ type: {
9354
+ type: 'int32',
9355
+ },
9356
+ description: {
9357
+ markdown: 'Unique identifier of the target user that can use the button',
9358
+ },
9359
+ required: true,
9360
+ },
9361
+ {
9362
+ name: 'button',
9363
+ type: {
9364
+ type: 'api-type',
9365
+ name: 'KeyboardButton',
9366
+ },
9367
+ description: {
9368
+ markdown: 'An object describing the button to be saved. The button must be of the type _request\\_users_, _request\\_chat_, or _request\\_managed\\_bot_',
9369
+ },
9370
+ required: true,
9371
+ },
9372
+ ],
9373
+ returnType: {
9374
+ type: 'api-type',
9375
+ name: 'PreparedKeyboardButton',
9376
+ },
9377
+ }
9378
+
9055
9379
  const editMessageText: ApiMethod = {
9056
9380
  name: 'editMessageText',
9057
9381
  description: {
@@ -9699,7 +10023,7 @@ const editMessageChecklist: ApiMethod = {
9699
10023
  name: 'InlineKeyboardMarkup',
9700
10024
  },
9701
10025
  description: {
9702
- markdown: 'An object for the new inline keyboard for the message',
10026
+ markdown: 'An object for the new [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards) for the message',
9703
10027
  },
9704
10028
  required: false,
9705
10029
  },
@@ -10905,114 +11229,6 @@ const answerInlineQuery: ApiMethod = {
10905
11229
  },
10906
11230
  }
10907
11231
 
10908
- const answerWebAppQuery: ApiMethod = {
10909
- name: 'answerWebAppQuery',
10910
- description: {
10911
- markdown: 'Use this method to set the result of an interaction with a [Web App](https://core.telegram.org/bots/webapps) and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a [SentWebAppMessage](https://core.telegram.org/bots/api#sentwebappmessage) object is returned.',
10912
- },
10913
- parameters: [
10914
- {
10915
- name: 'web_app_query_id',
10916
- type: {
10917
- type: 'str',
10918
- },
10919
- description: {
10920
- markdown: 'Unique identifier for the query to be answered',
10921
- },
10922
- required: true,
10923
- },
10924
- {
10925
- name: 'result',
10926
- type: {
10927
- type: 'api-type',
10928
- name: 'InlineQueryResult',
10929
- },
10930
- description: {
10931
- markdown: 'An object describing the message to be sent',
10932
- },
10933
- required: true,
10934
- },
10935
- ],
10936
- returnType: {
10937
- type: 'api-type',
10938
- name: 'SentWebAppMessage',
10939
- },
10940
- }
10941
-
10942
- const savePreparedInlineMessage: ApiMethod = {
10943
- name: 'savePreparedInlineMessage',
10944
- description: {
10945
- markdown: 'Stores a message that can be sent by a user of a Mini App. Returns a [PreparedInlineMessage](https://core.telegram.org/bots/api#preparedinlinemessage) object.',
10946
- },
10947
- parameters: [
10948
- {
10949
- name: 'user_id',
10950
- type: {
10951
- type: 'int32',
10952
- },
10953
- description: {
10954
- markdown: 'Unique identifier of the target user that can use the prepared message',
10955
- },
10956
- required: true,
10957
- },
10958
- {
10959
- name: 'result',
10960
- type: {
10961
- type: 'api-type',
10962
- name: 'InlineQueryResult',
10963
- },
10964
- description: {
10965
- markdown: 'An object describing the message to be sent',
10966
- },
10967
- required: true,
10968
- },
10969
- {
10970
- name: 'allow_user_chats',
10971
- type: {
10972
- type: 'bool',
10973
- },
10974
- description: {
10975
- markdown: 'Pass _True_ if the message can be sent to private chats with users',
10976
- },
10977
- required: false,
10978
- },
10979
- {
10980
- name: 'allow_bot_chats',
10981
- type: {
10982
- type: 'bool',
10983
- },
10984
- description: {
10985
- markdown: 'Pass _True_ if the message can be sent to private chats with bots',
10986
- },
10987
- required: false,
10988
- },
10989
- {
10990
- name: 'allow_group_chats',
10991
- type: {
10992
- type: 'bool',
10993
- },
10994
- description: {
10995
- markdown: 'Pass _True_ if the message can be sent to group and supergroup chats',
10996
- },
10997
- required: false,
10998
- },
10999
- {
11000
- name: 'allow_channel_chats',
11001
- type: {
11002
- type: 'bool',
11003
- },
11004
- description: {
11005
- markdown: 'Pass _True_ if the message can be sent to channel chats',
11006
- },
11007
- required: false,
11008
- },
11009
- ],
11010
- returnType: {
11011
- type: 'api-type',
11012
- name: 'PreparedInlineMessage',
11013
- },
11014
- }
11015
-
11016
11232
  const sendInvoice: ApiMethod = {
11017
11233
  name: 'sendInvoice',
11018
11234
  description: {
@@ -12161,6 +12377,7 @@ export const methods = {
12161
12377
  restrictChatMember,
12162
12378
  promoteChatMember,
12163
12379
  setChatAdministratorCustomTitle,
12380
+ setChatMemberTag,
12164
12381
  banChatSenderChat,
12165
12382
  unbanChatSenderChat,
12166
12383
  setChatPermissions,
@@ -12202,6 +12419,8 @@ export const methods = {
12202
12419
  answerCallbackQuery,
12203
12420
  getUserChatBoosts,
12204
12421
  getBusinessConnection,
12422
+ getManagedBotToken,
12423
+ replaceManagedBotToken,
12205
12424
  setMyCommands,
12206
12425
  deleteMyCommands,
12207
12426
  getMyCommands,
@@ -12244,6 +12463,9 @@ export const methods = {
12244
12463
  repostStory,
12245
12464
  editStory,
12246
12465
  deleteStory,
12466
+ answerWebAppQuery,
12467
+ savePreparedInlineMessage,
12468
+ savePreparedKeyboardButton,
12247
12469
  editMessageText,
12248
12470
  editMessageCaption,
12249
12471
  editMessageMedia,
@@ -12273,8 +12495,6 @@ export const methods = {
12273
12495
  setCustomEmojiStickerSetThumbnail,
12274
12496
  deleteStickerSet,
12275
12497
  answerInlineQuery,
12276
- answerWebAppQuery,
12277
- savePreparedInlineMessage,
12278
12498
  sendInvoice,
12279
12499
  createInvoiceLink,
12280
12500
  answerShippingQuery,