rubjs 1.1.0 → 2.4.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.
Files changed (455) hide show
  1. package/README.md +55 -0
  2. package/package.json +1 -1
  3. package/rubjs/client.d.ts +1 -0
  4. package/rubjs/client.js +3 -2
  5. package/rubjs/index.d.ts +5 -2
  6. package/rubjs/index.js +41 -1
  7. package/rubjs/methods/auth/index.d.ts +5 -4
  8. package/rubjs/methods/auth/index.js +9 -7
  9. package/rubjs/methods/auth/logout.d.ts +3 -0
  10. package/rubjs/methods/{messages/send_text.js → auth/logout.js} +3 -3
  11. package/rubjs/methods/auth/registerDevice.d.ts +3 -0
  12. package/rubjs/methods/auth/{register_device.js → registerDevice.js} +2 -2
  13. package/rubjs/methods/auth/sendCode.d.ts +3 -0
  14. package/rubjs/methods/auth/{send_code.js → sendCode.js} +2 -2
  15. package/rubjs/methods/auth/signIn.d.ts +3 -0
  16. package/rubjs/methods/auth/{sign_in.js → signIn.js} +2 -2
  17. package/rubjs/methods/channels/addChannel.d.ts +3 -0
  18. package/rubjs/methods/channels/addChannel.js +26 -0
  19. package/rubjs/methods/channels/addChannelMembers.d.ts +3 -0
  20. package/rubjs/methods/channels/addChannelMembers.js +22 -0
  21. package/rubjs/methods/channels/banChannelMember.d.ts +3 -0
  22. package/rubjs/methods/channels/banChannelMember.js +23 -0
  23. package/rubjs/methods/channels/cancelChangeObjectOwner.d.ts +3 -0
  24. package/rubjs/methods/channels/cancelChangeObjectOwner.js +17 -0
  25. package/rubjs/methods/channels/channelPreviewByJoinLink.d.ts +3 -0
  26. package/rubjs/methods/{messages/send_photo.js → channels/channelPreviewByJoinLink.js} +5 -3
  27. package/rubjs/methods/channels/checkChannelUsername.d.ts +3 -0
  28. package/rubjs/methods/channels/checkChannelUsername.js +19 -0
  29. package/rubjs/methods/channels/createChannelVoiceChat.d.ts +3 -0
  30. package/rubjs/methods/channels/createChannelVoiceChat.js +17 -0
  31. package/rubjs/methods/channels/discardChannelVoiceChat.d.ts +3 -0
  32. package/rubjs/methods/channels/discardChannelVoiceChat.js +20 -0
  33. package/rubjs/methods/channels/editChannelInfo.d.ts +4 -0
  34. package/rubjs/methods/channels/editChannelInfo.js +48 -0
  35. package/rubjs/methods/channels/getBannedChannelMembers.d.ts +3 -0
  36. package/rubjs/methods/channels/getBannedChannelMembers.js +20 -0
  37. package/rubjs/methods/channels/getChannelAdminAccessList.d.ts +3 -0
  38. package/rubjs/methods/channels/getChannelAdminAccessList.js +20 -0
  39. package/rubjs/methods/channels/getChannelAdminMembers.d.ts +3 -0
  40. package/rubjs/methods/channels/getChannelAdminMembers.js +20 -0
  41. package/rubjs/methods/channels/getChannelAllMembers.d.ts +3 -0
  42. package/rubjs/methods/channels/getChannelAllMembers.js +21 -0
  43. package/rubjs/methods/channels/getChannelInfo.d.ts +3 -0
  44. package/rubjs/methods/channels/getChannelInfo.js +17 -0
  45. package/rubjs/methods/channels/getChannelLink.d.ts +3 -0
  46. package/rubjs/methods/channels/getChannelLink.js +17 -0
  47. package/rubjs/methods/channels/getPendingObjectOwner.d.ts +3 -0
  48. package/rubjs/methods/channels/getPendingObjectOwner.js +17 -0
  49. package/rubjs/methods/channels/index.d.ts +26 -0
  50. package/rubjs/methods/channels/index.js +56 -0
  51. package/rubjs/methods/channels/joinChannelAction.d.ts +3 -0
  52. package/rubjs/methods/channels/joinChannelAction.js +19 -0
  53. package/rubjs/methods/channels/joinChannelByLink.d.ts +3 -0
  54. package/rubjs/methods/channels/joinChannelByLink.js +19 -0
  55. package/rubjs/methods/channels/leaveChannelVoiceChat.d.ts +3 -0
  56. package/rubjs/methods/channels/leaveChannelVoiceChat.js +20 -0
  57. package/rubjs/methods/channels/removeChannel.d.ts +3 -0
  58. package/rubjs/methods/channels/removeChannel.js +17 -0
  59. package/rubjs/methods/channels/requestChangeObjectOwner.d.ts +3 -0
  60. package/rubjs/methods/{messages/edit_message.js → channels/requestChangeObjectOwner.js} +5 -7
  61. package/rubjs/methods/channels/seenChannelMessages.d.ts +3 -0
  62. package/rubjs/methods/channels/seenChannelMessages.js +21 -0
  63. package/rubjs/methods/channels/setChannelLink.d.ts +3 -0
  64. package/rubjs/methods/channels/setChannelLink.js +17 -0
  65. package/rubjs/methods/channels/setChannelVoiceChatSetting.d.ts +3 -0
  66. package/rubjs/methods/channels/setChannelVoiceChatSetting.js +26 -0
  67. package/rubjs/methods/channels/updateChannelUsername.d.ts +3 -0
  68. package/rubjs/methods/channels/updateChannelUsername.js +20 -0
  69. package/rubjs/methods/chats/actionOnJoinRequest.d.ts +3 -0
  70. package/rubjs/methods/chats/actionOnJoinRequest.js +22 -0
  71. package/rubjs/methods/chats/addLiveComment.d.ts +3 -0
  72. package/rubjs/methods/chats/addLiveComment.js +17 -0
  73. package/rubjs/methods/chats/clickMessageUrl.d.ts +3 -0
  74. package/rubjs/methods/chats/clickMessageUrl.js +17 -0
  75. package/rubjs/methods/chats/createJoinLink.d.ts +3 -0
  76. package/rubjs/methods/chats/createJoinLink.js +23 -0
  77. package/rubjs/methods/chats/deleteAvatar.d.ts +3 -0
  78. package/rubjs/methods/chats/deleteAvatar.js +17 -0
  79. package/rubjs/methods/chats/deleteChatHistory.d.ts +3 -0
  80. package/rubjs/methods/chats/deleteChatHistory.js +20 -0
  81. package/rubjs/methods/chats/editJoinLink.d.ts +3 -0
  82. package/rubjs/methods/chats/editJoinLink.js +34 -0
  83. package/rubjs/methods/chats/getAbsObjects.d.ts +3 -0
  84. package/rubjs/methods/chats/getAbsObjects.js +19 -0
  85. package/rubjs/methods/chats/getAvatars.d.ts +3 -0
  86. package/rubjs/methods/chats/getAvatars.js +17 -0
  87. package/rubjs/methods/chats/getChatReaction.d.ts +3 -0
  88. package/rubjs/methods/chats/getChatReaction.js +17 -0
  89. package/rubjs/methods/chats/getChats.d.ts +3 -0
  90. package/rubjs/methods/chats/getChats.js +17 -0
  91. package/rubjs/methods/chats/getChatsUpdates.d.ts +3 -0
  92. package/rubjs/methods/chats/getChatsUpdates.js +17 -0
  93. package/rubjs/methods/chats/getJoinLinks.d.ts +3 -0
  94. package/rubjs/methods/chats/getJoinLinks.js +17 -0
  95. package/rubjs/methods/chats/getJoinRequests.d.ts +3 -0
  96. package/rubjs/methods/chats/getJoinRequests.js +17 -0
  97. package/rubjs/methods/chats/getLinkFromAppUrl.d.ts +3 -0
  98. package/rubjs/methods/chats/getLinkFromAppUrl.js +17 -0
  99. package/rubjs/methods/chats/getLiveComments.d.ts +3 -0
  100. package/rubjs/methods/chats/getLiveComments.js +17 -0
  101. package/rubjs/methods/chats/getLivePlayUrl.d.ts +3 -0
  102. package/rubjs/methods/chats/getLivePlayUrl.js +17 -0
  103. package/rubjs/methods/chats/getLiveStatus.d.ts +3 -0
  104. package/rubjs/methods/chats/getLiveStatus.js +17 -0
  105. package/rubjs/methods/chats/getObjectInfoByUsername.d.ts +3 -0
  106. package/rubjs/methods/chats/getObjectInfoByUsername.js +19 -0
  107. package/rubjs/methods/chats/getTopChatUsers.d.ts +3 -0
  108. package/rubjs/methods/chats/getTopChatUsers.js +18 -0
  109. package/rubjs/methods/chats/index.d.ts +29 -0
  110. package/rubjs/methods/chats/index.js +62 -0
  111. package/rubjs/methods/chats/removeFromTopChatUsers.d.ts +3 -0
  112. package/rubjs/methods/chats/removeFromTopChatUsers.js +17 -0
  113. package/rubjs/methods/chats/removeJoinLink.d.ts +3 -0
  114. package/rubjs/methods/chats/removeJoinLink.js +19 -0
  115. package/rubjs/methods/chats/searchChatMessages.d.ts +3 -0
  116. package/rubjs/methods/chats/searchChatMessages.js +23 -0
  117. package/rubjs/methods/chats/searchGlobalMessages.d.ts +3 -0
  118. package/rubjs/methods/chats/searchGlobalMessages.js +17 -0
  119. package/rubjs/methods/chats/seenChats.d.ts +3 -0
  120. package/rubjs/methods/chats/seenChats.js +17 -0
  121. package/rubjs/methods/chats/sendChatActivity.d.ts +3 -0
  122. package/rubjs/methods/chats/sendChatActivity.js +19 -0
  123. package/rubjs/methods/chats/sendLive.d.ts +3 -0
  124. package/rubjs/methods/chats/sendLive.js +28 -0
  125. package/rubjs/methods/chats/setActionChat.d.ts +3 -0
  126. package/rubjs/methods/chats/setActionChat.js +19 -0
  127. package/rubjs/methods/chats/uploadAvatar.d.ts +3 -0
  128. package/rubjs/methods/chats/uploadAvatar.js +29 -0
  129. package/rubjs/methods/contacts/addAddressBook.d.ts +3 -0
  130. package/rubjs/methods/contacts/addAddressBook.js +17 -0
  131. package/rubjs/methods/contacts/deleteContact.d.ts +3 -0
  132. package/rubjs/methods/contacts/deleteContact.js +17 -0
  133. package/rubjs/methods/contacts/getContacts.d.ts +3 -0
  134. package/rubjs/methods/contacts/getContacts.js +17 -0
  135. package/rubjs/methods/contacts/getContactsLastOnline.d.ts +3 -0
  136. package/rubjs/methods/contacts/getContactsLastOnline.js +17 -0
  137. package/rubjs/methods/contacts/getContactsUpdates.d.ts +3 -0
  138. package/rubjs/methods/contacts/getContactsUpdates.js +17 -0
  139. package/rubjs/methods/contacts/index.d.ts +7 -0
  140. package/rubjs/methods/contacts/index.js +18 -0
  141. package/rubjs/methods/contacts/resetContacts.d.ts +3 -0
  142. package/rubjs/methods/contacts/resetContacts.js +18 -0
  143. package/rubjs/methods/extras/banMember.d.ts +3 -0
  144. package/rubjs/methods/extras/banMember.js +20 -0
  145. package/rubjs/methods/extras/getInfo.d.ts +3 -0
  146. package/rubjs/methods/extras/getInfo.js +26 -0
  147. package/rubjs/methods/extras/getObjectByUsername.d.ts +3 -0
  148. package/rubjs/methods/extras/getObjectByUsername.js +19 -0
  149. package/rubjs/methods/extras/getProfileLinkItems.d.ts +3 -0
  150. package/rubjs/methods/extras/getProfileLinkItems.js +17 -0
  151. package/rubjs/methods/extras/getRelatedObjects.d.ts +3 -0
  152. package/rubjs/methods/extras/getRelatedObjects.js +17 -0
  153. package/rubjs/methods/extras/getTranscription.d.ts +3 -0
  154. package/rubjs/methods/extras/getTranscription.js +20 -0
  155. package/rubjs/methods/extras/index.d.ts +13 -0
  156. package/rubjs/methods/extras/index.js +30 -0
  157. package/rubjs/methods/extras/join.d.ts +3 -0
  158. package/rubjs/methods/extras/join.js +22 -0
  159. package/rubjs/methods/extras/leaveChat.d.ts +3 -0
  160. package/rubjs/methods/extras/leaveChat.js +20 -0
  161. package/rubjs/methods/extras/reportObject.d.ts +14 -0
  162. package/rubjs/methods/extras/reportObject.js +32 -0
  163. package/rubjs/methods/extras/searchGlobalObjects.d.ts +3 -0
  164. package/rubjs/methods/extras/searchGlobalObjects.js +17 -0
  165. package/rubjs/methods/extras/transcribeVoice.d.ts +3 -0
  166. package/rubjs/methods/extras/transcribeVoice.js +17 -0
  167. package/rubjs/methods/extras/userIsAdmin.d.ts +3 -0
  168. package/rubjs/methods/extras/userIsAdmin.js +29 -0
  169. package/rubjs/methods/gif/addToMyGifSet.d.ts +3 -0
  170. package/rubjs/methods/gif/addToMyGifSet.js +17 -0
  171. package/rubjs/methods/gif/getMyGifSet.d.ts +3 -0
  172. package/rubjs/methods/gif/getMyGifSet.js +17 -0
  173. package/rubjs/methods/gif/index.d.ts +4 -0
  174. package/rubjs/methods/gif/index.js +12 -0
  175. package/rubjs/methods/gif/removeFromMyGifSet.d.ts +3 -0
  176. package/rubjs/methods/gif/removeFromMyGifSet.js +17 -0
  177. package/rubjs/methods/groups/addGroup.d.ts +3 -0
  178. package/rubjs/methods/groups/addGroup.js +19 -0
  179. package/rubjs/methods/groups/addGroupMembers.d.ts +3 -0
  180. package/rubjs/methods/groups/addGroupMembers.js +19 -0
  181. package/rubjs/methods/groups/banGroupMember.d.ts +3 -0
  182. package/rubjs/methods/groups/banGroupMember.js +23 -0
  183. package/rubjs/methods/groups/createGroupVoiceChat.d.ts +3 -0
  184. package/rubjs/methods/groups/createGroupVoiceChat.js +17 -0
  185. package/rubjs/methods/groups/deleteNoAccessGroupChat.d.ts +3 -0
  186. package/rubjs/methods/groups/deleteNoAccessGroupChat.js +17 -0
  187. package/rubjs/methods/groups/discardGroupVoiceChat.d.ts +3 -0
  188. package/rubjs/methods/groups/discardGroupVoiceChat.js +20 -0
  189. package/rubjs/methods/groups/editGroupInfo.d.ts +6 -0
  190. package/rubjs/methods/groups/editGroupInfo.js +51 -0
  191. package/rubjs/methods/groups/getBannedGroupMembers.d.ts +3 -0
  192. package/rubjs/methods/groups/getBannedGroupMembers.js +17 -0
  193. package/rubjs/methods/groups/getGroupAdminAccessList.d.ts +3 -0
  194. package/rubjs/methods/groups/getGroupAdminAccessList.js +20 -0
  195. package/rubjs/methods/groups/getGroupAdminMembers.d.ts +3 -0
  196. package/rubjs/methods/groups/getGroupAdminMembers.js +17 -0
  197. package/rubjs/methods/groups/getGroupAllMembers.d.ts +3 -0
  198. package/rubjs/methods/groups/getGroupAllMembers.js +21 -0
  199. package/rubjs/methods/groups/getGroupDefaultAccess.d.ts +3 -0
  200. package/rubjs/methods/groups/getGroupDefaultAccess.js +17 -0
  201. package/rubjs/methods/groups/getGroupInfo.d.ts +3 -0
  202. package/rubjs/methods/groups/getGroupInfo.js +17 -0
  203. package/rubjs/methods/groups/getGroupLink.d.ts +3 -0
  204. package/rubjs/methods/groups/getGroupLink.js +17 -0
  205. package/rubjs/methods/groups/getGroupMentionList.d.ts +3 -0
  206. package/rubjs/methods/groups/getGroupMentionList.js +20 -0
  207. package/rubjs/methods/groups/getGroupOnlineCount.d.ts +3 -0
  208. package/rubjs/methods/groups/getGroupOnlineCount.js +17 -0
  209. package/rubjs/methods/groups/getGroupVoiceChatUpdates.d.ts +3 -0
  210. package/rubjs/methods/groups/getGroupVoiceChatUpdates.js +21 -0
  211. package/rubjs/methods/groups/groupPreviewByJoinLink.d.ts +3 -0
  212. package/rubjs/methods/groups/groupPreviewByJoinLink.js +19 -0
  213. package/rubjs/methods/groups/index.d.ts +28 -0
  214. package/rubjs/methods/groups/index.js +60 -0
  215. package/rubjs/methods/groups/joinGroup.d.ts +3 -0
  216. package/rubjs/methods/groups/joinGroup.js +19 -0
  217. package/rubjs/methods/groups/leaveGroup.d.ts +3 -0
  218. package/rubjs/methods/groups/leaveGroup.js +17 -0
  219. package/rubjs/methods/groups/leaveGroupVoiceChat.d.ts +3 -0
  220. package/rubjs/methods/groups/leaveGroupVoiceChat.js +20 -0
  221. package/rubjs/methods/groups/removeGroup.d.ts +3 -0
  222. package/rubjs/methods/groups/removeGroup.js +17 -0
  223. package/rubjs/methods/groups/seenGroupMessages.d.ts +3 -0
  224. package/rubjs/methods/groups/seenGroupMessages.js +21 -0
  225. package/rubjs/methods/groups/setGroupAdmin.d.ts +5 -0
  226. package/rubjs/methods/groups/setGroupAdmin.js +26 -0
  227. package/rubjs/methods/groups/setGroupDefaultAccess.d.ts +4 -0
  228. package/rubjs/methods/groups/setGroupDefaultAccess.js +22 -0
  229. package/rubjs/methods/groups/setGroupLink.d.ts +3 -0
  230. package/rubjs/methods/groups/setGroupLink.js +17 -0
  231. package/rubjs/methods/groups/setGroupVoiceChatSetting.d.ts +3 -0
  232. package/rubjs/methods/groups/setGroupVoiceChatSetting.js +26 -0
  233. package/rubjs/methods/index.d.ts +190 -41
  234. package/rubjs/methods/index.js +827 -57
  235. package/rubjs/methods/messages/actionOnMessageReaction.d.ts +3 -0
  236. package/rubjs/methods/messages/{action_on_message_reaction.js → actionOnMessageReaction.js} +2 -2
  237. package/rubjs/methods/messages/createPoll.d.ts +3 -0
  238. package/rubjs/methods/messages/{create_poll.js → createPoll.js} +2 -2
  239. package/rubjs/methods/messages/deleteMessages.d.ts +3 -0
  240. package/rubjs/methods/messages/{delete_messages.js → deleteMessages.js} +2 -2
  241. package/rubjs/methods/messages/editMessage.d.ts +3 -0
  242. package/rubjs/methods/messages/editMessage.js +23 -0
  243. package/rubjs/methods/messages/forwardMessages.d.ts +3 -0
  244. package/rubjs/methods/messages/{forward_messages.js → forwardMessages.js} +2 -2
  245. package/rubjs/methods/messages/getMessageShareUrl.d.ts +3 -0
  246. package/rubjs/methods/messages/{get_message_share_url.js → getMessageShareUrl.js} +2 -2
  247. package/rubjs/methods/messages/getMessages.d.ts +3 -0
  248. package/rubjs/methods/messages/getMessages.js +23 -0
  249. package/rubjs/methods/messages/getMessagesByID.d.ts +3 -0
  250. package/rubjs/methods/messages/{get_messages_by_id.js → getMessagesByID.js} +2 -2
  251. package/rubjs/methods/messages/getMessagesInterval.d.ts +3 -0
  252. package/rubjs/methods/messages/{get_messages_interval.js → getMessagesInterval.js} +2 -2
  253. package/rubjs/methods/messages/getMessagesUpdates.d.ts +3 -0
  254. package/rubjs/methods/messages/{get_messages_updates.js → getMessagesUpdates.js} +2 -2
  255. package/rubjs/methods/messages/getPollOptionVoters.d.ts +3 -0
  256. package/rubjs/methods/messages/{get_poll_option_voters.js → getPollOptionVoters.js} +2 -2
  257. package/rubjs/methods/messages/getPollStatus.d.ts +3 -0
  258. package/rubjs/methods/messages/{get_poll_status.js → getPollStatus.js} +2 -2
  259. package/rubjs/methods/messages/index.d.ts +26 -17
  260. package/rubjs/methods/messages/index.js +51 -33
  261. package/rubjs/methods/messages/requestSendFile.d.ts +4 -0
  262. package/rubjs/methods/{utilities/request_send_file.js → messages/requestSendFile.js} +2 -2
  263. package/rubjs/methods/messages/sendDocument.d.ts +3 -0
  264. package/rubjs/methods/messages/sendDocument.js +17 -0
  265. package/rubjs/methods/messages/sendGif.d.ts +3 -0
  266. package/rubjs/methods/messages/sendGif.js +17 -0
  267. package/rubjs/methods/messages/sendMessage.d.ts +3 -0
  268. package/rubjs/methods/messages/{send_message.js → sendMessage.js} +32 -20
  269. package/rubjs/methods/messages/sendMusic.d.ts +3 -0
  270. package/rubjs/methods/messages/sendMusic.js +17 -0
  271. package/rubjs/methods/messages/sendPhoto.d.ts +3 -0
  272. package/rubjs/methods/messages/sendPhoto.js +17 -0
  273. package/rubjs/methods/messages/sendSticker.d.ts +3 -0
  274. package/rubjs/methods/messages/sendSticker.js +17 -0
  275. package/rubjs/methods/messages/sendText.d.ts +3 -0
  276. package/rubjs/methods/messages/sendText.js +17 -0
  277. package/rubjs/methods/messages/sendVideo.d.ts +3 -0
  278. package/rubjs/methods/messages/sendVideo.js +17 -0
  279. package/rubjs/methods/messages/sendVideoMessage.d.ts +3 -0
  280. package/rubjs/methods/messages/sendVideoMessage.js +17 -0
  281. package/rubjs/methods/messages/sendVoice.d.ts +3 -0
  282. package/rubjs/methods/messages/sendVoice.js +17 -0
  283. package/rubjs/methods/messages/setPinMessage.d.ts +3 -0
  284. package/rubjs/methods/messages/{set_pin_message.js → setPinMessage.js} +2 -2
  285. package/rubjs/methods/messages/votePoll.d.ts +3 -0
  286. package/rubjs/methods/messages/{vote_poll.js → votePoll.js} +2 -2
  287. package/rubjs/methods/settings/changePassword.d.ts +3 -0
  288. package/rubjs/methods/settings/changePassword.js +17 -0
  289. package/rubjs/methods/settings/checkTwoStepPasscode.d.ts +3 -0
  290. package/rubjs/methods/settings/checkTwoStepPasscode.js +17 -0
  291. package/rubjs/methods/settings/deleteFolder.d.ts +3 -0
  292. package/rubjs/methods/settings/deleteFolder.js +17 -0
  293. package/rubjs/methods/settings/getBlockedUsers.d.ts +3 -0
  294. package/rubjs/methods/settings/getBlockedUsers.js +17 -0
  295. package/rubjs/methods/settings/getFolders.d.ts +3 -0
  296. package/rubjs/methods/settings/getFolders.js +17 -0
  297. package/rubjs/methods/settings/getMySessions.d.ts +3 -0
  298. package/rubjs/methods/settings/getMySessions.js +17 -0
  299. package/rubjs/methods/settings/getPrivacySetting.d.ts +3 -0
  300. package/rubjs/methods/settings/getPrivacySetting.js +17 -0
  301. package/rubjs/methods/settings/getSuggestedFolders.d.ts +3 -0
  302. package/rubjs/methods/settings/getSuggestedFolders.js +17 -0
  303. package/rubjs/methods/settings/getTwoPasscodeStatus.d.ts +3 -0
  304. package/rubjs/methods/settings/getTwoPasscodeStatus.js +17 -0
  305. package/rubjs/methods/settings/index.d.ts +19 -0
  306. package/rubjs/methods/settings/index.js +42 -0
  307. package/rubjs/methods/settings/requestRecoveryEmail.d.ts +3 -0
  308. package/rubjs/methods/settings/requestRecoveryEmail.js +20 -0
  309. package/rubjs/methods/settings/setSetting.d.ts +5 -0
  310. package/rubjs/methods/settings/setSetting.js +50 -0
  311. package/rubjs/methods/settings/setupTwoStepVerification.d.ts +3 -0
  312. package/rubjs/methods/settings/setupTwoStepVerification.js +21 -0
  313. package/rubjs/methods/settings/terminateOtherSessions.d.ts +3 -0
  314. package/rubjs/methods/settings/terminateOtherSessions.js +18 -0
  315. package/rubjs/methods/settings/terminateSession.d.ts +3 -0
  316. package/rubjs/methods/settings/terminateSession.js +17 -0
  317. package/rubjs/methods/settings/turnOffTwoStep.d.ts +3 -0
  318. package/rubjs/methods/settings/turnOffTwoStep.js +18 -0
  319. package/rubjs/methods/settings/updateProfile.d.ts +3 -0
  320. package/rubjs/methods/settings/updateProfile.js +30 -0
  321. package/rubjs/methods/settings/updateUsername.d.ts +3 -0
  322. package/rubjs/methods/settings/updateUsername.js +17 -0
  323. package/rubjs/methods/settings/verifyRecoveryEmail.d.ts +3 -0
  324. package/rubjs/methods/settings/verifyRecoveryEmail.js +17 -0
  325. package/rubjs/methods/stickers/actionOnStickerSet.d.ts +3 -0
  326. package/rubjs/methods/stickers/actionOnStickerSet.js +19 -0
  327. package/rubjs/methods/stickers/getMyStickerSets.d.ts +3 -0
  328. package/rubjs/methods/stickers/getMyStickerSets.js +17 -0
  329. package/rubjs/methods/stickers/getStickerSetByID.d.ts +3 -0
  330. package/rubjs/methods/stickers/getStickerSetByID.js +17 -0
  331. package/rubjs/methods/stickers/getStickersByEmoji.d.ts +3 -0
  332. package/rubjs/methods/stickers/getStickersByEmoji.js +17 -0
  333. package/rubjs/methods/stickers/getStickersBySetIds.d.ts +3 -0
  334. package/rubjs/methods/stickers/getStickersBySetIds.js +19 -0
  335. package/rubjs/methods/stickers/getTrendStickerSets.d.ts +3 -0
  336. package/rubjs/methods/stickers/getTrendStickerSets.js +17 -0
  337. package/rubjs/methods/stickers/index.d.ts +8 -0
  338. package/rubjs/methods/stickers/index.js +20 -0
  339. package/rubjs/methods/stickers/searchStickers.d.ts +3 -0
  340. package/rubjs/methods/stickers/searchStickers.js +17 -0
  341. package/rubjs/methods/users/checkUserUsername.d.ts +3 -0
  342. package/rubjs/methods/users/checkUserUsername.js +17 -0
  343. package/rubjs/methods/users/deleteUserChat.d.ts +3 -0
  344. package/rubjs/methods/users/deleteUserChat.js +20 -0
  345. package/rubjs/methods/users/getMe.d.ts +3 -0
  346. package/rubjs/methods/users/getMe.js +17 -0
  347. package/rubjs/methods/users/getUserInfo.d.ts +4 -0
  348. package/rubjs/methods/users/{get_user_info.js → getUserInfo.js} +2 -2
  349. package/rubjs/methods/users/index.d.ts +6 -2
  350. package/rubjs/methods/users/index.js +11 -3
  351. package/rubjs/methods/users/setBlockUser.d.ts +3 -0
  352. package/rubjs/methods/users/setBlockUser.js +19 -0
  353. package/rubjs/methods/utilities/download.d.ts +4 -0
  354. package/rubjs/methods/utilities/download.js +17 -0
  355. package/rubjs/methods/utilities/downloadProfilePicture.d.ts +3 -0
  356. package/rubjs/methods/utilities/downloadProfilePicture.js +27 -0
  357. package/rubjs/methods/utilities/get.d.ts +4 -0
  358. package/rubjs/methods/utilities/get.js +21 -0
  359. package/rubjs/methods/utilities/index.d.ts +7 -3
  360. package/rubjs/methods/utilities/index.js +13 -5
  361. package/rubjs/methods/utilities/post.d.ts +4 -0
  362. package/rubjs/methods/utilities/post.js +21 -0
  363. package/rubjs/methods/utilities/run.js +8 -1
  364. package/rubjs/methods/utilities/start.js +8 -7
  365. package/rubjs/methods/utilities/thumbnail.d.ts +1 -0
  366. package/rubjs/methods/utilities/thumbnail.js +15 -1
  367. package/rubjs/network/index.d.ts +4 -3
  368. package/rubjs/network/index.js +77 -21
  369. package/rubjs/parser/index.d.ts +25 -0
  370. package/rubjs/parser/index.js +112 -0
  371. package/rubjs/session/index.js +1 -1
  372. package/rubjs/{methods/auth/types/sign_in.d.ts → types/auth.d.ts} +11 -1
  373. package/rubjs/types/chats.d.ts +79 -0
  374. package/rubjs/{methods/types/message_update.d.ts → types/decorators.d.ts} +56 -0
  375. package/rubjs/types/groups.d.ts +129 -0
  376. package/rubjs/types/index.d.ts +8 -0
  377. package/rubjs/types/index.js +53 -0
  378. package/rubjs/types/message.d.ts +25 -0
  379. package/rubjs/types/message.js +61 -0
  380. package/rubjs/types/messages.d.ts +176 -0
  381. package/rubjs/{methods/users/types/get_user_info.d.ts → types/users.d.ts} +1 -0
  382. package/rubjs/utils/filters.d.ts +28 -16
  383. package/rubjs/utils/filters.js +90 -31
  384. package/rubjs/utils/index.d.ts +2 -1
  385. package/rubjs/utils/index.js +3 -1
  386. package/rubjs/utils/utils.d.ts +10 -0
  387. package/rubjs/utils/utils.js +12 -0
  388. package/rubjs/methods/auth/register_device.d.ts +0 -3
  389. package/rubjs/methods/auth/send_code.d.ts +0 -4
  390. package/rubjs/methods/auth/sign_in.d.ts +0 -4
  391. package/rubjs/methods/auth/types/index.d.ts +0 -3
  392. package/rubjs/methods/auth/types/send_code.d.ts +0 -10
  393. package/rubjs/methods/messages/action_on_message_reaction.d.ts +0 -4
  394. package/rubjs/methods/messages/create_poll.d.ts +0 -4
  395. package/rubjs/methods/messages/delete_messages.d.ts +0 -4
  396. package/rubjs/methods/messages/edit_message.d.ts +0 -4
  397. package/rubjs/methods/messages/forward_messages.d.ts +0 -4
  398. package/rubjs/methods/messages/get_message_share_url.d.ts +0 -4
  399. package/rubjs/methods/messages/get_messages_by_id.d.ts +0 -4
  400. package/rubjs/methods/messages/get_messages_interval.d.ts +0 -4
  401. package/rubjs/methods/messages/get_messages_updates.d.ts +0 -4
  402. package/rubjs/methods/messages/get_poll_option_voters.d.ts +0 -4
  403. package/rubjs/methods/messages/get_poll_status.d.ts +0 -4
  404. package/rubjs/methods/messages/send_message.d.ts +0 -4
  405. package/rubjs/methods/messages/send_photo.d.ts +0 -4
  406. package/rubjs/methods/messages/send_text.d.ts +0 -4
  407. package/rubjs/methods/messages/set_pin_message.d.ts +0 -4
  408. package/rubjs/methods/messages/types/action_on_message_reaction.d.ts +0 -10
  409. package/rubjs/methods/messages/types/delete_message.d.ts +0 -34
  410. package/rubjs/methods/messages/types/edit_message.d.ts +0 -38
  411. package/rubjs/methods/messages/types/forward_messages.d.ts +0 -7
  412. package/rubjs/methods/messages/types/forward_messages.js +0 -2
  413. package/rubjs/methods/messages/types/get_messages_by_id.d.ts +0 -14
  414. package/rubjs/methods/messages/types/get_messages_by_id.js +0 -2
  415. package/rubjs/methods/messages/types/get_messages_interval.d.ts +0 -43
  416. package/rubjs/methods/messages/types/get_messages_interval.js +0 -2
  417. package/rubjs/methods/messages/types/get_messages_updates.d.ts +0 -29
  418. package/rubjs/methods/messages/types/get_messages_updates.js +0 -2
  419. package/rubjs/methods/messages/types/get_poll_option_voters.d.ts +0 -19
  420. package/rubjs/methods/messages/types/get_poll_option_voters.js +0 -2
  421. package/rubjs/methods/messages/types/get_poll_status.d.ts +0 -13
  422. package/rubjs/methods/messages/types/get_poll_status.js +0 -2
  423. package/rubjs/methods/messages/types/index.d.ts +0 -13
  424. package/rubjs/methods/messages/types/index.js +0 -2
  425. package/rubjs/methods/messages/types/message_result.d.ts +0 -7
  426. package/rubjs/methods/messages/types/message_result.js +0 -2
  427. package/rubjs/methods/messages/types/mini_typs.d.ts +0 -5
  428. package/rubjs/methods/messages/types/mini_typs.js +0 -2
  429. package/rubjs/methods/messages/types/set_pin_message.d.ts +0 -15
  430. package/rubjs/methods/messages/types/set_pin_message.js +0 -2
  431. package/rubjs/methods/messages/vote_poll.d.ts +0 -4
  432. package/rubjs/methods/types/chat_updates.d.ts +0 -26
  433. package/rubjs/methods/types/chat_updates.js +0 -2
  434. package/rubjs/methods/types/index.d.ts +0 -5
  435. package/rubjs/methods/types/index.js +0 -2
  436. package/rubjs/methods/types/message_update.js +0 -2
  437. package/rubjs/methods/types/show_activities.d.ts +0 -7
  438. package/rubjs/methods/types/show_activities.js +0 -2
  439. package/rubjs/methods/types/show_notifications.d.ts +0 -14
  440. package/rubjs/methods/types/show_notifications.js +0 -2
  441. package/rubjs/methods/users/get_user_info.d.ts +0 -4
  442. package/rubjs/methods/users/types/get_user_info.js +0 -2
  443. package/rubjs/methods/users/types/index.d.ts +0 -2
  444. package/rubjs/methods/users/types/index.js +0 -2
  445. package/rubjs/methods/utilities/request_send_file.d.ts +0 -4
  446. package/rubjs/methods/utilities/types/index.d.ts +0 -2
  447. package/rubjs/methods/utilities/types/index.js +0 -2
  448. package/rubjs/methods/utilities/types/request_send_file.d.ts +0 -7
  449. package/rubjs/methods/utilities/types/request_send_file.js +0 -2
  450. /package/rubjs/{methods/auth/types/index.js → types/auth.js} +0 -0
  451. /package/rubjs/{methods/auth/types/send_code.js → types/chats.js} +0 -0
  452. /package/rubjs/{methods/auth/types/sign_in.js → types/decorators.js} +0 -0
  453. /package/rubjs/{methods/messages/types/action_on_message_reaction.js → types/groups.js} +0 -0
  454. /package/rubjs/{methods/messages/types/delete_message.js → types/messages.js} +0 -0
  455. /package/rubjs/{methods/messages/types/edit_message.js → types/users.js} +0 -0
