@mtkruto/node 0.1.139 → 0.1.140

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 (287) hide show
  1. package/esm/3_types.d.ts +10 -36
  2. package/esm/3_types.js +10 -36
  3. package/esm/4_constants.d.ts +1 -1
  4. package/esm/4_constants.js +1 -1
  5. package/esm/5_client.d.ts +1 -1
  6. package/esm/5_client.js +1 -1
  7. package/esm/_dnt.polyfills.d.ts +6 -0
  8. package/esm/client/0_filters.d.ts +60 -0
  9. package/esm/client/0_filters.js +27 -0
  10. package/esm/client/0_message.js +2 -2
  11. package/esm/client/{3_params.d.ts → 0_params.d.ts} +30 -33
  12. package/esm/client/0_types.d.ts +39 -0
  13. package/esm/client/0_types.js +2 -0
  14. package/esm/client/0_utilities.d.ts +1 -47
  15. package/esm/client/0_utilities.js +0 -27
  16. package/esm/client/1_composer.d.ts +1 -1
  17. package/esm/client/1_composer.js +1 -1
  18. package/esm/client/1_file_manager.d.ts +10 -0
  19. package/esm/client/1_file_manager.js +241 -0
  20. package/esm/client/1_update_manager.d.ts +18 -0
  21. package/esm/client/1_update_manager.js +553 -0
  22. package/esm/client/2_message_manager.d.ts +40 -0
  23. package/esm/client/2_message_manager.js +621 -0
  24. package/esm/client/3_chat_list_manager.d.ts +21 -0
  25. package/esm/client/3_chat_list_manager.js +353 -0
  26. package/esm/client/3_reaction_manager.d.ts +16 -0
  27. package/esm/client/3_reaction_manager.js +61 -0
  28. package/esm/client/4_client.d.ts +187 -60
  29. package/esm/client/4_client.js +492 -1698
  30. package/esm/connection/1_connection_web_socket.js +6 -6
  31. package/esm/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.d.ts +1 -1
  32. package/esm/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.js +1 -1
  33. package/esm/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.d.ts +1 -0
  34. package/esm/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.js +524 -0
  35. package/esm/mod.d.ts +1 -0
  36. package/esm/mod.js +1 -0
  37. package/esm/storage/0_storage.d.ts +5 -3
  38. package/esm/storage/0_storage.js +14 -4
  39. package/esm/tl/1_tl_object.d.ts +1 -0
  40. package/esm/tl/1_tl_object.js +24 -0
  41. package/esm/types/0_bot_command.d.ts +1 -0
  42. package/esm/types/0_chat_member_rights.d.ts +37 -0
  43. package/esm/types/0_chat_photo.d.ts +4 -4
  44. package/esm/types/0_file_source.d.ts +5 -0
  45. package/esm/types/0_giveaway_parameters.js +2 -1
  46. package/esm/types/0_id.d.ts +4 -0
  47. package/esm/types/0_message_entity.d.ts +20 -20
  48. package/esm/types/1__getters.d.ts +2 -2
  49. package/esm/types/1_animation.d.ts +1 -1
  50. package/esm/types/1_bot_command_scope.d.ts +5 -4
  51. package/esm/types/1_chat_p.d.ts +5 -6
  52. package/esm/types/1_document.d.ts +1 -0
  53. package/esm/types/1_input_message_content.d.ts +88 -0
  54. package/esm/types/1_photo.d.ts +1 -1
  55. package/esm/types/1_sticker.d.ts +1 -1
  56. package/esm/types/1_user.d.ts +1 -1
  57. package/esm/types/1_video.d.ts +1 -1
  58. package/esm/types/1_video_note.d.ts +1 -1
  59. package/esm/types/2_inline_keyboard_button.d.ts +10 -10
  60. package/esm/types/2_message_reaction_count.d.ts +3 -0
  61. package/esm/types/2_message_reaction_count.js +17 -1
  62. package/esm/types/2_message_reactions.d.ts +15 -0
  63. package/esm/types/2_message_reactions.js +37 -0
  64. package/esm/types/3_reply_markup.d.ts +42 -0
  65. package/esm/types/3_reply_markup.js +117 -0
  66. package/esm/types/4_inline_query_result.d.ts +193 -0
  67. package/esm/types/{5_inline_query_result.js → 4_inline_query_result.js} +2 -2
  68. package/esm/types/4_message.d.ts +36 -39
  69. package/esm/types/4_message.js +7 -24
  70. package/esm/types/5_callback_query.d.ts +2 -1
  71. package/esm/types/5_chat.d.ts +8 -5
  72. package/esm/types/6_update.d.ts +12 -2
  73. package/esm/utilities/0_buffer.js +9 -6
  74. package/esm/utilities/0_object.d.ts +1 -1
  75. package/esm/utilities/0_object.js +1 -6
  76. package/esm/utilities/1_misc.d.ts +2 -0
  77. package/esm/utilities/1_misc.js +6 -0
  78. package/package.json +1 -2
  79. package/script/3_types.d.ts +10 -36
  80. package/script/3_types.js +10 -36
  81. package/script/4_constants.d.ts +1 -1
  82. package/script/4_constants.js +1 -1
  83. package/script/5_client.d.ts +1 -1
  84. package/script/5_client.js +1 -1
  85. package/script/_dnt.polyfills.d.ts +6 -0
  86. package/script/client/0_filters.d.ts +60 -0
  87. package/script/client/0_filters.js +31 -0
  88. package/script/client/0_message.js +1 -1
  89. package/script/client/{3_params.d.ts → 0_params.d.ts} +30 -33
  90. package/script/client/0_types.d.ts +39 -0
  91. package/script/client/0_types.js +6 -0
  92. package/script/client/0_utilities.d.ts +1 -47
  93. package/script/client/0_utilities.js +1 -29
  94. package/script/client/1_composer.d.ts +1 -1
  95. package/script/client/1_composer.js +2 -2
  96. package/script/client/1_file_manager.d.ts +10 -0
  97. package/script/client/1_file_manager.js +245 -0
  98. package/script/client/1_update_manager.d.ts +18 -0
  99. package/script/client/1_update_manager.js +557 -0
  100. package/script/client/2_message_manager.d.ts +40 -0
  101. package/script/client/2_message_manager.js +625 -0
  102. package/script/client/3_chat_list_manager.d.ts +21 -0
  103. package/script/client/3_chat_list_manager.js +357 -0
  104. package/script/client/3_reaction_manager.d.ts +16 -0
  105. package/script/client/3_reaction_manager.js +65 -0
  106. package/script/client/4_client.d.ts +187 -60
  107. package/script/client/4_client.js +491 -1698
  108. package/script/connection/1_connection_web_socket.js +5 -5
  109. package/script/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.d.ts +1 -1
  110. package/script/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.js +2 -2
  111. package/script/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.d.ts +1 -0
  112. package/script/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.js +550 -0
  113. package/script/mod.d.ts +1 -0
  114. package/script/mod.js +1 -0
  115. package/script/storage/0_storage.d.ts +5 -3
  116. package/script/storage/0_storage.js +14 -4
  117. package/script/tl/1_tl_object.d.ts +1 -0
  118. package/script/tl/1_tl_object.js +24 -0
  119. package/script/types/0_bot_command.d.ts +1 -0
  120. package/script/types/0_chat_member_rights.d.ts +37 -0
  121. package/script/types/0_chat_photo.d.ts +4 -4
  122. package/script/types/0_file_source.d.ts +5 -0
  123. package/script/types/0_giveaway_parameters.js +2 -1
  124. package/script/types/0_id.d.ts +4 -0
  125. package/script/types/0_message_entity.d.ts +20 -20
  126. package/script/types/1__getters.d.ts +2 -2
  127. package/script/types/1_animation.d.ts +1 -1
  128. package/script/types/1_bot_command_scope.d.ts +5 -4
  129. package/script/types/1_chat_p.d.ts +5 -6
  130. package/script/types/1_document.d.ts +1 -0
  131. package/script/types/1_input_message_content.d.ts +88 -0
  132. package/script/types/1_photo.d.ts +1 -1
  133. package/script/types/1_sticker.d.ts +1 -1
  134. package/script/types/1_user.d.ts +1 -1
  135. package/script/types/1_video.d.ts +1 -1
  136. package/script/types/1_video_note.d.ts +1 -1
  137. package/script/types/2_inline_keyboard_button.d.ts +10 -10
  138. package/script/types/2_message_reaction_count.d.ts +3 -0
  139. package/script/types/2_message_reaction_count.js +19 -0
  140. package/script/types/2_message_reactions.d.ts +15 -0
  141. package/script/types/2_message_reactions.js +41 -0
  142. package/script/types/3_reply_markup.d.ts +42 -0
  143. package/script/types/3_reply_markup.js +122 -0
  144. package/script/types/4_inline_query_result.d.ts +193 -0
  145. package/script/types/{5_inline_query_result.js → 4_inline_query_result.js} +3 -3
  146. package/script/types/4_message.d.ts +36 -39
  147. package/script/types/4_message.js +6 -23
  148. package/script/types/5_callback_query.d.ts +2 -1
  149. package/script/types/5_chat.d.ts +8 -5
  150. package/script/types/6_update.d.ts +12 -2
  151. package/script/utilities/0_buffer.js +9 -6
  152. package/script/utilities/0_object.d.ts +1 -1
  153. package/script/utilities/0_object.js +1 -6
  154. package/script/utilities/1_misc.d.ts +2 -0
  155. package/script/utilities/1_misc.js +9 -1
  156. package/esm/types/0_chat_id.d.ts +0 -4
  157. package/esm/types/0_force_reply.d.ts +0 -12
  158. package/esm/types/0_force_reply.js +0 -17
  159. package/esm/types/0_input_contact_message_content.d.ts +0 -11
  160. package/esm/types/0_input_location_message_content.d.ts +0 -15
  161. package/esm/types/0_input_venue_message_content.d.ts +0 -19
  162. package/esm/types/0_reply_keyboard_remove.d.ts +0 -10
  163. package/esm/types/0_reply_keyboard_remove.js +0 -8
  164. package/esm/types/1_input_invoice_message_content.d.ts +0 -23
  165. package/esm/types/1_input_text_message_content.d.ts +0 -8
  166. package/esm/types/1_input_text_message_content.js +0 -1
  167. package/esm/types/2_input_message_content.d.ts +0 -6
  168. package/esm/types/2_input_message_content.js +0 -1
  169. package/esm/types/2_reply_keyboard_markup.d.ts +0 -12
  170. package/esm/types/2_reply_keyboard_markup.js +0 -37
  171. package/esm/types/3_inline_keyboard_markup.d.ts +0 -8
  172. package/esm/types/3_inline_keyboard_markup.js +0 -24
  173. package/esm/types/4_inline_query_result_article.d.ts +0 -15
  174. package/esm/types/4_inline_query_result_article.js +0 -1
  175. package/esm/types/4_inline_query_result_audio.d.ts +0 -17
  176. package/esm/types/4_inline_query_result_audio.js +0 -1
  177. package/esm/types/4_inline_query_result_cached_audio.d.ts +0 -14
  178. package/esm/types/4_inline_query_result_cached_audio.js +0 -1
  179. package/esm/types/4_inline_query_result_cached_document.d.ts +0 -15
  180. package/esm/types/4_inline_query_result_cached_document.js +0 -1
  181. package/esm/types/4_inline_query_result_cached_gif.d.ts +0 -15
  182. package/esm/types/4_inline_query_result_cached_gif.js +0 -1
  183. package/esm/types/4_inline_query_result_cached_mpeg4_gif.d.ts +0 -15
  184. package/esm/types/4_inline_query_result_cached_mpeg4_gif.js +0 -1
  185. package/esm/types/4_inline_query_result_cached_photo.d.ts +0 -16
  186. package/esm/types/4_inline_query_result_cached_photo.js +0 -1
  187. package/esm/types/4_inline_query_result_cached_sticker.d.ts +0 -9
  188. package/esm/types/4_inline_query_result_cached_sticker.js +0 -1
  189. package/esm/types/4_inline_query_result_cached_video.d.ts +0 -16
  190. package/esm/types/4_inline_query_result_cached_video.js +0 -1
  191. package/esm/types/4_inline_query_result_cached_voice.d.ts +0 -15
  192. package/esm/types/4_inline_query_result_cached_voice.js +0 -1
  193. package/esm/types/4_inline_query_result_contact.d.ts +0 -15
  194. package/esm/types/4_inline_query_result_contact.js +0 -1
  195. package/esm/types/4_inline_query_result_document.d.ts +0 -18
  196. package/esm/types/4_inline_query_result_document.js +0 -1
  197. package/esm/types/4_inline_query_result_game.d.ts +0 -7
  198. package/esm/types/4_inline_query_result_game.js +0 -1
  199. package/esm/types/4_inline_query_result_gif.d.ts +0 -20
  200. package/esm/types/4_inline_query_result_gif.js +0 -1
  201. package/esm/types/4_inline_query_result_location.d.ts +0 -18
  202. package/esm/types/4_inline_query_result_location.js +0 -1
  203. package/esm/types/4_inline_query_result_mpeg4_gif.d.ts +0 -20
  204. package/esm/types/4_inline_query_result_mpeg4_gif.js +0 -1
  205. package/esm/types/4_inline_query_result_photo.d.ts +0 -19
  206. package/esm/types/4_inline_query_result_photo.js +0 -1
  207. package/esm/types/4_inline_query_result_venue.d.ts +0 -19
  208. package/esm/types/4_inline_query_result_venue.js +0 -1
  209. package/esm/types/4_inline_query_result_video.d.ts +0 -21
  210. package/esm/types/4_inline_query_result_video.js +0 -1
  211. package/esm/types/4_inline_query_result_voice.d.ts +0 -16
  212. package/esm/types/4_inline_query_result_voice.js +0 -1
  213. package/esm/types/4_reply_markup.d.ts +0 -7
  214. package/esm/types/4_reply_markup.js +0 -22
  215. package/esm/types/5_inline_query_result.d.ts +0 -28
  216. package/script/types/0_chat_id.d.ts +0 -4
  217. package/script/types/0_force_reply.d.ts +0 -12
  218. package/script/types/0_force_reply.js +0 -22
  219. package/script/types/0_input_contact_message_content.d.ts +0 -11
  220. package/script/types/0_input_location_message_content.d.ts +0 -15
  221. package/script/types/0_input_venue_message_content.d.ts +0 -19
  222. package/script/types/0_reply_keyboard_remove.d.ts +0 -10
  223. package/script/types/0_reply_keyboard_remove.js +0 -13
  224. package/script/types/1_input_invoice_message_content.d.ts +0 -23
  225. package/script/types/1_input_text_message_content.d.ts +0 -8
  226. package/script/types/1_input_text_message_content.js +0 -2
  227. package/script/types/2_input_message_content.d.ts +0 -6
  228. package/script/types/2_input_message_content.js +0 -2
  229. package/script/types/2_reply_keyboard_markup.d.ts +0 -12
  230. package/script/types/2_reply_keyboard_markup.js +0 -42
  231. package/script/types/3_inline_keyboard_markup.d.ts +0 -8
  232. package/script/types/3_inline_keyboard_markup.js +0 -29
  233. package/script/types/4_inline_query_result_article.d.ts +0 -15
  234. package/script/types/4_inline_query_result_article.js +0 -2
  235. package/script/types/4_inline_query_result_audio.d.ts +0 -17
  236. package/script/types/4_inline_query_result_audio.js +0 -2
  237. package/script/types/4_inline_query_result_cached_audio.d.ts +0 -14
  238. package/script/types/4_inline_query_result_cached_audio.js +0 -2
  239. package/script/types/4_inline_query_result_cached_document.d.ts +0 -15
  240. package/script/types/4_inline_query_result_cached_document.js +0 -2
  241. package/script/types/4_inline_query_result_cached_gif.d.ts +0 -15
  242. package/script/types/4_inline_query_result_cached_gif.js +0 -2
  243. package/script/types/4_inline_query_result_cached_mpeg4_gif.d.ts +0 -15
  244. package/script/types/4_inline_query_result_cached_mpeg4_gif.js +0 -2
  245. package/script/types/4_inline_query_result_cached_photo.d.ts +0 -16
  246. package/script/types/4_inline_query_result_cached_photo.js +0 -2
  247. package/script/types/4_inline_query_result_cached_sticker.d.ts +0 -9
  248. package/script/types/4_inline_query_result_cached_sticker.js +0 -2
  249. package/script/types/4_inline_query_result_cached_video.d.ts +0 -16
  250. package/script/types/4_inline_query_result_cached_video.js +0 -2
  251. package/script/types/4_inline_query_result_cached_voice.d.ts +0 -15
  252. package/script/types/4_inline_query_result_cached_voice.js +0 -2
  253. package/script/types/4_inline_query_result_contact.d.ts +0 -15
  254. package/script/types/4_inline_query_result_contact.js +0 -2
  255. package/script/types/4_inline_query_result_document.d.ts +0 -18
  256. package/script/types/4_inline_query_result_document.js +0 -2
  257. package/script/types/4_inline_query_result_game.d.ts +0 -7
  258. package/script/types/4_inline_query_result_game.js +0 -2
  259. package/script/types/4_inline_query_result_gif.d.ts +0 -20
  260. package/script/types/4_inline_query_result_gif.js +0 -2
  261. package/script/types/4_inline_query_result_location.d.ts +0 -18
  262. package/script/types/4_inline_query_result_location.js +0 -2
  263. package/script/types/4_inline_query_result_mpeg4_gif.d.ts +0 -20
  264. package/script/types/4_inline_query_result_mpeg4_gif.js +0 -2
  265. package/script/types/4_inline_query_result_photo.d.ts +0 -19
  266. package/script/types/4_inline_query_result_photo.js +0 -2
  267. package/script/types/4_inline_query_result_venue.d.ts +0 -19
  268. package/script/types/4_inline_query_result_venue.js +0 -2
  269. package/script/types/4_inline_query_result_video.d.ts +0 -21
  270. package/script/types/4_inline_query_result_video.js +0 -2
  271. package/script/types/4_inline_query_result_voice.d.ts +0 -16
  272. package/script/types/4_inline_query_result_voice.js +0 -2
  273. package/script/types/4_reply_markup.d.ts +0 -7
  274. package/script/types/4_reply_markup.js +0 -26
  275. package/script/types/5_inline_query_result.d.ts +0 -28
  276. /package/esm/{client/3_params.js → _dnt.polyfills.js} +0 -0
  277. /package/esm/{types/0_chat_id.js → client/0_params.js} +0 -0
  278. /package/esm/types/{0_input_contact_message_content.js → 0_chat_member_rights.js} +0 -0
  279. /package/esm/types/{0_input_location_message_content.js → 0_file_source.js} +0 -0
  280. /package/esm/types/{0_input_venue_message_content.js → 0_id.js} +0 -0
  281. /package/esm/types/{1_input_invoice_message_content.js → 1_input_message_content.js} +0 -0
  282. /package/script/{client/3_params.js → _dnt.polyfills.js} +0 -0
  283. /package/script/{types/0_chat_id.js → client/0_params.js} +0 -0
  284. /package/script/types/{0_input_contact_message_content.js → 0_chat_member_rights.js} +0 -0
  285. /package/script/types/{0_input_location_message_content.js → 0_file_source.js} +0 -0
  286. /package/script/types/{0_input_venue_message_content.js → 0_id.js} +0 -0
  287. /package/script/types/{1_input_invoice_message_content.js → 1_input_message_content.js} +0 -0
