@grom.js/bot-api-spec 0.8.0 → 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.8.0",
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.6.1",
30
- "@types/node": "22.19.13",
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.3",
34
+ "domhandler": "6.0.1",
35
+ "eslint": "9.39.4",
36
36
  "eslint-plugin-format": "2.0.1",
37
- "taze": "19.9.2",
38
- "turndown": "7.2.2",
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',
4003
+ },
4004
+ description: {
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
+ },
3973
4016
  },
3974
4017
  description: {
3975
- markdown: '0-based identifier of the correct answer option, required for polls in quiz mode',
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: {
@@ -7073,6 +7150,50 @@ const getBusinessConnection: ApiMethod = {
7073
7150
  },
7074
7151
  }
7075
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
+
7076
7197
  const setMyCommands: ApiMethod = {
7077
7198
  name: 'setMyCommands',
7078
7199
  description: {
@@ -7606,7 +7727,7 @@ const sendGift: ApiMethod = {
7606
7727
  ],
7607
7728
  },
7608
7729
  description: {
7609
- 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.',
7610
7731
  },
7611
7732
  required: false,
7612
7733
  },
@@ -7725,7 +7846,7 @@ const giftPremiumSubscription: ApiMethod = {
7725
7846
  ],
7726
7847
  },
7727
7848
  description: {
7728
- 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.',
7729
7850
  },
7730
7851
  required: false,
7731
7852
  },
@@ -9113,6 +9234,148 @@ const deleteStory: ApiMethod = {
9113
9234
  },
9114
9235
  }
9115
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
+
9116
9379
  const editMessageText: ApiMethod = {
9117
9380
  name: 'editMessageText',
9118
9381
  description: {
@@ -10966,114 +11229,6 @@ const answerInlineQuery: ApiMethod = {
10966
11229
  },
10967
11230
  }
10968
11231
 
10969
- const answerWebAppQuery: ApiMethod = {
10970
- name: 'answerWebAppQuery',
10971
- description: {
10972
- 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.',
10973
- },
10974
- parameters: [
10975
- {
10976
- name: 'web_app_query_id',
10977
- type: {
10978
- type: 'str',
10979
- },
10980
- description: {
10981
- markdown: 'Unique identifier for the query to be answered',
10982
- },
10983
- required: true,
10984
- },
10985
- {
10986
- name: 'result',
10987
- type: {
10988
- type: 'api-type',
10989
- name: 'InlineQueryResult',
10990
- },
10991
- description: {
10992
- markdown: 'An object describing the message to be sent',
10993
- },
10994
- required: true,
10995
- },
10996
- ],
10997
- returnType: {
10998
- type: 'api-type',
10999
- name: 'SentWebAppMessage',
11000
- },
11001
- }
11002
-
11003
- const savePreparedInlineMessage: ApiMethod = {
11004
- name: 'savePreparedInlineMessage',
11005
- description: {
11006
- 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.',
11007
- },
11008
- parameters: [
11009
- {
11010
- name: 'user_id',
11011
- type: {
11012
- type: 'int32',
11013
- },
11014
- description: {
11015
- markdown: 'Unique identifier of the target user that can use the prepared message',
11016
- },
11017
- required: true,
11018
- },
11019
- {
11020
- name: 'result',
11021
- type: {
11022
- type: 'api-type',
11023
- name: 'InlineQueryResult',
11024
- },
11025
- description: {
11026
- markdown: 'An object describing the message to be sent',
11027
- },
11028
- required: true,
11029
- },
11030
- {
11031
- name: 'allow_user_chats',
11032
- type: {
11033
- type: 'bool',
11034
- },
11035
- description: {
11036
- markdown: 'Pass _True_ if the message can be sent to private chats with users',
11037
- },
11038
- required: false,
11039
- },
11040
- {
11041
- name: 'allow_bot_chats',
11042
- type: {
11043
- type: 'bool',
11044
- },
11045
- description: {
11046
- markdown: 'Pass _True_ if the message can be sent to private chats with bots',
11047
- },
11048
- required: false,
11049
- },
11050
- {
11051
- name: 'allow_group_chats',
11052
- type: {
11053
- type: 'bool',
11054
- },
11055
- description: {
11056
- markdown: 'Pass _True_ if the message can be sent to group and supergroup chats',
11057
- },
11058
- required: false,
11059
- },
11060
- {
11061
- name: 'allow_channel_chats',
11062
- type: {
11063
- type: 'bool',
11064
- },
11065
- description: {
11066
- markdown: 'Pass _True_ if the message can be sent to channel chats',
11067
- },
11068
- required: false,
11069
- },
11070
- ],
11071
- returnType: {
11072
- type: 'api-type',
11073
- name: 'PreparedInlineMessage',
11074
- },
11075
- }
11076
-
11077
11232
  const sendInvoice: ApiMethod = {
11078
11233
  name: 'sendInvoice',
11079
11234
  description: {
@@ -12264,6 +12419,8 @@ export const methods = {
12264
12419
  answerCallbackQuery,
12265
12420
  getUserChatBoosts,
12266
12421
  getBusinessConnection,
12422
+ getManagedBotToken,
12423
+ replaceManagedBotToken,
12267
12424
  setMyCommands,
12268
12425
  deleteMyCommands,
12269
12426
  getMyCommands,
@@ -12306,6 +12463,9 @@ export const methods = {
12306
12463
  repostStory,
12307
12464
  editStory,
12308
12465
  deleteStory,
12466
+ answerWebAppQuery,
12467
+ savePreparedInlineMessage,
12468
+ savePreparedKeyboardButton,
12309
12469
  editMessageText,
12310
12470
  editMessageCaption,
12311
12471
  editMessageMedia,
@@ -12335,8 +12495,6 @@ export const methods = {
12335
12495
  setCustomEmojiStickerSetThumbnail,
12336
12496
  deleteStickerSet,
12337
12497
  answerInlineQuery,
12338
- answerWebAppQuery,
12339
- savePreparedInlineMessage,
12340
12498
  sendInvoice,
12341
12499
  createInvoiceLink,
12342
12500
  answerShippingQuery,