@mtkruto/node 0.101.2 → 0.102.1

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 (109) hide show
  1. package/esm/3_types.d.ts +2 -0
  2. package/esm/3_types.d.ts.map +1 -1
  3. package/esm/3_types.js +2 -0
  4. package/esm/client/0_params.d.ts +4 -0
  5. package/esm/client/0_params.d.ts.map +1 -1
  6. package/esm/client/1_client_generic.d.ts +32 -5
  7. package/esm/client/1_client_generic.d.ts.map +1 -1
  8. package/esm/client/2_account_manager.d.ts +4 -1
  9. package/esm/client/2_account_manager.d.ts.map +1 -1
  10. package/esm/client/2_account_manager.js +18 -0
  11. package/esm/client/2_update_manager.js +7 -7
  12. package/esm/client/3_message_manager.js +17 -17
  13. package/esm/client/3_video_chat_manager.js +3 -3
  14. package/esm/client/4_chat_manager.js +3 -3
  15. package/esm/client/4_gift_manager.d.ts +3 -2
  16. package/esm/client/4_gift_manager.d.ts.map +1 -1
  17. package/esm/client/4_gift_manager.js +8 -7
  18. package/esm/client/5_client.d.ts +32 -5
  19. package/esm/client/5_client.d.ts.map +1 -1
  20. package/esm/client/5_client.js +39 -4
  21. package/esm/client/5_client_dispatcher.d.ts +32 -5
  22. package/esm/client/5_client_dispatcher.d.ts.map +1 -1
  23. package/esm/client/5_client_dispatcher.js +39 -4
  24. package/esm/types/0_bot_token_check_result.d.ts +9 -7
  25. package/esm/types/0_bot_token_check_result.d.ts.map +1 -1
  26. package/esm/types/0_button_style.d.ts +28 -0
  27. package/esm/types/0_button_style.d.ts.map +1 -0
  28. package/esm/types/0_button_style.js +36 -0
  29. package/esm/types/0_code_check_result.d.ts +26 -16
  30. package/esm/types/0_code_check_result.d.ts.map +1 -1
  31. package/esm/types/0_gift_component_rarity.d.ts +5 -0
  32. package/esm/types/0_gift_component_rarity.d.ts.map +1 -1
  33. package/esm/types/0_link_preview_media_size.d.ts +1 -0
  34. package/esm/types/0_link_preview_media_size.d.ts.map +1 -1
  35. package/esm/types/0_mini_app_button_info.d.ts +1 -0
  36. package/esm/types/0_mini_app_button_info.d.ts.map +1 -1
  37. package/esm/types/0_password_check_result.d.ts +17 -11
  38. package/esm/types/0_password_check_result.d.ts.map +1 -1
  39. package/esm/types/0_slow_mode_duration.d.ts +1 -0
  40. package/esm/types/0_slow_mode_duration.d.ts.map +1 -1
  41. package/esm/types/0_switch_inline_query_chosen_chats.d.ts +1 -0
  42. package/esm/types/0_switch_inline_query_chosen_chats.d.ts.map +1 -1
  43. package/esm/types/1_bot_command_scope.js +1 -1
  44. package/esm/types/1_inline_keyboard_button.d.ts +2 -0
  45. package/esm/types/1_inline_keyboard_button.d.ts.map +1 -1
  46. package/esm/types/1_inline_keyboard_button.js +30 -19
  47. package/esm/types/1_input_gift.d.ts +54 -0
  48. package/esm/types/1_input_gift.d.ts.map +1 -0
  49. package/esm/types/1_input_gift.js +32 -0
  50. package/esm/types/1_keyboard_button.d.ts +2 -0
  51. package/esm/types/1_keyboard_button.d.ts.map +1 -1
  52. package/esm/types/1_keyboard_button.js +67 -14
  53. package/esm/types/2_message_entity.js +2 -2
  54. package/esm/types/7_inline_query_result.js +6 -6
  55. package/package.json +1 -1
  56. package/script/3_types.d.ts +2 -0
  57. package/script/3_types.d.ts.map +1 -1
  58. package/script/3_types.js +2 -0
  59. package/script/client/0_params.d.ts +4 -0
  60. package/script/client/0_params.d.ts.map +1 -1
  61. package/script/client/1_client_generic.d.ts +32 -5
  62. package/script/client/1_client_generic.d.ts.map +1 -1
  63. package/script/client/2_account_manager.d.ts +4 -1
  64. package/script/client/2_account_manager.d.ts.map +1 -1
  65. package/script/client/2_account_manager.js +18 -0
  66. package/script/client/2_update_manager.js +7 -7
  67. package/script/client/3_message_manager.js +17 -17
  68. package/script/client/3_video_chat_manager.js +3 -3
  69. package/script/client/4_chat_manager.js +3 -3
  70. package/script/client/4_gift_manager.d.ts +3 -2
  71. package/script/client/4_gift_manager.d.ts.map +1 -1
  72. package/script/client/4_gift_manager.js +7 -6
  73. package/script/client/5_client.d.ts +32 -5
  74. package/script/client/5_client.d.ts.map +1 -1
  75. package/script/client/5_client.js +39 -4
  76. package/script/client/5_client_dispatcher.d.ts +32 -5
  77. package/script/client/5_client_dispatcher.d.ts.map +1 -1
  78. package/script/client/5_client_dispatcher.js +39 -4
  79. package/script/types/0_bot_token_check_result.d.ts +9 -7
  80. package/script/types/0_bot_token_check_result.d.ts.map +1 -1
  81. package/script/types/0_button_style.d.ts +28 -0
  82. package/script/types/0_button_style.d.ts.map +1 -0
  83. package/script/types/0_button_style.js +40 -0
  84. package/script/types/0_code_check_result.d.ts +26 -16
  85. package/script/types/0_code_check_result.d.ts.map +1 -1
  86. package/script/types/0_gift_component_rarity.d.ts +5 -0
  87. package/script/types/0_gift_component_rarity.d.ts.map +1 -1
  88. package/script/types/0_link_preview_media_size.d.ts +1 -0
  89. package/script/types/0_link_preview_media_size.d.ts.map +1 -1
  90. package/script/types/0_mini_app_button_info.d.ts +1 -0
  91. package/script/types/0_mini_app_button_info.d.ts.map +1 -1
  92. package/script/types/0_password_check_result.d.ts +17 -11
  93. package/script/types/0_password_check_result.d.ts.map +1 -1
  94. package/script/types/0_slow_mode_duration.d.ts +1 -0
  95. package/script/types/0_slow_mode_duration.d.ts.map +1 -1
  96. package/script/types/0_switch_inline_query_chosen_chats.d.ts +1 -0
  97. package/script/types/0_switch_inline_query_chosen_chats.d.ts.map +1 -1
  98. package/script/types/1_bot_command_scope.js +1 -1
  99. package/script/types/1_inline_keyboard_button.d.ts +2 -0
  100. package/script/types/1_inline_keyboard_button.d.ts.map +1 -1
  101. package/script/types/1_inline_keyboard_button.js +30 -19
  102. package/script/types/1_input_gift.d.ts +54 -0
  103. package/script/types/1_input_gift.d.ts.map +1 -0
  104. package/script/types/1_input_gift.js +35 -0
  105. package/script/types/1_keyboard_button.d.ts +2 -0
  106. package/script/types/1_keyboard_button.d.ts.map +1 -1
  107. package/script/types/1_keyboard_button.js +67 -14
  108. package/script/types/2_message_entity.js +2 -2
  109. package/script/types/7_inline_query_result.js +6 -6