@@ -33,6 +33,7 @@ export declare abstract class TLObject {
33
33
  get [length](): number;
34
34
  [serialize](): Uint8Array;
35
35
  [as]<T extends TLObjectConstructor<InstanceType<T>>>(constructor: T): InstanceType<T>;
36
+ toJSON(): Record<string, any>;
36
37
  }
37
38
  export interface TLObjectConstructor<T = TLObject> {
38
39
  new (params: any): T;
@@ -171,6 +171,30 @@ export class TLObject {
171
171
  throw new TypeError(`Expected ${constructor[name]} but received ${this[name]}`);
172
172
  }
173
173
  }
174
+ toJSON() {
175
+ // deno-lint-ignore no-explicit-any
176
+ const r = { _: this[name] + `#${this[id].toString(16).toUpperCase()}` };
177
+ const desc = this.constructor[paramDesc];
178
+ for (const [name] of desc) {
179
+ const n = name;
180
+ if (n in this && this[n] !== undefined) {
181
+ if (typeof this[n] === "bigint") {
182
+ r[name] = String(this[n]);
183
+ }
184
+ else if (this[n] instanceof Uint8Array) {
185
+ const buffer = this[n];
186
+ r[name] = "";
187
+ for (const b of buffer) {
188
+ r[name] += b.toString(16).padStart(2, "0").toUpperCase();
189
+ }
190
+ }
191
+ else {
192
+ r[name] = this[n];
193
+ }
194
+ }
195
+ }
196
+ return r;
197
+ }
174
198
  }