@@ -11,7 +11,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  function run() {
13
13
  return __awaiter(this, void 0, void 0, function* () {
14
- yield this.network.getUpdates();
14
+ if (!this.initialize) {
15
+ let timeout = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
16
+ yield this.run();
17
+ clearTimeout(timeout);
18
+ }), 2000);
19
+ }
20
+ else
21
+ yield this.network.getUpdates();
15
22
  });
16
23
  }
17
24
  exports.default = run;
@@ -19,12 +19,12 @@ function start() {
19
19
  try {
20
20
  this.key = Buffer.from(crypto_1.default.passphrase(this.auth), "utf8");
21
21
  this.decode_auth = crypto_1.default.decode_auth(this.auth);
22
- const result = yield this.get_user_info();
22
+ const result = yield this.getMe();
23
23
  this.userGuid = result.user.user_guid;
24
+ this.initialize = true;
24
25
  }
25
26
  catch (error) {
26
- // console.log(this.auth);
27
- if (!this.auth)
27
+ if (this.auth)
28
28
  throw new Error("robot has any error" + error.message);
29
29
  let phone_number = yield input_1.default.text("Phone Number: ");
30
30
  let is_phone_number_true = true;
@@ -39,11 +39,11 @@ function start() {
39
39
  }
40
40
  }
41
41
  phone_number = `98${phone_number.slice(1)}`;
42
- let result = yield this.send_code(phone_number);
42
+ let result = yield this.sendCode(phone_number);
43
43
  if (result.status == "SendPassKey") {
44
44
  while (true) {
45
45
  let pass_key = yield input_1.default.text(`Password [${result.hint_pass_key}] > `);
46
- result = yield this.send_code((phone_number = phone_number), (pass_key = pass_key));
46
+ result = yield this.sendCode((phone_number = phone_number), (pass_key = pass_key));
47
47
  if (result.status == "OK")
48
48
  break;
49
49
  }
@@ -52,17 +52,18 @@ function start() {
52
52
  this.privateKey = privateKey;
53
53
  while (true) {
54
54
  let phone_code = yield input_1.default.text("Code: ");
55
- let response = yield this.sign_in(phone_code, phone_number, result.phone_code_hash, publicKey);
55
+ let response = yield this.signIn(phone_code, phone_number, result.phone_code_hash, publicKey);
56
56
  if (response.status === "OK") {
57
57
  response.auth = crypto_1.default.decrypt_RSA_OAEP(this.privateKey, response.auth);
58
58
  this.key = Buffer.from(crypto_1.default.passphrase(response.auth), "utf8");
59
59
  this.auth = response.auth;
60
60
  this.decode_auth = crypto_1.default.decode_auth(this.auth);
61
61
  this.sessionDb.saveSession(response.user.phone, this.auth, response.user.user_guid, this.userAgent, this.privateKey);
62
- yield this.register_device();
62
+ yield this.registerDevice();
63
63
  break;
64
64
  }
65
65
  }
66
+ this.initialize = true;
66
67
  }
67
68
  });