@@ -0,0 +1,54 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2026 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
20
+ import type { Api } from "../2_tl.js";
21
+ import type { InputPeerGetter } from "./_getters.js";
22
+ import type { ID } from "./0_id.js";
23
+ /**
24
+ * Reference to a gift by its slug.
25
+ * @unlisted
26
+ */
27
+ export interface InputGiftSlug {
28
+ /** @discriminator */
29
+ type: "slug";
30
+ slug: string;
31
+ }
32
+ /**
33
+ * Reference to a gift in a chat by its ID.
34
+ * @unlisted
35
+ */
36
+ export interface InputGiftChat {
37
+ /** @discriminator */
38
+ type: "chat";
39
+ chatId: ID;
40
+ id: string;
41
+ }
42
+ /**
43
+ * Reference to a gift in a private chat by its message ID.
44
+ * @unlisted
45
+ */
46
+ export interface InputGiftUser {
47
+ /** @discriminator */
48
+ type: "user";
49
+ messageId: number;
50
+ }
51
+ /** Reference to a gift. */
52
+ export type InputGift = InputGiftSlug | InputGiftChat | InputGiftUser;
53
+ export declare function inputGiftToTlObject(inputGift: InputGift, getInputPeer: InputPeerGetter): Promise<Api.InputSavedStarGift>;
54
+ //# sourceMappingURL=1_input_gift.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1_input_gift.d.ts","sourceRoot":"","sources":["../../src/types/1_input_gift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAEpC;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,EAAE,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,2BAA2B;AAC3B,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,aAAa,GAAG,aAAa,CAAC;AAEtE,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAW9H"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /**
3
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
4
+ * Copyright (C) 2023-2026 Roj <https://roj.im/>
5
+ *
6
+ * This file is part of MTKruto.
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU Lesser General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public License
19
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.inputGiftToTlObject = inputGiftToTlObject;
23
+ const _0_deps_js_1 = require("../0_deps.js");
24
+ async function inputGiftToTlObject(inputGift, getInputPeer) {
25
+ switch (inputGift.type) {
26
+ case "slug":
27
+ return { _: "inputSavedStarGiftSlug", slug: inputGift.slug };
28
+ case "chat":
29
+ return { _: "inputSavedStarGiftChat", peer: await getInputPeer(inputGift.chatId), saved_id: BigInt(inputGift.id) };
30
+ case "user":
31
+ return { _: "inputSavedStarGiftUser", msg_id: inputGift.messageId };
32
+ default:
33
+ (0, _0_deps_js_1.unreachable)();
34
+ }
35
+ }
@@ -18,6 +18,7 @@
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
20
  import { Api } from "../2_tl.js";