175
199
  export function isTLObjectConstructor(t) {
176
200
  // deno-lint-ignore no-explicit-any
@@ -1,3 +1,4 @@
1
+ /** A bot command. */
1
2
  export interface BotCommand {
2
3
  /** The command's name. */
3
4
  command: string;
@@ -0,0 +1,37 @@
1
+ /** The rights of a chat member. */
2
+ export interface ChatMemberRights {
3
+ /** Whether messages are allowed to be sent. */
4
+ canSendMessages?: boolean;
5
+ /** Whether audio files are allowed to be sent. */
6
+ canSendAudio?: boolean;
7
+ /** Whether files are allowed to be sent. */
8
+ canSendDocuments?: boolean;
9
+ /** Whether photos are allowed to be sent. */
10
+ canSendPhotos?: boolean;
11
+ /** Whether videos are allowed to be sent. */
12
+ canSendVideos?: boolean;
13
+ /** Whether video notes are allowed to be sent. */
14
+ canSendVideoNotes?: boolean;
15
+ /** Whether voice messages are allowed to be sent. */
16
+ canSendVoice?: boolean;
17
+ /** Whether polls are allowed to be sent. */
18
+ canSendPolls?: boolean;
19
+ /** Whether stickers are allowed to be sent. */
20
+ canSendStickers?: boolean;
21
+ /** Whether animations are allowed to be sent. */
22
+ canSendAnimations?: boolean;
23
+ /** Whether games are allowed to be sent. */
24
+ canSendGames?: boolean;
25
+ /** Whether inline bot results are allowed to be sent. */
26
+ canSendInlineBotResults?: boolean;
27
+ /** Whether it is allowed to add web page previews. */
28
+ canAddWebPagePreviews?: boolean;
29
+ /** Whether it is allowed to change the chat info. Ignored for supergroups. */
30
+ canChangeInfo?: boolean;
31
+ /** Whether it is allowed to invite users. */
32
+ canInviteUsers?: boolean;
33
+ /** Whether it is allowed to pin messages. */
34
+ canPinMessages?: boolean;
35
+ /** Whether it is allowed to manage topics. */
36
+ canManageTopics?: boolean;
37
+ }
@@ -1,6 +1,6 @@
1
1
  import { types } from "../2_tl.js";
2
2
  /** @unlisted */
3
- export interface ChatPhotoBase {
3
+ export interface _ChatPhotoBase {
4
4
  /** A file identifier that can be used to download or reuse the small version of the chat photo (160x160). */
5
5
  smallFileId: string;
6
6
  /** A file identifier that can be used to identify the small version of the chat photo (160x160). */
@@ -13,13 +13,13 @@ export interface ChatPhotoBase {
13
13
  hasVideo: boolean;
14
14
  }
15
15
  /** @unlisted */
16
- export interface ChatPhotoUser extends ChatPhotoBase {
16
+ export interface ChatPhotoUser extends _ChatPhotoBase {
17
17
  /** Differentiates between user profile photos. */
18
18
  personal: true;
19
19
  }
20
20
  /** @unlisted */
21
- export type ChatPhotoChat = ChatPhotoBase;
22
- /** This object represents a chat photo. */
21
+ export type ChatPhotoChat = _ChatPhotoBase;
22
+ /** A chat photo. */
23
23
  export type ChatPhoto = ChatPhotoUser | ChatPhotoChat;
24
24
  export declare function constructChatPhoto(photo: types.ChatPhoto, chatId: number, chatAccessHash: bigint): ChatPhotoChat;
25
25
  export declare function constructChatPhoto(photo: types.UserProfilePhoto, chatId: number, chatAccessHash: bigint): ChatPhotoUser;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Source to a file. Can be a file ID, a file path, URL, or a `Uint8Array`, unless otherwise noted.
3
+ * @unlisted
4
+ */
5
+ export type FileSource = string | URL | Uint8Array;
@@ -1,9 +1,10 @@
1
+ import { fromUnixTimestamp } from "../1_utilities.js";
1
2
  import { peerToChatId, types } from "../2_tl.js";
2
3
  export function constructGiveawayParameters(g) {
3
4
  const countries = g.countries_iso2 ?? [];
4
5
  const boostedChatId = peerToChatId(new types.PeerChannel({ channel_id: g.channels[0] }));
5
6
  const additionalChatIds = g.channels.slice(1).map((v) => peerToChatId(new types.PeerChannel({ channel_id: v })));
6
7
  const onlyNewMembers = g.only_new_subscribers ? true : false;
7
- const winnerSelectionDate = new Date(g.until_date * 1000);
8
+ const winnerSelectionDate = fromUnixTimestamp(g.until_date);
8
9
  return { boostedChatId, additionalChatIds, winnerSelectionDate, onlyNewMembers, countries };
9
10
  }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * The identifier of a channel, a group, or a user (as provided by MTKruto), a username, or a chat link (e.g., https://mtkruto.t.me, https://telegram.me/mtkruto).
3
+ */
4
+ export type ID = number | string;
@@ -2,91 +2,91 @@ import { enums } from "../2_tl.js";
2
2
  /** @unlisted */
3
3
  export type MessageEntityType = "mention" | "hashtag" | "botCommand" | "url" | "email" | "bold" | "italic" | "code" | "pre" | "textLink" | "textMention" | "cashtag" | "phoneNumber" | "underline" | "strikethrough" | "blockquote" | "bankCard" | "spoiler" | "customEmoji";
4
4
  /** @unlisted */
5
- export interface MessageEntityBase {
5
+ export interface _MessageEntityBase {
6
6
  type: MessageEntityType;
7
7
  offset: number;
8
8
  length: number;
9
9
  }
10
10
  /** @unlisted */
11
- export interface MessageEntityMention extends MessageEntityBase {
11
+ export interface MessageEntityMention extends _MessageEntityBase {
12
12
  type: "mention";
13
13
  }
14
14
  /** @unlisted */
15
- export interface MessageEntityHashtag extends MessageEntityBase {
15
+ export interface MessageEntityHashtag extends _MessageEntityBase {
16
16
  type: "hashtag";
17
17
  }
18
18
  /** @unlisted */
19
- export interface MessageEntityBotCommand extends MessageEntityBase {
19
+ export interface MessageEntityBotCommand extends _MessageEntityBase {
20
20
  type: "botCommand";
21
21
  }
22
22
  /** @unlisted */
23
- export interface MessageEntityURL extends MessageEntityBase {
23
+ export interface MessageEntityURL extends _MessageEntityBase {
24
24
  type: "url";
25
25
  }
26
26
  /** @unlisted */
27
- export interface MessageEntityEmailAddress extends MessageEntityBase {
27
+ export interface MessageEntityEmailAddress extends _MessageEntityBase {
28
28
  type: "email";
29
29
  }
30
30
  /** @unlisted */
31
- export interface MessageEntityBold extends MessageEntityBase {
31
+ export interface MessageEntityBold extends _MessageEntityBase {
32
32
  type: "bold";
33
33
  }
34
34
  /** @unlisted */
35
- export interface MessageEntityItalic extends MessageEntityBase {
35
+ export interface MessageEntityItalic extends _MessageEntityBase {
36
36
  type: "italic";
37
37
  }
38
38
  /** @unlisted */
39
- export interface MessageEntityPre extends MessageEntityBase {
39
+ export interface MessageEntityPre extends _MessageEntityBase {
40
40
  type: "pre";
41
41
  /** The language identifier of the code. */
42
42
  language: string;
43
43
  }
44
44
  /** @unlisted */
45
- export interface MessageEntityCode extends MessageEntityBase {
45
+ export interface MessageEntityCode extends _MessageEntityBase {
46
46
  type: "code";
47
47
  }
48
48
  /** @unlisted */
49
- export interface MessageEntityTextLink extends MessageEntityBase {
49
+ export interface MessageEntityTextLink extends _MessageEntityBase {
50
50
  type: "textLink";
51
51
  /** A URL that will be opened after the text is tapped. */
52
52
  url: string;
53
53
  }
54
54
  /** @unlisted */
55
- export interface MessageEntityTextMention extends MessageEntityBase {
55
+ export interface MessageEntityTextMention extends _MessageEntityBase {
56
56
  type: "textMention";
57
57
  /** The identifier of the user to mention. */
58
58
  userId: number;
59
59
  }
60
60
  /** @unlisted */
61
- export interface MessageEntityCashtag extends MessageEntityBase {
61
+ export interface MessageEntityCashtag extends _MessageEntityBase {
62
62
  type: "cashtag";
63
63
  }
64
64
  /** @unlisted */
65
- export interface MessageEntityPhoneNumber extends MessageEntityBase {
65
+ export interface MessageEntityPhoneNumber extends _MessageEntityBase {
66
66
  type: "phoneNumber";
67
67
  }
68
68
  /** @unlisted */
69
- export interface MessageEntityUnderline extends MessageEntityBase {
69
+ export interface MessageEntityUnderline extends _MessageEntityBase {
70
70
  type: "underline";
71
71
  }
72
72
  /** @unlisted */
73
- export interface MessageEntityStrikethrough extends MessageEntityBase {
73
+ export interface MessageEntityStrikethrough extends _MessageEntityBase {
74
74
  type: "strikethrough";
75
75
  }
76
76
  /** @unlisted */
77
- export interface MessageEntityBlockquote extends MessageEntityBase {
77
+ export interface MessageEntityBlockquote extends _MessageEntityBase {
78
78
  type: "blockquote";
79
79
  }
80
80
  /** @unlisted */
81
- export interface MessageEntityBankCard extends MessageEntityBase {
81
+ export interface MessageEntityBankCard extends _MessageEntityBase {
82
82
  type: "bankCard";
83
83
  }
84
84
  /** @unlisted */
85
- export interface MessageEntitySpoiler extends MessageEntityBase {
85
+ export interface MessageEntitySpoiler extends _MessageEntityBase {
86
86
  type: "spoiler";
87
87
  }
88
88
  /** @unlisted */
89
- export interface MessageEntityCustomEmoji extends MessageEntityBase {
89
+ export interface MessageEntityCustomEmoji extends _MessageEntityBase {
90
90
  type: "customEmoji";
91
91
  /** The identifier of the custom emoji. */
92
92
  customEmojiId: string;
@@ -1,6 +1,6 @@
1
1
  import { MaybePromise } from "../1_utilities.js";
2
2
  import { types } from "../2_tl.js";
3
- import { ChatID } from "./0_chat_id.js";
3
+ import { ID } from "./0_id.js";
4
4
  /** @unlisted */
5
5
  export interface EntityGetter {
6
6
  (peer: types.PeerUser): MaybePromise<types.User | null>;
@@ -10,7 +10,7 @@ export interface EntityGetter {
10
10
  }
11
11
  /** @unlisted */
12
12
  export interface InputPeerGetter {
13
- (id: ChatID): Promise<types.InputPeerUser | types.InputPeerChannel | types.InputPeerChat>;
13
+ (id: ID): Promise<types.InputPeerUser | types.InputPeerChannel | types.InputPeerChat>;
14
14
  }
15
15
  /** @unlisted */
16
16
  export interface UsernameResolver {
@@ -1,6 +1,6 @@
1
1
  import { types } from "../2_tl.js";
2
2
  import { Thumbnail } from "./0_thumbnail.js";
3
- /** This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound). */
3
+ /** An animation file (GIF or H.264/MPEG-4 AVC video without sound). */
4
4
  export interface Animation {
5
5
  /** A file identifier that can be used to download or reuse this file. */
6
6
  fileId: string;
@@ -1,4 +1,4 @@
1
- import { ChatID } from "./0_chat_id.js";
1
+ import { ID } from "./0_id.js";
2
2
  import { InputPeerGetter } from "./1__getters.js";
3
3
  /** @unlisted */
4
4
  export interface BotCommandScopeDefault {
@@ -19,18 +19,19 @@ export interface BotCommandScopeAllChatAdministrators {
19
19
  /** @unlisted */
20
20
  export interface BotCommandScopeChat {
21
21
  type: "chat";
22
- chatId: ChatID;
22
+ chatId: ID;
23
23
  }
24
24
  /** @unlisted */
25
25
  export interface BotCommandScopeChatAdministrators {
26
26
  type: "chatAdministrators";
27
- chatId: ChatID;
27
+ chatId: ID;
28
28
  }
29
29
  /** @unlisted */
30
30
  export interface BotCommandScopeChatMember {
31
31
  type: "chatMember";
32
- chatId: ChatID;
32
+ chatId: ID;
33
33
  userId: number;
34
34
  }
35
+ /** A type specifying where bot commads are available. */
35
36
  export type BotCommandScope = BotCommandScopeDefault | BotCommandScopeAllPrivateChats | BotCommandScopeAllGroupChats | BotCommandScopeAllChatAdministrators | BotCommandScopeChat | BotCommandScopeChatAdministrators | BotCommandScopeChatMember;
36
37
  export declare function botCommandScopeToTlObject(scope: BotCommandScope, getInputPeer: InputPeerGetter): Promise<import("../tl/2_types.js").BotCommandScopeDefault_ | import("../tl/2_types.js").BotCommandScopeUsers_ | import("../tl/2_types.js").BotCommandScopeChats_ | import("../tl/2_types.js").BotCommandScopeChatAdmins_ | import("../tl/2_types.js").BotCommandScopePeer_ | import("../tl/2_types.js").BotCommandScopePeerAdmins_ | import("../tl/2_types.js").BotCommandScopePeerUser_>;
@@ -3,7 +3,7 @@ import { RestrictionReason } from "./0_restriction_reason.js";
3
3
  /** @unlisted */
4
4
  export type ChatType = "private" | "group" | "supergroup" | "channel";
5
5
  /** @unlisted */
6
- export interface ChatPBase {
6
+ export interface _ChatPBase {
7
7
  /** The identifier of the chat. */
8
8
  id: number;
9
9
  /** The type of the chat. */
@@ -12,7 +12,7 @@ export interface ChatPBase {
12
12
  color: number;
13
13
  }
14
14
  /** @unlisted */
15
- export interface ChatPPrivate extends ChatPBase {
15
+ export interface ChatPPrivate extends _ChatPBase {
16
16
  type: "private";
17
17
  /** Whether this is a bot's chat. */
18
18
  isBot?: boolean;
@@ -36,7 +36,7 @@ export interface ChatPPrivate extends ChatPBase {
36
36
  restrictionReason?: RestrictionReason[];
37
37
  }
38
38
  /** @unlisted */
39
- export interface ChatPGroup extends ChatPBase {
39
+ export interface ChatPGroup extends _ChatPBase {
40
40
  type: "group";
41
41
  /** The title of the chat. */
42
42
  title: string;
@@ -44,7 +44,7 @@ export interface ChatPGroup extends ChatPBase {
44
44
  isCreator: boolean;
45
45
  }
46
46
  /** @unlisted */
47
- export interface ChatPChannelBase extends ChatPBase {
47
+ export interface ChatPChannelBase extends _ChatPBase {
48
48
  /** The title of the chat or channel. */
49
49
  title: string;
50
50
  /** The main username of the chat or channel. */
@@ -71,8 +71,7 @@ export interface ChatPSupergroup extends ChatPChannelBase {
71
71
  isForum: boolean;
72
72
  }
73
73
  /**
74
- * This object represents a chat.
75
- * @unlisted
74
+ * A chat with lesser fields.
76
75
  */
77
76
  export type ChatP = ChatPPrivate | ChatPGroup | ChatPSupergroup | ChatPChannel;
78
77
  export declare function constructChatP(chat: types.User): ChatPPrivate;
@@ -1,5 +1,6 @@
1
1
  import { types } from "../2_tl.js";
2
2
  import { Thumbnail } from "./0_thumbnail.js";
3
+ /** A document. */
3
4
  export interface Document {
4
5
  /** A file identifier that can be used to download or reuse this file. */
5
6
  fileId: string;
@@ -0,0 +1,88 @@
1
+ import { LabeledPrice } from "./0_labeled_price.js";
2
+ import { MessageEntity } from "./0_message_entity.js";
3
+ import { ParseMode } from "./0_parse_mode.js";
4
+ /**
5
+ * A message content that shares a contact.
6
+ * @unlisted
7
+ */
8
+ export interface InputMessageContentContact {
9
+ /** The contact's phone number. */
10
+ phoneNumber: string;
11
+ /** The contact's first name. */
12
+ firstName: string;
13
+ /** The contact's last name. */
14
+ lastName?: string;
15
+ /** Additional information in the vCard format. */
16
+ vcard?: string;
17
+ }
18
+ /**
19
+ * A message content that shares a location.
20
+ * @unlisted
21
+ */
22
+ export interface InputMessageContentLocation {
23
+ /** The latitude of the location. */
24
+ latitude: number;
25
+ /** The longitude of the location. */
26
+ longitude: number;
27
+ /** The accuracy radius of the location in meters. Must be in the range of 0-1500. */
28
+ horizontalAccuracy?: number;
29
+ /** The duration in which the location can be updated in seconds. Must be in the range of 80-864,000. */
30
+ livePeriod?: number;
31
+ /** The direction which the user is moving towards. Must be in the range of 1-350. */
32
+ heading?: number;
33
+ /** The maximum distance for proximity alerts on approaching another chat member in meters. Must be in the range 1-100,000. */
34
+ proximityAlertRadius?: number;
35
+ }
36
+ /**
37
+ * A message content that shares a venue.
38
+ * @unlisted
39
+ */
40
+ export interface InputMessageContentVenue {
41
+ /** The latitude of the venue. */
42
+ latitude: number;
43
+ /** The longitude of the venue. */
44
+ longitude: number;
45
+ /** The name of the venue. */
46
+ title: string;
47
+ /** The address of the venue. */
48
+ address: string;
49
+ /** The Foursquare identifier of the venue. */
50
+ foursquareId?: string;
51
+ /** The Foursquare type of the venue. */
52
+ foursquareType?: string;
53
+ /** The Google Places identifier of the venue. */
54
+ googlePlaceId?: string;
55
+ /** The Google Places type of the venue. */
56
+ googlePlaceType?: string;
57
+ }
58
+ /** @unlisted */
59
+ export interface InputMessageContentText {
60
+ messageText: string;
61
+ parseMode?: ParseMode;
62
+ entities?: MessageEntity[];
63
+ disableWebPagePreview?: boolean;
64
+ }
65
+ /** @unlisted */
66
+ export interface InputMessageContentInvoice {
67
+ title: string;
68
+ description: string;
69
+ payload: string;
70
+ providerToken: string;
71
+ currency: string;
72
+ prices: LabeledPrice[];
73
+ maxTipAmount?: number;
74
+ suggestedTipAmounts?: number[];
75
+ providerData?: string;
76
+ photoUrl?: string;
77
+ photoSize?: number;
78
+ photoWidth?: number;
79
+ photoHeight?: number;
80
+ needName?: boolean;
81
+ needPhoneNumber?: boolean;
82
+ needEmail?: boolean;
83
+ needShippingAAddress?: boolean;
84
+ sendPhoneNumberToPorvider?: boolean;
85
+ sendEmailToProvider?: boolean;
86
+ isFlexible?: boolean;
87
+ }
88
+ export type InputMessageContent = InputMessageContentText | InputMessageContentLocation | InputMessageContentVenue | InputMessageContentContact | InputMessageContentInvoice;
@@ -1,6 +1,6 @@
1
1
  import { types } from "../2_tl.js";
2
2
  import { Thumbnail } from "./0_thumbnail.js";
3
- /** This object represents a photo. */
3
+ /** A photo. */
4
4
  export interface Photo {
5
5
  /** A file identifier that can be used to download or reuse this file. */
6
6
  fileId: string;
@@ -2,7 +2,7 @@ import { MaybePromise } from "../1_utilities.js";
2
2
  import { types } from "../2_tl.js";
3
3
  import { MaskPosition } from "./0_mask_position.js";
4
4
  import { Thumbnail } from "./0_thumbnail.js";
5
- /** This object represents a sticker. */
5
+ /** A sticker. */
6
6
  export interface Sticker {
7
7
  /** A file identifier that can be used to download or reuse this file. */
8
8
  fileId: string;
@@ -1,6 +1,6 @@
1
1
  import { types } from "../2_tl.js";
2
2
  import { ChatPhotoUser } from "./0_chat_photo.js";
3
- /** This object represents a Telegram user or bot. */
3
+ /** A user. */
4
4
  export interface User {
5
5
  /** Unique identifier for this user or bot */
6
6
  id: number;
@@ -1,6 +1,6 @@
1
1
  import { types } from "../2_tl.js";
2
2
  import { Thumbnail } from "./0_thumbnail.js";
3
- /** This object represents a video file. */
3
+ /** A video file. */
4
4
  export interface Video {
5
5
  /** A file identifier that can be used to download or reuse this file. */
6
6
  fileId: string;
@@ -1,6 +1,6 @@
1
1
  import { types } from "../2_tl.js";
2
2
  import { Thumbnail } from "./0_thumbnail.js";
3
- /** This object represents a video message (available in Telegram apps as of v.4.0). */
3
+ /** A video note. */
4
4
  export interface VideoNote {
5
5
  /** A file identifier that can be used to download or reuse this file. */
6
6
  fileId: string;
@@ -3,42 +3,42 @@ import { LoginUrl } from "./0_login_url.js";
3
3
  import { WebAppInfo } from "./0_web_app_info.js";
4
4
  import { UsernameResolver } from "./1__getters.js";
5
5
  /** @unlisted */
6
- export interface InlineKeyboardButtonBase {
6
+ export interface _InlineKeyboardButtonBase {
7
7
  text: string;
8
8
  }
9
9
  /** @unlisted */
10
- export interface InlineKeyboardButtonURL extends InlineKeyboardButtonBase {
10
+ export interface InlineKeyboardButtonURL extends _InlineKeyboardButtonBase {
11
11
  url: string;
12
12
  }
13
13
  /** @unlisted */
14
- export interface InlineKeyboardButtonCallback extends InlineKeyboardButtonBase {
14
+ export interface InlineKeyboardButtonCallback extends _InlineKeyboardButtonBase {
15
15
  callbackData: string;
16
16
  }
17
17
  /** @unlisted */
18
- export interface InlineKeyboardButtonWebApp extends InlineKeyboardButtonBase {
18
+ export interface InlineKeyboardButtonWebApp extends _InlineKeyboardButtonBase {
19
19
  webApp: WebAppInfo;
20
20
  }
21
21
  /** @unlisted */
22
- export interface InlineKeyboardButtonLogin extends InlineKeyboardButtonBase {
22
+ export interface InlineKeyboardButtonLogin extends _InlineKeyboardButtonBase {
23
23
  loginUrl: LoginUrl;
24
24
  }
25
25
  /** @unlisted */
26
- export interface InlineKeyboardButtonSwitchInline extends InlineKeyboardButtonBase {
26
+ export interface InlineKeyboardButtonSwitchInline extends _InlineKeyboardButtonBase {
27
27
  switchInlineQuery: string;
28
28
  }
29
29
  /** @unlisted */
30
- export interface InlineKeyboardButtonSwitchInlineCurrent extends InlineKeyboardButtonBase {
30
+ export interface InlineKeyboardButtonSwitchInlineCurrent extends _InlineKeyboardButtonBase {
31
31
  switchInlineQueryCurrentChat: string;
32
32
  }
33
33
  /** @unlisted */
34
- export interface InlineKeyboardButtonGame extends InlineKeyboardButtonBase {
34
+ export interface InlineKeyboardButtonGame extends _InlineKeyboardButtonBase {
35
35
  callbackGame: Record<never, never>;
36
36
  }
37
37
  /** @unlisted */
38
- export interface InlineKeyboardButtonPay extends InlineKeyboardButtonBase {
38
+ export interface InlineKeyboardButtonPay extends _InlineKeyboardButtonBase {
39
39
  pay: boolean;
40
40
  }
41
- /** This object represents one button of an inline keyboard. You **must** use exactly one of the optional fields. */
41
+ /** A button of an inline keyboard. */
42
42
  export type InlineKeyboardButton = InlineKeyboardButtonURL | InlineKeyboardButtonCallback | InlineKeyboardButtonWebApp | InlineKeyboardButtonLogin | InlineKeyboardButtonSwitchInline | InlineKeyboardButtonSwitchInlineCurrent | InlineKeyboardButtonGame | InlineKeyboardButtonPay;
43
43
  export declare function constructInlineKeyboardButton(button_: enums.KeyboardButton): InlineKeyboardButton;
44
44
  export declare function inlineKeyboardButtonToTlObject(button: InlineKeyboardButton, usernameResolver: UsernameResolver): Promise<import("../tl/2_types.js").KeyboardButtonUrl_ | import("../tl/2_types.js").KeyboardButtonCallback_ | import("../tl/2_types.js").KeyboardButtonSwitchInline_ | import("../tl/2_types.js").KeyboardButtonBuy_ | import("../tl/2_types.js").InputKeyboardButtonUrlAuth_ | import("../tl/2_types.js").KeyboardButtonWebView_>;
@@ -1,3 +1,5 @@
1
+ import { types } from "../2_tl.js";
2
+ import { EntityGetter } from "./1__getters.js";
1
3
  import { ChatP } from "./1_chat_p.js";
2
4
  import { ReactionCount } from "./1_reaction_count.js";
3
5
  export interface MessageReactionCount {
@@ -6,3 +8,4 @@ export interface MessageReactionCount {
6
8
  date: Date;
7
9
  reactions: ReactionCount[];
8
10
  }
11
+ export declare function constructMessageReactionCount(update: types.UpdateBotMessageReactions, getEntity: EntityGetter): Promise<MessageReactionCount | null>;
@@ -1 +1,17 @@
1
- export {};
1
+ import { fromUnixTimestamp } from "../1_utilities.js";
2
+ import { constructChatP } from "./1_chat_p.js";
3
+ import { constructReactionCount } from "./1_reaction_count.js";
4
+ export async function constructMessageReactionCount(update, getEntity) {
5
+ const date = fromUnixTimestamp(update.date);
6
+ const reactions = update.reactions.map((v) => constructReactionCount(v));
7
+ const entity = await getEntity(update.peer);
8
+ if (entity) {
9
+ const chat = constructChatP(entity);
10
+ const messageId = update.msg_id;
11
+ const messageReactionCount = { chat, messageId, date, reactions };
12
+ return messageReactionCount;
13
+ }
14
+ else {
15
+ return null;
16
+ }
17
+ }
@@ -0,0 +1,15 @@
1
+ import { types } from "../2_tl.js";
2
+ import { Reaction } from "./0_reaction.js";
3
+ import { EntityGetter } from "./1__getters.js";
4
+ import { ChatP } from "./1_chat_p.js";
5
+ import { User } from "./1_user.js";
6
+ export interface MessageReactions {
7
+ chat: ChatP;
8
+ messageId: number;
9
+ user?: User;
10
+ actorChat?: ChatP;
11
+ date: Date;
12
+ oldReactions: Reaction[];
13
+ newReactions: Reaction[];
14
+ }
15
+ export declare function constructMessageReactions(update: types.UpdateBotMessageReaction, getEntity: EntityGetter): Promise<MessageReactions | null>;
@@ -0,0 +1,37 @@
1
+ import { cleanObject, fromUnixTimestamp } from "../1_utilities.js";
2
+ import { types } from "../2_tl.js";
3
+ import { constructReaction } from "./0_reaction.js";
4
+ import { constructChatP } from "./1_chat_p.js";
5
+ import { constructUser } from "./1_user.js";
6
+ export async function constructMessageReactions(update, getEntity) {
7
+ const date = fromUnixTimestamp(update.date);
8
+ const oldReactions = update.old_reactions.map((v) => constructReaction(v));
9
+ const newReactions = update.new_reactions.map((v) => constructReaction(v));
10
+ const messageId = update.msg_id;
11
+ let entity = await getEntity(update.peer);
12
+ if (!entity) {
13
+ return null;
14
+ }
15
+ const chat = constructChatP(entity);
16
+ let user = undefined;
17
+ let actorChat = undefined;
18
+ entity = await getEntity(update.actor);
19
+ if (!entity) {
20
+ return null;
21
+ }
22
+ if (entity instanceof types.User) {
23
+ user = constructUser(entity);
24
+ }
25
+ else {
26
+ actorChat = constructChatP(entity);
27
+ }
28
+ return cleanObject({
29
+ chat,
30
+ messageId,
31
+ user,
32
+ actorChat,
33
+ date,
34
+ oldReactions,
35
+ newReactions,
36
+ });
37
+ }