68
69
  }
@@ -1,4 +1,5 @@
1
1
  declare class ThumbnailGenerator {
2
+ static getTime(videoPath: string): Promise<number>;
2
3
  static fromVideo(videoPath: string): Promise<string>;
3
4
  static fromImage(imagePath: string, width?: number): Promise<string>;
4
5
  }
@@ -18,6 +18,20 @@ const path_1 = __importDefault(require("path"));
18
18
  const os_1 = __importDefault(require("os"));
19
19
  const sharp_1 = __importDefault(require("sharp"));
20
20
  class ThumbnailGenerator {
21
+ static getTime(videoPath) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ return new Promise((resolve, reject) => {
24
+ fluent_ffmpeg_1.default.ffprobe(videoPath, (err, metadata) => {
25
+ if (err) {
26
+ console.error("Error fetching metadata:", err);
27
+ reject(err);
28
+ return;
29
+ }
30
+ resolve(metadata.format.duration);
31
+ });
32
+ });
33
+ });
34
+ }
21
35
  static fromVideo(videoPath) {
22
36
  return __awaiter(this, void 0, void 0, function* () {
23
37
  const tempImagePath = path_1.default.join(os_1.default.tmpdir(), `thumbnail_${Date.now()}.png`);
@@ -31,7 +45,7 @@ class ThumbnailGenerator {
31
45
  timemarks: ["00:00:00.000"],
32
46
  filename: path_1.default.basename(tempImagePath),
33
47
  folder: path_1.default.dirname(tempImagePath),
34
- size: "320x?",
48
+ size: "400x?",
35
49
  });
36
50
  });