21
+ import { type ButtonStyle } from "./0_button_style.js";
21
22
  import { type ChatAdministratorRights } from "./0_chat_administrator_rights.js";
22
23
  import type { KeyboardButtonPollType } from "./0_keyboard_button_poll_type.js";
23
24
  import type { MiniAppButtonInfo } from "./0_mini_app_button_info.js";
@@ -25,6 +26,7 @@ import type { MiniAppButtonInfo } from "./0_mini_app_button_info.js";
25
26
  export interface KeyboardButtonText {
26
27
  /** @discriminator */
27
28
  text: string;
29
+ style?: ButtonStyle;
28
30
  }
29
31
  /** @unlisted */
30
32
  export interface KeyboardButtonRequestUser extends KeyboardButtonText {
@@ -1 +1 @@
1
- {"version":3,"file":"1_keyboard_button.d.ts","sourceRoot":"","sources":["../../src/types/1_keyboard_button.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,KAAK,uBAAuB,EAAuE,MAAM,kCAAkC,CAAC;AACrJ,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,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AC,EAAE,OAAO,CAAC;QACxB,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;QAClD,sBAAsB,CAAC,EAAE,uBAAuB,CAAC;QACjD,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;CACH;AAED,gBAAgB;AAChB,MAAM,WAAW,4BAA6B,SAAQ,kBAAkB;IACtE,qBAAqB;IACrB,cAAc,EAAE,IAAI,CAAC;CACtB;AAED,gBAAgB;AAChB,MAAM,WAAW,6BAA8B,SAAQ,kBAAkB;IACvE,qBAAqB;IACrB,eAAe,EAAE,IAAI,CAAC;CACvB;AAED,gBAAgB;AAChB,MAAM,WAAW,yBAA0B,SAAQ,kBAAkB;IACnE,qBAAqB;IACrB,WAAW,EAAE,sBAAsB,CAAC;CACrC;AAED,gBAAgB;AAChB,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D,qBAAqB;IACrB,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAED,qCAAqC;AACrC,MAAM,MAAM,cAAc,GACtB,kBAAkB,GAClB,yBAAyB,GACzB,yBAAyB,GACzB,4BAA4B,GAC5B,6BAA6B,GAC7B,yBAAyB,GACzB,qBAAqB,CAAC;AAE1B,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,GAAG,CAAC,cAAc,GAAG,cAAc,CAgFnF;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,cAAc,GAAG,GAAG,CAAC,cAAc,CA4DnF"}
@@ -22,22 +22,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.constructKeyboardButton = constructKeyboardButton;
23
23
  exports.keyboardButtonToTlObject = keyboardButtonToTlObject;
24
24
  const _0_deps_js_1 = require("../0_deps.js");
25
+ const _1_utilities_js_1 = require("../1_utilities.js");
25
26
  const _2_tl_js_1 = require("../2_tl.js");
27
+ const _0_button_style_js_1 = require("./0_button_style.js");
26
28
  const _0_chat_administrator_rights_js_1 = require("./0_chat_administrator_rights.js");
27
29
  function constructKeyboardButton(button_) {
30
+ const style = (0, _0_button_style_js_1.constructButtonStyle)(button_.style);
28
31
  if (_2_tl_js_1.Api.is("keyboardButton", button_)) {
29
- return { text: button_.text };
32
+ return (0, _1_utilities_js_1.cleanObject)({ text: button_.text, style });
30
33
  }
31
34
  else if (_2_tl_js_1.Api.is("keyboardButtonRequestPeer", button_)) {
32
35
  if (_2_tl_js_1.Api.is("requestPeerTypeUser", button_.peer_type)) {
33
- return {
36
+ return (0, _1_utilities_js_1.cleanObject)({
34
37
  text: button_.text,
35
38
  requestUser: {
36
39
  requestId: button_.button_id,
37
40
  userIsBot: button_.peer_type.bot || false,
38
41
  userIsPremium: button_.peer_type.premium || false,
39
42
  },
40
- };
43
+ style,
44
+ });
41
45
  }
42
46
  else if (_2_tl_js_1.Api.is("requestPeerTypeChat", button_.peer_type)) {
43
47
  const button = {
@@ -57,6 +61,9 @@ function constructKeyboardButton(button_) {
57
61
  if (button_.peer_type.user_admin_rights) {
58
62
  button.requestChat.userAdministratorRights = (0, _0_chat_administrator_rights_js_1.constructChatAdministratorRights)(button_.peer_type.user_admin_rights);
59
63
  }
64
+ if (style) {
65
+ button.style = style;
66
+ }
60
67
  return button;
61
68
  }
62
69
  else if (_2_tl_js_1.Api.is("requestPeerTypeBroadcast", button_.peer_type)) {
@@ -75,6 +82,9 @@ function constructKeyboardButton(button_) {
75
82
  if (button_.peer_type.user_admin_rights) {
76
83
  button.requestChat.userAdministratorRights = (0, _0_chat_administrator_rights_js_1.constructChatAdministratorRights)(button_.peer_type.user_admin_rights);
77
84
  }
85
+ if (style) {
86
+ button.style = style;
87
+ }
78
88
  return button;
79
89
  }
80
90
  else {
@@ -82,50 +92,93 @@ function constructKeyboardButton(button_) {
82
92
  }
83
93
  }
84
94
  else if (_2_tl_js_1.Api.is("keyboardButtonRequestPhone", button_)) {
85
- return { text: button_.text, requestContact: true };
95
+ return (0, _1_utilities_js_1.cleanObject)({ text: button_.text, requestContact: true, style });
86
96
  }
87
97
  else if (_2_tl_js_1.Api.is("keyboardButtonRequestGeoLocation", button_)) {
88
- return { text: button_.text, requestLocation: true };
98
+ return (0, _1_utilities_js_1.cleanObject)({ text: button_.text, requestLocation: true, style });
89
99
  }
90
100
  else if (_2_tl_js_1.Api.is("keyboardButtonRequestPoll", button_)) {
91
101
  const button = { text: button_.text, requestPoll: {} };
92
102
  if (button_.quiz) {
93
103
  button.requestPoll.type = "quiz";
94
104
  }
105
+ if (style) {
106
+ button.style = style;
107
+ }
95
108
  return button;
96
109
  }
97
110
  else if (_2_tl_js_1.Api.is("keyboardButtonWebView", button_) || _2_tl_js_1.Api.is("keyboardButtonSimpleWebView", button_)) {
98
- return { text: button_.text, miniApp: { url: button_.url } };
111
+ return (0, _1_utilities_js_1.cleanObject)({ text: button_.text, miniApp: { url: button_.url }, style });
99
112
  }
100
113
  else {
101
114
  (0, _0_deps_js_1.unreachable)();
102
115
  }
103
116
  }
104
117
  function keyboardButtonToTlObject(button) {
118
+ const style = (0, _0_button_style_js_1.buttonStyleToTlObject)(button.style);
105
119
  if ("requestUser" in button) {
106
- return { _: "keyboardButtonRequestPeer", text: button.text, button_id: button.requestUser.requestId, peer_type: ({ _: "requestPeerTypeUser", bot: button.requestUser.userIsBot, premium: button.requestUser.userIsPremium }), max_quantity: 1 };
120
+ return {
121
+ _: "keyboardButtonRequestPeer",
122
+ text: button.text,
123
+ button_id: button.requestUser.requestId,
124
+ peer_type: { _: "requestPeerTypeUser", bot: button.requestUser.userIsBot, premium: button.requestUser.userIsPremium },
125
+ max_quantity: 1,
126
+ style,
127
+ };
107
128
  }
108
129
  else if ("requestChat" in button) {
109
130
  if (!button.requestChat.chatIsChannel) { // GUESS
110
- return { _: "keyboardButtonRequestPeer", text: button.text, button_id: button.requestChat.requestId, peer_type: ({ _: "requestPeerTypeChat", forum: button.requestChat.chatIsForum, has_username: button.requestChat.chatHasUsername, creator: button.requestChat.chatIsCreated || undefined, bot_participant: button.requestChat.botIsMember || undefined, bot_admin_rights: button.requestChat.botAdministratorRights ? (0, _0_chat_administrator_rights_js_1.chatAdministratorRightsToTlObject)(button.requestChat.botAdministratorRights) : undefined, user_admin_rights: button.requestChat.userAdministratorRights ? (0, _0_chat_administrator_rights_js_1.chatAdministratorRightsToTlObject)(button.requestChat.userAdministratorRights) : undefined }), max_quantity: 1 };
131
+ return {
132
+ _: "keyboardButtonRequestPeer",
133
+ text: button.text,
134
+ button_id: button.requestChat.requestId,
135
+ peer_type: { _: "requestPeerTypeChat", forum: button.requestChat.chatIsForum, has_username: button.requestChat.chatHasUsername, creator: button.requestChat.chatIsCreated || undefined, bot_participant: button.requestChat.botIsMember || undefined, bot_admin_rights: button.requestChat.botAdministratorRights ? (0, _0_chat_administrator_rights_js_1.chatAdministratorRightsToTlObject)(button.requestChat.botAdministratorRights) : undefined, user_admin_rights: button.requestChat.userAdministratorRights ? (0, _0_chat_administrator_rights_js_1.chatAdministratorRightsToTlObject)(button.requestChat.userAdministratorRights) : undefined },
136
+ max_quantity: 1,
137
+ style,
138
+ };
111
139
  }
112
140
  else {
113
- return { _: "keyboardButtonRequestPeer", text: button.text, button_id: button.requestChat.requestId, peer_type: ({ _: "requestPeerTypeBroadcast", has_username: button.requestChat.chatHasUsername, creator: button.requestChat.chatIsCreated || undefined, bot_admin_rights: button.requestChat.botAdministratorRights ? (0, _0_chat_administrator_rights_js_1.chatAdministratorRightsToTlObject)(button.requestChat.botAdministratorRights) : undefined, user_admin_rights: button.requestChat.userAdministratorRights ? (0, _0_chat_administrator_rights_js_1.chatAdministratorRightsToTlObject)(button.requestChat.userAdministratorRights) : undefined }), max_quantity: 1 };
141
+ return {
142
+ _: "keyboardButtonRequestPeer",
143
+ text: button.text,
144
+ button_id: button.requestChat.requestId,
145
+ peer_type: { _: "requestPeerTypeBroadcast", has_username: button.requestChat.chatHasUsername, creator: button.requestChat.chatIsCreated || undefined, bot_admin_rights: button.requestChat.botAdministratorRights ? (0, _0_chat_administrator_rights_js_1.chatAdministratorRightsToTlObject)(button.requestChat.botAdministratorRights) : undefined, user_admin_rights: button.requestChat.userAdministratorRights ? (0, _0_chat_administrator_rights_js_1.chatAdministratorRightsToTlObject)(button.requestChat.userAdministratorRights) : undefined },
146
+ max_quantity: 1,
147
+ style,
148
+ };
114
149
  }
115
150
  }
116
151
  else if ("requestContact" in button) {
117
- return { _: "keyboardButtonRequestPhone", text: button.text };
152
+ return {
153
+ _: "keyboardButtonRequestPhone",
154
+ text: button.text,
155
+ style,
156
+ };
118
157
  }
119
158
  else if ("requestLocation" in button) {
120
- return { _: "keyboardButtonRequestGeoLocation", text: button.text };
159
+ return {
160
+ _: "keyboardButtonRequestGeoLocation",
161
+ text: button.text,
162
+ style,
163
+ };
121
164
  }
122
165
  else if ("requestPoll" in button) {
123
- return { _: "keyboardButtonRequestPoll", text: button.text, quiz: button.requestPoll.type === "quiz" };
166
+ return {
167
+ _: "keyboardButtonRequestPoll",
168
+ text: button.text,
169
+ quiz: button.requestPoll.type === "quiz",
170
+ style,
171
+ };
124
172
  }
125
173
  else if ("miniApp" in button) {
126
- return { _: "keyboardButtonWebView", text: button.text, url: button.miniApp.url };
174
+ return {
175
+ _: "keyboardButtonWebView",
176
+ text: button.text,
177
+ url: button.miniApp.url,
178
+ style,
179
+ };
127
180
  }
128
181
  else {
129
- return { _: "keyboardButton", text: button.text };
182
+ return { _: "keyboardButton", text: button.text, style };
130
183
  }
131
184
  }
@@ -118,7 +118,7 @@ function messageEntityToTlObject(entity, getPeer) {
118
118
  if (!peer) {
119
119
  (0, _0_deps_js_1.unreachable)();
120
120
  }
121
- return { _: "inputMessageEntityMentionName", offset, length, user_id: ({ _: "inputUser", user_id: BigInt(peer[0].id), access_hash: peer[1] }) };
121
+ return { _: "inputMessageEntityMentionName", offset, length, user_id: { _: "inputUser", user_id: BigInt(peer[0].id), access_hash: peer[1] } };
122
122
  }
123
123
  }
124
124
  }
@@ -132,7 +132,7 @@ function messageEntityToTlObject(entity, getPeer) {
132
132
  if (!peer) {
133
133
  (0, _0_deps_js_1.unreachable)();
134
134
  }
135
- return { _: "inputMessageEntityMentionName", offset, length, user_id: ({ _: "inputUser", user_id: BigInt(peer[0].id), access_hash: peer[1] }) };
135
+ return { _: "inputMessageEntityMentionName", offset, length, user_id: { _: "inputUser", user_id: BigInt(peer[0].id), access_hash: peer[1] } };
136
136
  }
137
137
  case "cashtag":
138
138
  return { _: "messageEntityCashtag", offset, length };
@@ -331,7 +331,7 @@ async function inlineQueryResultToTlObject(result_, parseText, usernameResolver)
331
331
  const title = "title" in result_ ? result_.title : undefined;
332
332
  const description = "description" in result_ ? result_.description : undefined;
333
333
  if (document !== null) {
334
- return { _: "inputBotInlineResult", id, type, title, description, thumb: thumb === null ? undefined : thumb, content: document, send_message: ({ _: "inputBotInlineMessageMediaAuto", message, entities, reply_markup: replyMarkup }) };
334
+ return { _: "inputBotInlineResult", id, type, title, description, thumb: thumb === null ? undefined : thumb, content: document, send_message: { _: "inputBotInlineMessageMediaAuto", message, entities, reply_markup: replyMarkup } };
335
335
  }
336
336
  else if (fileId_ !== null) {
337
337
  const fileId = (0, _file_id_js_1.deserializeFileId)(fileId_);
@@ -341,20 +341,20 @@ async function inlineQueryResultToTlObject(result_, parseText, usernameResolver)
341
341
  type: type === "document" ? "file" : type,
342
342
  title,
343
343
  description,
344
- document: ({
344
+ document: {
345
345
  _: "inputDocument",
346
346
  id: "id" in fileId.location ? fileId.location.id : (0, _0_deps_js_1.unreachable)(),
347
347
  access_hash: fileId.location.accessHash,
348
348
  file_reference: fileId.fileReference ?? new Uint8Array(),
349
- }),
349
+ },
350
350
  send_message: sendMessage,
351
351
  };
352
352
  }
353
353
  else if (result_.type === "location") {
354
- return { _: "inputBotInlineResult", id, type, title, description, thumb: thumb === null ? undefined : thumb, send_message: ({ _: "inputBotInlineMessageMediaGeo", geo_point: ({ _: "inputGeoPoint", lat: result_.latitude, long: result_.longitude, accuracy_radius: result_.horizontalAccuracy }), heading: result_.heading, period: result_.livePeriod, proximity_notification_radius: result_.proximityAlertRadius, reply_markup: replyMarkup }) };
354
+ return { _: "inputBotInlineResult", id, type, title, description, thumb: thumb === null ? undefined : thumb, send_message: { _: "inputBotInlineMessageMediaGeo", geo_point: { _: "inputGeoPoint", lat: result_.latitude, long: result_.longitude, accuracy_radius: result_.horizontalAccuracy }, heading: result_.heading, period: result_.livePeriod, proximity_notification_radius: result_.proximityAlertRadius, reply_markup: replyMarkup } };
355
355
  }
356
356
  else if (result_.type === "game") {
357
- return { _: "inputBotInlineResult", id, type, title, description, thumb: thumb === null ? undefined : thumb, send_message: ({ _: "inputBotInlineMessageGame", reply_markup: replyMarkup }) };
357
+ return { _: "inputBotInlineResult", id, type, title, description, thumb: thumb === null ? undefined : thumb, send_message: { _: "inputBotInlineMessageGame", reply_markup: replyMarkup } };
358
358
  }
359
359
  else if (result_.type === "article") {
360
360
  if (!("text" in result_.messageContent)) {
@@ -376,7 +376,7 @@ async function inlineQueryResultToTlObject(result_, parseText, usernameResolver)
376
376
  if (!result_.foursquareId || !result_.foursquareType) {
377
377
  (0, _0_deps_js_1.unreachable)();
378
378
  }
379
- return { _: "inputBotInlineResult", id, type, title, description, thumb: thumb === null ? undefined : thumb, send_message: ({ _: "inputBotInlineMessageMediaVenue", geo_point: ({ _: "inputGeoPoint", long: result_.longitude, lat: result_.latitude }), address: result_.address, provider: "foursquare", title: result_.title, venue_id: result_.foursquareId, venue_type: result_.foursquareType, reply_markup: replyMarkup }) };
379
+ return { _: "inputBotInlineResult", id, type, title, description, thumb: thumb === null ? undefined : thumb, send_message: { _: "inputBotInlineMessageMediaVenue", geo_point: { _: "inputGeoPoint", long: result_.longitude, lat: result_.latitude }, address: result_.address, provider: "foursquare", title: result_.title, venue_id: result_.foursquareId, venue_type: result_.foursquareType, reply_markup: replyMarkup } };
380
380
  }
381
381
  else {
382
382
  (0, _0_deps_js_1.unreachable)();