37
51
  const thumbnailBuffer = yield promises_1.default.readFile(tempImagePath);
@@ -9,8 +9,8 @@ declare class Network {
9
9
  };
10
10
  client: Client;
11
11
  session: Axios;
12
- api_url: null | string;
13
- wss_url: null | string;
12
+ apiUrl: null | string;
13
+ wssUrl: null | string;
14
14
  ws: WebSocket;
15
15
  agent: https.Agent;
16
16
  constructor(client: Client);
@@ -25,7 +25,7 @@ declare class Network {
25
25
  handleConnect(): Promise<void>;
26
26
  resetConnection(): Promise<void>;
27
27
  handleMessage(message: string): Promise<void>;
28
- upload_file(file: Buffer<ArrayBufferLike> | string, mime?: string | null, fileName?: string | null, chunk?: number, callback?: any): Promise<{
28
+ uploadFile(file: Buffer<ArrayBufferLike> | string, mime?: string | null, fileName?: string | null, chunk?: number, callback?: any): Promise<{
29
29
  mime: string;
30
30
  size: number;
31
31
  dc_id: string;
@@ -33,5 +33,6 @@ declare class Network {
33
33
  file_name: string;
34
34
  access_hash_rec: string;
35
35
  }>;
36
+ download(dc_id: number, file_id: number, access_hash: string, size: number, chunk?: number, callback?: (totalSize: number, downloadedSize: number) => Promise<void>, speed?: boolean): Promise<Buffer>;
36
37
  }
37
38
  export default Network;
@@ -51,6 +51,7 @@ const crypto_1 = __importDefault(require("../crypto"));
51
51
  const https_1 = __importDefault(require("https"));
52
52
  const fs = __importStar(require("fs"));
53
53
  const path = __importStar(require("path"));
54
+ const types_1 = require("../types");
54
55
  class Network {
55
56
  constructor(client) {
56
57
  this.heartbeatInterval = null;
@@ -62,12 +63,10 @@ class Network {
62
63
  };
63
64
  this.client = client;
64
65
  this.Headers["user-agent"] = this.client.userAgent;
65
- if (this.client.defaultPlatform["platform"] === "Android") {
66
- delete this.Headers["origin"];
67
- delete this.Headers["referer"];
66
+ if (this.client.defaultPlatform.platform === "Android") {
67
+ delete this.Headers.origin;
68
+ delete this.Headers.referer;
68
69
  this.Headers["user-agent"] = "okhttp/3.12.1";
69
- this.client.defaultPlatform["package"] = "app.rbmain.a";
70
- this.client.defaultPlatform["app_version"] = "3.6.4";
71
70
  }
72
71
  this.agent = new https_1.default.Agent({ rejectUnauthorized: false });
73
72
  const axiosConfig = {
@@ -76,8 +75,8 @@ class Network {
76
75
  httpsAgent: this.agent,
77
76
  };
78
77
  this.session = axios_1.default.create(axiosConfig);
79
- this.api_url = null;
80
- this.wss_url = null;
78
+ this.apiUrl = null;
79
+ this.wssUrl = null;
81
80
  this.ws = null;
82
81
  }
83
82
  getDcs() {
@@ -89,13 +88,13 @@ class Network {
89
88
  });
90
89
  if (response.status === 200) {
91
90
  const data = response.data.data;
92
- this.api_url = data.API[data.default_api] + "/";
93
- this.wss_url = data.socket[data.default_socket];
91
+ this.apiUrl = data.API[data.default_api] + "/";
92
+ this.wssUrl = data.socket[data.default_socket];
94
93
  return true;
95
94
  }
96
95
  }
97
- catch (error) {
98
- console.error("Error while fetching dcs:", error);
96
+ catch (_a) {
97
+ console.error("Error while fetching dcs");
99
98
  continue;
100
99
  }
101
100
  }
@@ -111,7 +110,7 @@ class Network {
111
110
  }
112
111
  }
113
112
  catch (error) {
114
- console.error("Error in request:", error);
113
+ console.error("Error in request ");
115
114
  continue;
116
115
  }
117
116
  }
@@ -123,9 +122,9 @@ class Network {
123
122
  let api_version = this.client.apiVersion;
124
123
  let auth = this.client.auth;
125
124
  let client = this.client.defaultPlatform;
126
- if (!this.api_url)
125
+ if (!this.apiUrl)
127
126
  yield this.getDcs();
128
- let url = this.api_url;
127
+ let url = this.apiUrl;
129
128
  let data = { api_version };
130
129
  data[tmp_session ? "tmp_session" : "auth"] = tmp_session
131
130
  ? auth
@@ -146,9 +145,9 @@ class Network {
146
145
  }
147
146
  getUpdates() {
148
147
  return __awaiter(this, void 0, void 0, function* () {
149
- if (!this.wss_url)
148
+ if (!this.wssUrl)
150
149
  yield this.getDcs();
151
- this.ws = new ws_1.default(this.wss_url);
150
+ this.ws = new ws_1.default(this.wssUrl);
152
151
  this.ws.on("open", () => __awaiter(this, void 0, void 0, function* () { return yield this.handleConnect(); }));
153
152
  this.ws.on("message", (message) => __awaiter(this, void 0, void 0, function* () { return yield this.handleMessage(message); }));
154
153
  this.ws.on("error", () => __awaiter(this, void 0, void 0, function* () { return yield this.resetConnection(); }));
@@ -193,8 +192,9 @@ class Network {
193
192
  return;
194
193
  const isValid = filters.length === 0 ||
195
194
  filters.every((filter) => filter(messageData));
195
+ const dataMessage = new types_1.Message(this.client, messageData);
196
196
  if (isValid) {
197
- yield callback(messageData);
197
+ yield callback(dataMessage);
198
198
  }
199
199
  }));
200
200
  }
@@ -203,8 +203,9 @@ class Network {
203
203
  }
204
204
  });
205
205
  }
206
- upload_file(file_1) {
206
+ uploadFile(file_1) {
207
207
  return __awaiter(this, arguments, void 0, function* (file, mime = null, fileName = null, chunk = 1048576, callback = null) {
208
+ var _a;
208
209
  if (typeof file === "string") {
209
210
  if (!fs.existsSync(file))
210
211
  throw new Error("File not found in the given path");
@@ -217,8 +218,8 @@ class Network {
217
218
  if (!fileName)
218
219
  throw new Error("File name is not set");
219
220
  if (!mime)
220
- mime = fileName.split(".").pop() || "";
221
- let result = yield this.client.request_send_file(fileName, file.length, mime);
221
+ mime = fileName.split(".").pop() || "application/octet-stream";
222
+ let result = yield this.client.requestSendFile(fileName, file.length, mime);
222
223
  let response;
223
224
  let id = result.id;
224
225
  let index = 0;
@@ -241,7 +242,7 @@ class Network {
241
242
  });
242
243
  if (response.data.status === "ERROR_TRY_AGAIN") {
243
244
  console.log("Retrying upload...");
244
- result = yield this.client.request_send_file(fileName, file.length, mime);
245
+ result = yield this.client.requestSendFile(fileName, file.length, mime);
245
246
  id = result.id;
246
247
  index = 0;
247
248
  dc_id = result.dc_id;
@@ -265,6 +266,8 @@ class Network {
265
266
  yield new Promise((resolve) => setTimeout(resolve, 5000));
266
267
  }
267
268
  if (response.data.status === "OK" && response.data.status_det === "OK") {
269
+ if (!((_a = response.data.data) === null || _a === void 0 ? void 0 : _a.access_hash_rec))
270
+ throw new Error("Error in upload file!!");
268
271
  return {
269
272
  mime,
270
273
  size: file.length,
@@ -278,5 +281,58 @@ class Network {
278
281
  }
279
282
  });
280
283
  }
284
+ download(dc_id_1, file_id_1, access_hash_1, size_1) {
285
+ return __awaiter(this, arguments, void 0, function* (dc_id, file_id, access_hash, size, chunk = 131072, callback, speed = false) {
286
+ const headers = {
287
+ auth: this.client.auth,
288
+ "access-hash-rec": access_hash,
289
+ "file-id": String(file_id),
290
+ "user-agent": this.client.userAgent,
291
+ };
292
+ const base_url = `https://messenger${dc_id}.iranlms.ir`;
293
+ const fetchChunk = (start_index, last_index) => __awaiter(this, void 0, void 0, function* () {
294
+ const chunk_headers = Object.assign(Object.assign({}, headers), { "start-index": String(start_index), "last-index": String(last_index) });
295
+ try {
296
+ const config = {
297
+ headers: chunk_headers,
298
+ };
299
+ const response = yield axios_1.default.post(`${base_url}/GetFile.ashx`, {}, config);
300
+ return Buffer.from(response.data);
301
+ }
302
+ catch (e) {
303
+ return Buffer.alloc(0);
304
+ }
305
+ });
306
+ if (speed) {
307
+ const tasks = [];
308
+ for (let start_index = 0; start_index < size; start_index += chunk) {
309
+ const last_index = Math.min(start_index + chunk, size) - 1;
310
+ tasks.push(fetchChunk(start_index, last_index));
311
+ }
312
+ const resultChunks = yield Promise.all(tasks);
313
+ const result = Buffer.concat(resultChunks);
314
+ if (callback) {
315
+ yield callback(size, result.length);
316
+ }
317
+ return result;
318
+ }
319
+ else {
320
+ let result = Buffer.alloc(0);
321
+ let start_index = 0;
322
+ while (start_index < size) {
323
+ const last_index = Math.min(start_index + chunk, size) - 1;
324
+ const data = yield fetchChunk(start_index, last_index);
325
+ if (data.length === 0)
326
+ break;
327
+ result = Buffer.concat([result, data]);
328
+ start_index = last_index + 1;
329
+ if (callback) {
330
+ yield callback(size, result.length);
331
+ }
332
+ }
333
+ return result;
334
+ }
335
+ });
336
+ }
281
337
  }
282
338
  exports.default = Network;
@@ -0,0 +1,25 @@
1
+ type MarkdownEntity = {
2
+ type: string;
3
+ from_index: number;
4
+ length: number;
5
+ language?: string;
6
+ mention_text_object_guid?: string;
7
+ mention_text_object_type?: string;
8
+ link?: {
9
+ type: string;
10
+ hyperlink_data: {
11
+ url: string;
12
+ };
13
+ };
14
+ };
15
+ declare class Markdown {
16
+ static markdownRegExp: RegExp;
17
+ static markdownEntities: Record<string, string>;
18
+ static toMetadata(text: string): {
19
+ text: string;
20
+ metadata?: {
21
+ meta_data_parts: MarkdownEntity[];
22
+ };
23
+ };
24
+ }
25
+ export default Markdown;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Markdown {
4
+ static toMetadata(text) {
5
+ let entities = [];
6
+ let match;
7
+ let remainingText = text;
8
+ let parsedTextParts = [];
9
+ let offset = 0;
10
+ while ((match = remainingText.match(this.markdownRegExp))) {
11
+ const matchIndex = offset + (match.index || 0);
12
+ parsedTextParts.push(remainingText.substring(0, match.index));
13
+ let matchedContent = match[3] || match[8] || match[11] || match[13];
14
+ if (matchedContent) {
15
+ offset -= matchedContent.length;
16
+ matchedContent = matchedContent.trim();
17
+ offset += matchedContent.length;
18
+ if (/^`*$/.test(matchedContent)) {
19
+ parsedTextParts.push(match[0]);
20
+ }
21
+ else if (match[3]) {
22
+ if (match[5] === "\n") {
23
+ match[5] = "";
24
+ offset -= 1;
25
+ }
26
+ parsedTextParts.push(match[1] + matchedContent + match[5]);
27
+ entities.push({
28
+ type: "Pre",
29
+ language: "",
30
+ from_index: matchIndex + match[1].length,
31
+ length: matchedContent.length,
32
+ });
33
+ offset -= match[2].length + match[4].length;
34
+ }
35
+ else if (match[7]) {
36
+ parsedTextParts.push(match[6] + matchedContent + match[9]);
37
+ entities.push({
38
+ type: this.markdownEntities[match[7]],
39
+ from_index: matchIndex + match[6].length,
40
+ length: matchedContent.length,
41
+ });
42
+ offset -= 2 * match[7].length;
43
+ }
44
+ else if (match[11]) {
45
+ parsedTextParts.push(matchedContent);
46
+ entities.push({
47
+ type: "MentionText",
48
+ mention_text_object_guid: match[10],
49
+ from_index: matchIndex,
50
+ length: matchedContent.length,
51
+ mention_text_object_type: "User",
52
+ });
53
+ offset -= match[0].length - matchedContent.length;
54
+ }
55
+ else if (match[12]) {
56
+ const [label, url] = [match[12], match[13]];
57
+ let mentionType;
58
+ if (url.length === 32) {
59
+ if (url.startsWith("u"))
60
+ mentionType = "User";
61
+ else if (url.startsWith("g"))
62
+ mentionType = "Group";
63
+ else if (url.startsWith("c"))
64
+ mentionType = "Channel";
65
+ }
66
+ parsedTextParts.push(label);
67
+ const metaDataPart = {
68
+ type: mentionType ? "MentionText" : "Link",
69
+ from_index: matchIndex,
70
+ length: label.length,
71
+ };
72
+ if (mentionType) {
73
+ metaDataPart.mention_text_object_guid = url;
74
+ metaDataPart.mention_text_object_type = mentionType;
75
+ }
76
+ else {
77
+ metaDataPart.link = { type: "hyperlink", hyperlink_data: { url } };
78
+ }
79
+ entities.push(metaDataPart);
80
+ offset -= match[0].length - label.length;
81
+ }
82
+ remainingText = remainingText.substring(match.index + match[0].length);
83
+ offset += match.index + match[0].length;
84
+ }
85
+ }
86
+ parsedTextParts.push(remainingText);
87
+ let resultText = parsedTextParts.join("");
88
+ if (!resultText.replace(/\s+/g, "").length) {
89
+ resultText = text;
90
+ entities.splice(0, entities.length);
91
+ }
92
+ if (!entities.length) {
93
+ resultText = resultText.trim();
94
+ }
95
+ let returnData = {
96
+ text: resultText,
97
+ };
98
+ if (entities.length > 0)
99
+ returnData.metadata = { meta_data_parts: entities };
100
+ return returnData;
101
+ }
102
+ }
103
+ Markdown.markdownRegExp = /(^|\s|\n)(````?)([\s\S]+?)(````?)([\s\n\.,:?!;]|$)|(^|\s)(`|\*\*|__|~~|--|\|\|)([^\n]+?)\7([\s\.,:?!;]|$)|@([a-zA-Z0-9]+)\s*\((.+?)\)|\[(.+?)\]\((.+?)\)/m;
104
+ Markdown.markdownEntities = {
105
+ "`": "Mono",
106
+ "**": "Bold",
107
+ __: "Italic",
108
+ "||": "Spoiler",
109
+ "~~": "Strike",
110
+ "--": "Underline",
111
+ };
112
+ exports.default = Markdown;
@@ -8,7 +8,6 @@ class SQLiteSession {
8
8
  constructor(sessionName) {
9
9
  this.dbFile = sessionName.endsWith(".rp") ? sessionName : `${sessionName}.rp`;
10
10
  this.db = new better_sqlite3_1.default(this.dbFile);
11
- this.db.pragma("journal_mode = WAL");
12
11
  this.initializeDB();
13
12
  }
14
13
  handleError(operation, callback) {
@@ -22,6 +21,7 @@ class SQLiteSession {
22
21
  }
23
22
  initializeDB() {
24
23
  this.handleError("initializeDB", () => {
24
+ this.db.pragma("journal_mode = DELETE");
25
25
  const sessionTable = this.db
26
26
  .prepare("SELECT name FROM sqlite_master WHERE type=? AND name=?")
27
27
  .get("table", "session");
@@ -1,3 +1,12 @@
1
+ interface SendCode {
2
+ phone_code_hash: string;
3
+ status: string;
4
+ code_digits_count: number;
5
+ has_confirmed_recovery_email: boolean;
6
+ no_recovery_alert: string;
7
+ send_type: string;
8
+ hint_pass_key: string;
9
+ }
1
10
  interface AvatarThumbnail {
2
11
  file_id: string;
3
12
  mime: string;
@@ -27,4 +36,5 @@ interface SignIn {
27
36
  user: User;
28
37
  timestamp: number;
29
38
  }
30
- export default SignIn;
39
+ export { SignIn, SendCode };
40
+ export default SendCode;
@@ -0,0 +1,79 @@
1
+ import MessageUpdate, { ChatUpdates } from "./decorators";
2
+ interface Avatar {
3
+ file_id: string;
4
+ mime: string;
5
+ dc_id: string;
6
+ access_hash_rec: string;
7
+ }
8
+ interface getTopChatUsers {
9
+ abs_users: {
10
+ object_guid: string;
11
+ type: string;
12
+ first_name: string;
13
+ avatar_thumbnail: Avatar;
14
+ is_verified: boolean;
15
+ is_deleted: boolean;
16
+ }[];
17
+ timestamp: string;
18
+ }
19
+ interface GetObjectInfoByUsername {
20
+ exist: boolean;
21
+ type: string;
22
+ channel: {
23
+ channel_guid: string;
24
+ channel_title: string;
25
+ avatar_thumbnail: Avatar;
26
+ count_members: number;
27
+ description: string;
28
+ username: string;
29
+ is_deleted: boolean;
30
+ is_verified: boolean;
31
+ share_url: string;
32
+ channel_type: string;
33
+ sign_messages: boolean;
34
+ chat_reaction_setting: {
35
+ reaction_type: string;
36
+ selected_reactions: string[];
37
+ };
38
+ is_restricted_content: boolean;
39
+ };
40
+ chat: {
41
+ object_guid: string;
42
+ access: string[];
43
+ count_unseen: number;
44
+ is_mute: boolean;
45
+ is_pinned: boolean;
46
+ time_string: string;
47
+ last_message: {
48
+ message_id: string;
49
+ type: string;
50
+ text: string;
51
+ is_mine: boolean;
52
+ };
53
+ last_seen_my_mid: string;
54
+ last_seen_peer_mid: string;
55
+ status: string;
56
+ time: number;
57
+ pinned_message_id: string;
58
+ abs_object: {
59
+ object_guid: string;
60
+ type: string;
61
+ title: string;
62
+ avatar_thumbnail: [Object];
63
+ is_verified: boolean;
64
+ is_deleted: boolean;
65
+ };
66
+ is_blocked: boolean;
67
+ last_message_id: string;
68
+ last_deleted_mid: string;
69
+ pinned_message_ids: string[];
70
+ };
71
+ timestamp: string;
72
+ }
73
+ interface SendLive {
74
+ message_update: MessageUpdate;
75
+ chat_update: ChatUpdates;
76
+ status: string;
77
+ publish_text: string;
78
+ }
79
+ export { getTopChatUsers, GetObjectInfoByUsername, SendLive };
@@ -74,6 +74,16 @@ interface PollData {
74
74
  type: string;
75
75
  allows_multiple_answers: boolean;
76
76
  }
77
+ interface MetaData {
78
+ meta_data_parts: {
79
+ from_index: number;
80
+ length: number;
81
+ type: string;
82
+ link?: {
83
+ url: string;
84
+ };
85
+ }[];
86
+ }
77
87
  interface Message {
78
88
  message_id: string;
79
89
  text?: string;
@@ -95,6 +105,7 @@ interface Message {
95
105
  message_id: string;
96
106
  object_guid: string;
97
107
  };
108
+ metadata?: MetaData;
98
109
  count_seen?: string;
99
110
  thumb_inline?: string;
100
111
  }
@@ -109,4 +120,49 @@ interface MessageUpdate {
109
120
  type: string;
110
121
  state: string;
111
122
  }
123
+ interface ChatUpdates {
124
+ object_guid: string;
125
+ action: string;
126
+ chat: {
127
+ time_string: string;
128
+ last_message: {
129
+ message_id: string;
130
+ type: string;
131
+ text: string;
132
+ author_object_guid?: string;
133
+ is_mine: boolean;
134
+ author_title?: string;
135
+ author_type?: string;
136
+ };
137
+ last_seen_peer_mid?: string;
138
+ last_seen_my_mid?: string;
139
+ status?: string;
140
+ time: number;
141
+ last_message_id: string;
142
+ group_voice_chat_id?: string;
143
+ };
144
+ updated_parameters: string[];
145
+ timestamp: string;
146
+ type: string;
147
+ }
148
+ interface ShowActivities {
149
+ type: string;
150
+ object_guid: string;
151
+ object_type: string;
152
+ user_activity_guid: string;
153
+ }
154
+ interface ShowNotifications {
155
+ notification_id: string;
156
+ type: string;
157
+ title: string;
158
+ text: string;
159
+ image_file_id?: number;
160
+ message_data: {
161
+ object_guid: string;
162
+ object_type: string;
163
+ message_id: number;
164
+ sender_guid?: string;
165
+ };
166
+ }
167
+ export { MessageUpdate, ChatUpdates, ShowActivities, ShowNotifications, Message, FileInline };
112
168
  export default MessageUpdate;