rubjs 2.2.3 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (398) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/rubjs/client.d.ts +0 -35
  4. package/rubjs/client.js +0 -48
  5. package/rubjs/crypto/index.d.ts +0 -12
  6. package/rubjs/crypto/index.js +0 -95
  7. package/rubjs/index.d.ts +0 -7
  8. package/rubjs/index.js +0 -51
  9. package/rubjs/methods/advanced/builder.d.ts +0 -3
  10. package/rubjs/methods/advanced/builder.js +0 -41
  11. package/rubjs/methods/advanced/index.d.ts +0 -2
  12. package/rubjs/methods/advanced/index.js +0 -8
  13. package/rubjs/methods/auth/index.d.ts +0 -5
  14. package/rubjs/methods/auth/index.js +0 -14
  15. package/rubjs/methods/auth/logout.d.ts +0 -3
  16. package/rubjs/methods/auth/logout.js +0 -17
  17. package/rubjs/methods/auth/registerDevice.d.ts +0 -3
  18. package/rubjs/methods/auth/registerDevice.js +0 -61
  19. package/rubjs/methods/auth/sendCode.d.ts +0 -3
  20. package/rubjs/methods/auth/sendCode.js +0 -25
  21. package/rubjs/methods/auth/signIn.d.ts +0 -3
  22. package/rubjs/methods/auth/signIn.js +0 -24
  23. package/rubjs/methods/channels/addChannel.d.ts +0 -3
  24. package/rubjs/methods/channels/addChannel.js +0 -26
  25. package/rubjs/methods/channels/addChannelMembers.d.ts +0 -3
  26. package/rubjs/methods/channels/addChannelMembers.js +0 -22
  27. package/rubjs/methods/channels/banChannelMember.d.ts +0 -3
  28. package/rubjs/methods/channels/banChannelMember.js +0 -23
  29. package/rubjs/methods/channels/cancelChangeObjectOwner.d.ts +0 -3
  30. package/rubjs/methods/channels/cancelChangeObjectOwner.js +0 -17
  31. package/rubjs/methods/channels/channelPreviewByJoinLink.d.ts +0 -3
  32. package/rubjs/methods/channels/channelPreviewByJoinLink.js +0 -19
  33. package/rubjs/methods/channels/checkChannelUsername.d.ts +0 -3
  34. package/rubjs/methods/channels/checkChannelUsername.js +0 -19
  35. package/rubjs/methods/channels/createChannelVoiceChat.d.ts +0 -3
  36. package/rubjs/methods/channels/createChannelVoiceChat.js +0 -17
  37. package/rubjs/methods/channels/discardChannelVoiceChat.d.ts +0 -3
  38. package/rubjs/methods/channels/discardChannelVoiceChat.js +0 -20
  39. package/rubjs/methods/channels/editChannelInfo.d.ts +0 -4
  40. package/rubjs/methods/channels/editChannelInfo.js +0 -48
  41. package/rubjs/methods/channels/getBannedChannelMembers.d.ts +0 -3
  42. package/rubjs/methods/channels/getBannedChannelMembers.js +0 -20
  43. package/rubjs/methods/channels/getChannelAdminAccessList.d.ts +0 -3
  44. package/rubjs/methods/channels/getChannelAdminAccessList.js +0 -20
  45. package/rubjs/methods/channels/getChannelAdminMembers.d.ts +0 -3
  46. package/rubjs/methods/channels/getChannelAdminMembers.js +0 -20
  47. package/rubjs/methods/channels/getChannelAllMembers.d.ts +0 -3
  48. package/rubjs/methods/channels/getChannelAllMembers.js +0 -21
  49. package/rubjs/methods/channels/getChannelInfo.d.ts +0 -3
  50. package/rubjs/methods/channels/getChannelInfo.js +0 -17
  51. package/rubjs/methods/channels/getChannelLink.d.ts +0 -3
  52. package/rubjs/methods/channels/getChannelLink.js +0 -17
  53. package/rubjs/methods/channels/getPendingObjectOwner.d.ts +0 -3
  54. package/rubjs/methods/channels/getPendingObjectOwner.js +0 -17
  55. package/rubjs/methods/channels/index.d.ts +0 -26
  56. package/rubjs/methods/channels/index.js +0 -56
  57. package/rubjs/methods/channels/joinChannelAction.d.ts +0 -3
  58. package/rubjs/methods/channels/joinChannelAction.js +0 -19
  59. package/rubjs/methods/channels/joinChannelByLink.d.ts +0 -3
  60. package/rubjs/methods/channels/joinChannelByLink.js +0 -19
  61. package/rubjs/methods/channels/leaveChannelVoiceChat.d.ts +0 -3
  62. package/rubjs/methods/channels/leaveChannelVoiceChat.js +0 -20
  63. package/rubjs/methods/channels/removeChannel.d.ts +0 -3
  64. package/rubjs/methods/channels/removeChannel.js +0 -17
  65. package/rubjs/methods/channels/requestChangeObjectOwner.d.ts +0 -3
  66. package/rubjs/methods/channels/requestChangeObjectOwner.js +0 -20
  67. package/rubjs/methods/channels/seenChannelMessages.d.ts +0 -3
  68. package/rubjs/methods/channels/seenChannelMessages.js +0 -21
  69. package/rubjs/methods/channels/setChannelLink.d.ts +0 -3
  70. package/rubjs/methods/channels/setChannelLink.js +0 -17
  71. package/rubjs/methods/channels/setChannelVoiceChatSetting.d.ts +0 -3
  72. package/rubjs/methods/channels/setChannelVoiceChatSetting.js +0 -26
  73. package/rubjs/methods/channels/updateChannelUsername.d.ts +0 -3
  74. package/rubjs/methods/channels/updateChannelUsername.js +0 -20
  75. package/rubjs/methods/chats/actionOnJoinRequest.d.ts +0 -3
  76. package/rubjs/methods/chats/actionOnJoinRequest.js +0 -22
  77. package/rubjs/methods/chats/addLiveComment.d.ts +0 -3
  78. package/rubjs/methods/chats/addLiveComment.js +0 -17
  79. package/rubjs/methods/chats/clickMessageUrl.d.ts +0 -3
  80. package/rubjs/methods/chats/clickMessageUrl.js +0 -17
  81. package/rubjs/methods/chats/createJoinLink.d.ts +0 -3
  82. package/rubjs/methods/chats/createJoinLink.js +0 -23
  83. package/rubjs/methods/chats/deleteAvatar.d.ts +0 -3
  84. package/rubjs/methods/chats/deleteAvatar.js +0 -17
  85. package/rubjs/methods/chats/deleteChatHistory.d.ts +0 -3
  86. package/rubjs/methods/chats/deleteChatHistory.js +0 -20
  87. package/rubjs/methods/chats/editJoinLink.d.ts +0 -3
  88. package/rubjs/methods/chats/editJoinLink.js +0 -34
  89. package/rubjs/methods/chats/getAbsObjects.d.ts +0 -3
  90. package/rubjs/methods/chats/getAbsObjects.js +0 -19
  91. package/rubjs/methods/chats/getAvatars.d.ts +0 -3
  92. package/rubjs/methods/chats/getAvatars.js +0 -17
  93. package/rubjs/methods/chats/getChatReaction.d.ts +0 -3
  94. package/rubjs/methods/chats/getChatReaction.js +0 -17
  95. package/rubjs/methods/chats/getChats.d.ts +0 -3
  96. package/rubjs/methods/chats/getChats.js +0 -17
  97. package/rubjs/methods/chats/getChatsUpdates.d.ts +0 -3
  98. package/rubjs/methods/chats/getChatsUpdates.js +0 -17
  99. package/rubjs/methods/chats/getJoinLinks.d.ts +0 -3
  100. package/rubjs/methods/chats/getJoinLinks.js +0 -17
  101. package/rubjs/methods/chats/getJoinRequests.d.ts +0 -3
  102. package/rubjs/methods/chats/getJoinRequests.js +0 -17
  103. package/rubjs/methods/chats/getLinkFromAppUrl.d.ts +0 -3
  104. package/rubjs/methods/chats/getLinkFromAppUrl.js +0 -17
  105. package/rubjs/methods/chats/getLiveComments.d.ts +0 -3
  106. package/rubjs/methods/chats/getLiveComments.js +0 -17
  107. package/rubjs/methods/chats/getLivePlayUrl.d.ts +0 -3
  108. package/rubjs/methods/chats/getLivePlayUrl.js +0 -17
  109. package/rubjs/methods/chats/getLiveStatus.d.ts +0 -3
  110. package/rubjs/methods/chats/getLiveStatus.js +0 -17
  111. package/rubjs/methods/chats/getObjectInfoByUsername.d.ts +0 -3
  112. package/rubjs/methods/chats/getObjectInfoByUsername.js +0 -19
  113. package/rubjs/methods/chats/getTopChatUsers.d.ts +0 -3
  114. package/rubjs/methods/chats/getTopChatUsers.js +0 -18
  115. package/rubjs/methods/chats/index.d.ts +0 -29
  116. package/rubjs/methods/chats/index.js +0 -62
  117. package/rubjs/methods/chats/removeFromTopChatUsers.d.ts +0 -3
  118. package/rubjs/methods/chats/removeFromTopChatUsers.js +0 -17
  119. package/rubjs/methods/chats/removeJoinLink.d.ts +0 -3
  120. package/rubjs/methods/chats/removeJoinLink.js +0 -19
  121. package/rubjs/methods/chats/searchChatMessages.d.ts +0 -3
  122. package/rubjs/methods/chats/searchChatMessages.js +0 -23
  123. package/rubjs/methods/chats/searchGlobalMessages.d.ts +0 -3
  124. package/rubjs/methods/chats/searchGlobalMessages.js +0 -17
  125. package/rubjs/methods/chats/seenChats.d.ts +0 -3
  126. package/rubjs/methods/chats/seenChats.js +0 -17
  127. package/rubjs/methods/chats/sendChatActivity.d.ts +0 -3
  128. package/rubjs/methods/chats/sendChatActivity.js +0 -19
  129. package/rubjs/methods/chats/sendLive.d.ts +0 -3
  130. package/rubjs/methods/chats/sendLive.js +0 -28
  131. package/rubjs/methods/chats/setActionChat.d.ts +0 -3
  132. package/rubjs/methods/chats/setActionChat.js +0 -19
  133. package/rubjs/methods/chats/uploadAvatar.d.ts +0 -3
  134. package/rubjs/methods/chats/uploadAvatar.js +0 -29
  135. package/rubjs/methods/contacts/addAddressBook.d.ts +0 -3
  136. package/rubjs/methods/contacts/addAddressBook.js +0 -17
  137. package/rubjs/methods/contacts/deleteContact.d.ts +0 -3
  138. package/rubjs/methods/contacts/deleteContact.js +0 -17
  139. package/rubjs/methods/contacts/getContacts.d.ts +0 -3
  140. package/rubjs/methods/contacts/getContacts.js +0 -17
  141. package/rubjs/methods/contacts/getContactsLastOnline.d.ts +0 -3
  142. package/rubjs/methods/contacts/getContactsLastOnline.js +0 -17
  143. package/rubjs/methods/contacts/getContactsUpdates.d.ts +0 -3
  144. package/rubjs/methods/contacts/getContactsUpdates.js +0 -17
  145. package/rubjs/methods/contacts/index.d.ts +0 -7
  146. package/rubjs/methods/contacts/index.js +0 -18
  147. package/rubjs/methods/contacts/resetContacts.d.ts +0 -3
  148. package/rubjs/methods/contacts/resetContacts.js +0 -18
  149. package/rubjs/methods/extras/banMember.d.ts +0 -3
  150. package/rubjs/methods/extras/banMember.js +0 -20
  151. package/rubjs/methods/extras/getInfo.d.ts +0 -3
  152. package/rubjs/methods/extras/getInfo.js +0 -26
  153. package/rubjs/methods/extras/getObjectByUsername.d.ts +0 -3
  154. package/rubjs/methods/extras/getObjectByUsername.js +0 -19
  155. package/rubjs/methods/extras/getProfileLinkItems.d.ts +0 -3
  156. package/rubjs/methods/extras/getProfileLinkItems.js +0 -17
  157. package/rubjs/methods/extras/getRelatedObjects.d.ts +0 -3
  158. package/rubjs/methods/extras/getRelatedObjects.js +0 -17
  159. package/rubjs/methods/extras/getTranscription.d.ts +0 -3
  160. package/rubjs/methods/extras/getTranscription.js +0 -20
  161. package/rubjs/methods/extras/index.d.ts +0 -13
  162. package/rubjs/methods/extras/index.js +0 -30
  163. package/rubjs/methods/extras/join.d.ts +0 -3
  164. package/rubjs/methods/extras/join.js +0 -22
  165. package/rubjs/methods/extras/leaveChat.d.ts +0 -3
  166. package/rubjs/methods/extras/leaveChat.js +0 -20
  167. package/rubjs/methods/extras/reportObject.d.ts +0 -14
  168. package/rubjs/methods/extras/reportObject.js +0 -32
  169. package/rubjs/methods/extras/searchGlobalObjects.d.ts +0 -3
  170. package/rubjs/methods/extras/searchGlobalObjects.js +0 -17
  171. package/rubjs/methods/extras/transcribeVoice.d.ts +0 -3
  172. package/rubjs/methods/extras/transcribeVoice.js +0 -17
  173. package/rubjs/methods/extras/userIsAdmin.d.ts +0 -3
  174. package/rubjs/methods/extras/userIsAdmin.js +0 -29
  175. package/rubjs/methods/gif/addToMyGifSet.d.ts +0 -3
  176. package/rubjs/methods/gif/addToMyGifSet.js +0 -17
  177. package/rubjs/methods/gif/getMyGifSet.d.ts +0 -3
  178. package/rubjs/methods/gif/getMyGifSet.js +0 -17
  179. package/rubjs/methods/gif/index.d.ts +0 -4
  180. package/rubjs/methods/gif/index.js +0 -12
  181. package/rubjs/methods/gif/removeFromMyGifSet.d.ts +0 -3
  182. package/rubjs/methods/gif/removeFromMyGifSet.js +0 -17
  183. package/rubjs/methods/groups/addGroup.d.ts +0 -3
  184. package/rubjs/methods/groups/addGroup.js +0 -19
  185. package/rubjs/methods/groups/addGroupMembers.d.ts +0 -3
  186. package/rubjs/methods/groups/addGroupMembers.js +0 -19
  187. package/rubjs/methods/groups/banGroupMember.d.ts +0 -3
  188. package/rubjs/methods/groups/banGroupMember.js +0 -23
  189. package/rubjs/methods/groups/createGroupVoiceChat.d.ts +0 -3
  190. package/rubjs/methods/groups/createGroupVoiceChat.js +0 -17
  191. package/rubjs/methods/groups/deleteNoAccessGroupChat.d.ts +0 -3
  192. package/rubjs/methods/groups/deleteNoAccessGroupChat.js +0 -17
  193. package/rubjs/methods/groups/discardGroupVoiceChat.d.ts +0 -3
  194. package/rubjs/methods/groups/discardGroupVoiceChat.js +0 -20
  195. package/rubjs/methods/groups/editGroupInfo.d.ts +0 -6
  196. package/rubjs/methods/groups/editGroupInfo.js +0 -51
  197. package/rubjs/methods/groups/getBannedGroupMembers.d.ts +0 -3
  198. package/rubjs/methods/groups/getBannedGroupMembers.js +0 -17
  199. package/rubjs/methods/groups/getGroupAdminAccessList.d.ts +0 -3
  200. package/rubjs/methods/groups/getGroupAdminAccessList.js +0 -20
  201. package/rubjs/methods/groups/getGroupAdminMembers.d.ts +0 -3
  202. package/rubjs/methods/groups/getGroupAdminMembers.js +0 -17
  203. package/rubjs/methods/groups/getGroupAllMembers.d.ts +0 -3
  204. package/rubjs/methods/groups/getGroupAllMembers.js +0 -21
  205. package/rubjs/methods/groups/getGroupDefaultAccess.d.ts +0 -3
  206. package/rubjs/methods/groups/getGroupDefaultAccess.js +0 -17
  207. package/rubjs/methods/groups/getGroupInfo.d.ts +0 -3
  208. package/rubjs/methods/groups/getGroupInfo.js +0 -17
  209. package/rubjs/methods/groups/getGroupLink.d.ts +0 -3
  210. package/rubjs/methods/groups/getGroupLink.js +0 -17
  211. package/rubjs/methods/groups/getGroupMentionList.d.ts +0 -3
  212. package/rubjs/methods/groups/getGroupMentionList.js +0 -20
  213. package/rubjs/methods/groups/getGroupOnlineCount.d.ts +0 -3
  214. package/rubjs/methods/groups/getGroupOnlineCount.js +0 -17
  215. package/rubjs/methods/groups/getGroupVoiceChatUpdates.d.ts +0 -3
  216. package/rubjs/methods/groups/getGroupVoiceChatUpdates.js +0 -21
  217. package/rubjs/methods/groups/groupPreviewByJoinLink.d.ts +0 -3
  218. package/rubjs/methods/groups/groupPreviewByJoinLink.js +0 -19
  219. package/rubjs/methods/groups/index.d.ts +0 -28
  220. package/rubjs/methods/groups/index.js +0 -60
  221. package/rubjs/methods/groups/joinGroup.d.ts +0 -3
  222. package/rubjs/methods/groups/joinGroup.js +0 -19
  223. package/rubjs/methods/groups/leaveGroup.d.ts +0 -3
  224. package/rubjs/methods/groups/leaveGroup.js +0 -17
  225. package/rubjs/methods/groups/leaveGroupVoiceChat.d.ts +0 -3
  226. package/rubjs/methods/groups/leaveGroupVoiceChat.js +0 -20
  227. package/rubjs/methods/groups/removeGroup.d.ts +0 -3
  228. package/rubjs/methods/groups/removeGroup.js +0 -17
  229. package/rubjs/methods/groups/seenGroupMessages.d.ts +0 -3
  230. package/rubjs/methods/groups/seenGroupMessages.js +0 -21
  231. package/rubjs/methods/groups/setGroupAdmin.d.ts +0 -5
  232. package/rubjs/methods/groups/setGroupAdmin.js +0 -26
  233. package/rubjs/methods/groups/setGroupDefaultAccess.d.ts +0 -4
  234. package/rubjs/methods/groups/setGroupDefaultAccess.js +0 -22
  235. package/rubjs/methods/groups/setGroupLink.d.ts +0 -3
  236. package/rubjs/methods/groups/setGroupLink.js +0 -17
  237. package/rubjs/methods/groups/setGroupVoiceChatSetting.d.ts +0 -3
  238. package/rubjs/methods/groups/setGroupVoiceChatSetting.js +0 -26
  239. package/rubjs/methods/index.d.ts +0 -186
  240. package/rubjs/methods/index.js +0 -923
  241. package/rubjs/methods/messages/actionOnMessageReaction.d.ts +0 -3
  242. package/rubjs/methods/messages/actionOnMessageReaction.js +0 -25
  243. package/rubjs/methods/messages/createPoll.d.ts +0 -3
  244. package/rubjs/methods/messages/createPoll.js +0 -35
  245. package/rubjs/methods/messages/deleteMessages.d.ts +0 -3
  246. package/rubjs/methods/messages/deleteMessages.js +0 -26
  247. package/rubjs/methods/messages/editMessage.d.ts +0 -3
  248. package/rubjs/methods/messages/editMessage.js +0 -23
  249. package/rubjs/methods/messages/forwardMessages.d.ts +0 -3
  250. package/rubjs/methods/messages/forwardMessages.js +0 -31
  251. package/rubjs/methods/messages/getMessageShareUrl.d.ts +0 -3
  252. package/rubjs/methods/messages/getMessageShareUrl.js +0 -17
  253. package/rubjs/methods/messages/getMessages.d.ts +0 -3
  254. package/rubjs/methods/messages/getMessages.js +0 -23
  255. package/rubjs/methods/messages/getMessagesByID.d.ts +0 -3
  256. package/rubjs/methods/messages/getMessagesByID.js +0 -22
  257. package/rubjs/methods/messages/getMessagesInterval.d.ts +0 -3
  258. package/rubjs/methods/messages/getMessagesInterval.js +0 -20
  259. package/rubjs/methods/messages/getMessagesUpdates.d.ts +0 -3
  260. package/rubjs/methods/messages/getMessagesUpdates.js +0 -17
  261. package/rubjs/methods/messages/getPollOptionVoters.d.ts +0 -3
  262. package/rubjs/methods/messages/getPollOptionVoters.js +0 -21
  263. package/rubjs/methods/messages/getPollStatus.d.ts +0 -3
  264. package/rubjs/methods/messages/getPollStatus.js +0 -17
  265. package/rubjs/methods/messages/index.d.ts +0 -26
  266. package/rubjs/methods/messages/index.js +0 -56
  267. package/rubjs/methods/messages/requestSendFile.d.ts +0 -4
  268. package/rubjs/methods/messages/requestSendFile.js +0 -22
  269. package/rubjs/methods/messages/sendDocument.d.ts +0 -3
  270. package/rubjs/methods/messages/sendDocument.js +0 -17
  271. package/rubjs/methods/messages/sendGif.d.ts +0 -3
  272. package/rubjs/methods/messages/sendGif.js +0 -17
  273. package/rubjs/methods/messages/sendMessage.d.ts +0 -3
  274. package/rubjs/methods/messages/sendMessage.js +0 -134
  275. package/rubjs/methods/messages/sendMusic.d.ts +0 -3
  276. package/rubjs/methods/messages/sendMusic.js +0 -17
  277. package/rubjs/methods/messages/sendPhoto.d.ts +0 -3
  278. package/rubjs/methods/messages/sendPhoto.js +0 -17
  279. package/rubjs/methods/messages/sendSticker.d.ts +0 -3
  280. package/rubjs/methods/messages/sendSticker.js +0 -17
  281. package/rubjs/methods/messages/sendText.d.ts +0 -3
  282. package/rubjs/methods/messages/sendText.js +0 -17
  283. package/rubjs/methods/messages/sendVideo.d.ts +0 -3
  284. package/rubjs/methods/messages/sendVideo.js +0 -17
  285. package/rubjs/methods/messages/sendVideoMessage.d.ts +0 -3
  286. package/rubjs/methods/messages/sendVideoMessage.js +0 -17
  287. package/rubjs/methods/messages/sendVoice.d.ts +0 -3
  288. package/rubjs/methods/messages/sendVoice.js +0 -17
  289. package/rubjs/methods/messages/setPinMessage.d.ts +0 -3
  290. package/rubjs/methods/messages/setPinMessage.js +0 -23
  291. package/rubjs/methods/messages/votePoll.d.ts +0 -3
  292. package/rubjs/methods/messages/votePoll.js +0 -17
  293. package/rubjs/methods/settings/changePassword.d.ts +0 -3
  294. package/rubjs/methods/settings/changePassword.js +0 -17
  295. package/rubjs/methods/settings/checkTwoStepPasscode.d.ts +0 -3
  296. package/rubjs/methods/settings/checkTwoStepPasscode.js +0 -17
  297. package/rubjs/methods/settings/deleteFolder.d.ts +0 -3
  298. package/rubjs/methods/settings/deleteFolder.js +0 -17
  299. package/rubjs/methods/settings/getBlockedUsers.d.ts +0 -3
  300. package/rubjs/methods/settings/getBlockedUsers.js +0 -17
  301. package/rubjs/methods/settings/getFolders.d.ts +0 -3
  302. package/rubjs/methods/settings/getFolders.js +0 -17
  303. package/rubjs/methods/settings/getMySessions.d.ts +0 -3
  304. package/rubjs/methods/settings/getMySessions.js +0 -17
  305. package/rubjs/methods/settings/getPrivacySetting.d.ts +0 -3
  306. package/rubjs/methods/settings/getPrivacySetting.js +0 -17
  307. package/rubjs/methods/settings/getSuggestedFolders.d.ts +0 -3
  308. package/rubjs/methods/settings/getSuggestedFolders.js +0 -17
  309. package/rubjs/methods/settings/getTwoPasscodeStatus.d.ts +0 -3
  310. package/rubjs/methods/settings/getTwoPasscodeStatus.js +0 -17
  311. package/rubjs/methods/settings/index.d.ts +0 -19
  312. package/rubjs/methods/settings/index.js +0 -42
  313. package/rubjs/methods/settings/requestRecoveryEmail.d.ts +0 -3
  314. package/rubjs/methods/settings/requestRecoveryEmail.js +0 -20
  315. package/rubjs/methods/settings/setSetting.d.ts +0 -5
  316. package/rubjs/methods/settings/setSetting.js +0 -50
  317. package/rubjs/methods/settings/setupTwoStepVerification.d.ts +0 -3
  318. package/rubjs/methods/settings/setupTwoStepVerification.js +0 -21
  319. package/rubjs/methods/settings/terminateOtherSessions.d.ts +0 -3
  320. package/rubjs/methods/settings/terminateOtherSessions.js +0 -18
  321. package/rubjs/methods/settings/terminateSession.d.ts +0 -3
  322. package/rubjs/methods/settings/terminateSession.js +0 -17
  323. package/rubjs/methods/settings/turnOffTwoStep.d.ts +0 -3
  324. package/rubjs/methods/settings/turnOffTwoStep.js +0 -18
  325. package/rubjs/methods/settings/updateProfile.d.ts +0 -3
  326. package/rubjs/methods/settings/updateProfile.js +0 -30
  327. package/rubjs/methods/settings/updateUsername.d.ts +0 -3
  328. package/rubjs/methods/settings/updateUsername.js +0 -17
  329. package/rubjs/methods/settings/verifyRecoveryEmail.d.ts +0 -3
  330. package/rubjs/methods/settings/verifyRecoveryEmail.js +0 -17
  331. package/rubjs/methods/stickers/actionOnStickerSet.d.ts +0 -3
  332. package/rubjs/methods/stickers/actionOnStickerSet.js +0 -19
  333. package/rubjs/methods/stickers/getMyStickerSets.d.ts +0 -3
  334. package/rubjs/methods/stickers/getMyStickerSets.js +0 -17
  335. package/rubjs/methods/stickers/getStickerSetByID.d.ts +0 -3
  336. package/rubjs/methods/stickers/getStickerSetByID.js +0 -17
  337. package/rubjs/methods/stickers/getStickersByEmoji.d.ts +0 -3
  338. package/rubjs/methods/stickers/getStickersByEmoji.js +0 -17
  339. package/rubjs/methods/stickers/getStickersBySetIds.d.ts +0 -3
  340. package/rubjs/methods/stickers/getStickersBySetIds.js +0 -19
  341. package/rubjs/methods/stickers/getTrendStickerSets.d.ts +0 -3
  342. package/rubjs/methods/stickers/getTrendStickerSets.js +0 -17
  343. package/rubjs/methods/stickers/index.d.ts +0 -8
  344. package/rubjs/methods/stickers/index.js +0 -20
  345. package/rubjs/methods/stickers/searchStickers.d.ts +0 -3
  346. package/rubjs/methods/stickers/searchStickers.js +0 -17
  347. package/rubjs/methods/users/checkUserUsername.d.ts +0 -3
  348. package/rubjs/methods/users/checkUserUsername.js +0 -17
  349. package/rubjs/methods/users/deleteUserChat.d.ts +0 -3
  350. package/rubjs/methods/users/deleteUserChat.js +0 -20
  351. package/rubjs/methods/users/getMe.d.ts +0 -3
  352. package/rubjs/methods/users/getMe.js +0 -17
  353. package/rubjs/methods/users/getUserInfo.d.ts +0 -4
  354. package/rubjs/methods/users/getUserInfo.js +0 -18
  355. package/rubjs/methods/users/index.d.ts +0 -6
  356. package/rubjs/methods/users/index.js +0 -16
  357. package/rubjs/methods/users/setBlockUser.d.ts +0 -3
  358. package/rubjs/methods/users/setBlockUser.js +0 -19
  359. package/rubjs/methods/utilities/download.d.ts +0 -3
  360. package/rubjs/methods/utilities/download.js +0 -17
  361. package/rubjs/methods/utilities/downloadProfilePicture.d.ts +0 -3
  362. package/rubjs/methods/utilities/downloadProfilePicture.js +0 -27
  363. package/rubjs/methods/utilities/index.d.ts +0 -6
  364. package/rubjs/methods/utilities/index.js +0 -16
  365. package/rubjs/methods/utilities/run.d.ts +0 -3
  366. package/rubjs/methods/utilities/run.js +0 -24
  367. package/rubjs/methods/utilities/start.d.ts +0 -3
  368. package/rubjs/methods/utilities/start.js +0 -70
  369. package/rubjs/methods/utilities/thumbnail.d.ts +0 -5
  370. package/rubjs/methods/utilities/thumbnail.js +0 -61
  371. package/rubjs/network/index.d.ts +0 -37
  372. package/rubjs/network/index.js +0 -284
  373. package/rubjs/parser/index.d.ts +0 -25
  374. package/rubjs/parser/index.js +0 -110
  375. package/rubjs/session/index.d.ts +0 -18
  376. package/rubjs/session/index.js +0 -57
  377. package/rubjs/types/auth.d.ts +0 -40
  378. package/rubjs/types/auth.js +0 -2
  379. package/rubjs/types/chats.d.ts +0 -79
  380. package/rubjs/types/chats.js +0 -2
  381. package/rubjs/types/decorators.d.ts +0 -168
  382. package/rubjs/types/decorators.js +0 -2
  383. package/rubjs/types/groups.d.ts +0 -129
  384. package/rubjs/types/groups.js +0 -2
  385. package/rubjs/types/index.d.ts +0 -8
  386. package/rubjs/types/index.js +0 -53
  387. package/rubjs/types/message.d.ts +0 -18
  388. package/rubjs/types/message.js +0 -31
  389. package/rubjs/types/messages.d.ts +0 -176
  390. package/rubjs/types/messages.js +0 -2
  391. package/rubjs/types/users.d.ts +0 -64
  392. package/rubjs/types/users.js +0 -2
  393. package/rubjs/utils/filters.d.ts +0 -29
  394. package/rubjs/utils/filters.js +0 -123
  395. package/rubjs/utils/index.d.ts +0 -3
  396. package/rubjs/utils/index.js +0 -10
  397. package/rubjs/utils/utils.d.ts +0 -10
  398. package/rubjs/utils/utils.js +0 -12
@@ -1,3 +0,0 @@
1
- import Client from '../..';
2
- declare function download(this: Client): Promise<any>;
3
- export default download;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- function download() {
13
- return __awaiter(this, void 0, void 0, function* () {
14
- return yield this.builder('download', {});
15
- });
16
- }
17
- exports.default = download;
@@ -1,3 +0,0 @@
1
- import Client from "../..";
2
- declare function downloadProfilePicture(this: Client, object_guid: string): Promise<Buffer | null>;
3
- export default downloadProfilePicture;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- function downloadProfilePicture(object_guid) {
13
- return __awaiter(this, void 0, void 0, function* () {
14
- let avatars = yield this.getAvatars(object_guid);
15
- if (avatars) {
16
- avatars = avatars.avatars[0].main;
17
- const url = `https://messenger${avatars.dc_id}.iranlms.ir/InternFile.ashx`;
18
- const response = yield this.network.session.get(url, {
19
- params: { id: avatars.file_id, ach: avatars.access_hash_rec },
20
- responseType: "arraybuffer",
21
- });
22
- if (response.status === 200)
23
- return yield response.data;
24
- }
25
- });
26
- }
27
- exports.default = downloadProfilePicture;
@@ -1,6 +0,0 @@
1
- import download from "./download";
2
- import downloadProfilePicture from "./downloadProfilePicture";
3
- import run from "./run";
4
- import start from "./start";
5
- import thumbnail from "./thumbnail";
6
- export { download, downloadProfilePicture, run, start, thumbnail };
@@ -1,16 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.thumbnail = exports.start = exports.run = exports.downloadProfilePicture = exports.download = void 0;
7
- const download_1 = __importDefault(require("./download"));
8
- exports.download = download_1.default;
9
- const downloadProfilePicture_1 = __importDefault(require("./downloadProfilePicture"));
10
- exports.downloadProfilePicture = downloadProfilePicture_1.default;
11
- const run_1 = __importDefault(require("./run"));
12
- exports.run = run_1.default;
13
- const start_1 = __importDefault(require("./start"));
14
- exports.start = start_1.default;
15
- const thumbnail_1 = __importDefault(require("./thumbnail"));
16
- exports.thumbnail = thumbnail_1.default;
@@ -1,3 +0,0 @@
1
- import Client from "../..";
2
- declare function run(this: Client): Promise<void>;
3
- export default run;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- function run() {
13
- return __awaiter(this, void 0, void 0, function* () {
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();
22
- });
23
- }
24
- exports.default = run;
@@ -1,3 +0,0 @@
1
- import Client from "../..";
2
- declare function start(this: Client): Promise<void>;
3
- export default start;
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const crypto_1 = __importDefault(require("../../crypto"));
16
- const input_1 = __importDefault(require("input"));
17
- function start() {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- try {
20
- this.key = Buffer.from(crypto_1.default.passphrase(this.auth), "utf8");
21
- this.decode_auth = crypto_1.default.decode_auth(this.auth);
22
- const result = yield this.getMe();
23
- this.userGuid = result.user.user_guid;
24
- this.initialize = true;
25
- }
26
- catch (error) {
27
- if (this.auth)
28
- throw new Error("robot has any error" + error.message);
29
- let phone_number = yield input_1.default.text("Phone Number: ");
30
- let is_phone_number_true = true;
31
- const phoneRegex = /^[0-9]{11}$/;
32
- while (is_phone_number_true) {
33
- const answer = yield input_1.default.text(`Is the ${phone_number} correct [y or n]: `);
34
- if (answer.toLowerCase() === "y" && phoneRegex.test(phone_number)) {
35
- is_phone_number_true = false;
36
- }
37
- else {
38
- phone_number = yield input_1.default.text("Phone Number ex -> (09123456789) : ");
39
- }
40
- }
41
- phone_number = `98${phone_number.slice(1)}`;
42
- let result = yield this.sendCode(phone_number);
43
- if (result.status == "SendPassKey") {
44
- while (true) {
45
- let pass_key = yield input_1.default.text(`Password [${result.hint_pass_key}] > `);
46
- result = yield this.sendCode((phone_number = phone_number), (pass_key = pass_key));
47
- if (result.status == "OK")
48
- break;
49
- }
50
- }
51
- let [publicKey, privateKey] = crypto_1.default.createKeys();
52
- this.privateKey = privateKey;
53
- while (true) {
54
- let phone_code = yield input_1.default.text("Code: ");
55
- let response = yield this.signIn(phone_code, phone_number, result.phone_code_hash, publicKey);
56
- if (response.status === "OK") {
57
- response.auth = crypto_1.default.decrypt_RSA_OAEP(this.privateKey, response.auth);
58
- this.key = Buffer.from(crypto_1.default.passphrase(response.auth), "utf8");
59
- this.auth = response.auth;
60
- this.decode_auth = crypto_1.default.decode_auth(this.auth);
61
- this.sessionDb.saveSession(response.user.phone, this.auth, response.user.user_guid, this.userAgent, this.privateKey);
62
- yield this.registerDevice();
63
- break;
64
- }
65
- }
66
- this.initialize = true;
67
- }
68
- });
69
- }
70
- exports.default = start;
@@ -1,5 +0,0 @@
1
- declare class ThumbnailGenerator {
2
- static fromVideo(videoPath: string): Promise<string>;
3
- static fromImage(imagePath: string, width?: number): Promise<string>;
4
- }
5
- export default ThumbnailGenerator;
@@ -1,61 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const fluent_ffmpeg_1 = __importDefault(require("fluent-ffmpeg"));
16
- const promises_1 = __importDefault(require("fs/promises"));
17
- const path_1 = __importDefault(require("path"));
18
- const os_1 = __importDefault(require("os"));
19
- const sharp_1 = __importDefault(require("sharp"));
20
- class ThumbnailGenerator {
21
- static fromVideo(videoPath) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const tempImagePath = path_1.default.join(os_1.default.tmpdir(), `thumbnail_${Date.now()}.png`);
24
- try {
25
- yield new Promise((resolve, reject) => {
26
- (0, fluent_ffmpeg_1.default)(videoPath)
27
- .on("end", () => resolve(undefined))
28
- .on("error", reject)
29
- .screenshots({
30
- count: 1,
31
- timemarks: ["00:00:00.000"],
32
- filename: path_1.default.basename(tempImagePath),
33
- folder: path_1.default.dirname(tempImagePath),
34
- size: "320x?",
35
- });
36
- });
37
- const thumbnailBuffer = yield promises_1.default.readFile(tempImagePath);
38
- const base64Thumbnail = thumbnailBuffer.toString("base64");
39
- yield promises_1.default.unlink(tempImagePath);
40
- return base64Thumbnail;
41
- }
42
- catch (error) {
43
- console.error("Error generating video thumbnail:", error);
44
- throw error;
45
- }
46
- });
47
- }
48
- static fromImage(imagePath_1) {
49
- return __awaiter(this, arguments, void 0, function* (imagePath, width = 320) {
50
- try {
51
- const buffer = yield (0, sharp_1.default)(imagePath).resize(width).toBuffer();
52
- return buffer.toString("base64");
53
- }
54
- catch (error) {
55
- console.error("Error generating image thumbnail:", error);
56
- throw error;
57
- }
58
- });
59
- }
60
- }
61
- exports.default = ThumbnailGenerator;
@@ -1,37 +0,0 @@
1
- import { Axios } from "axios";
2
- import WebSocket from "ws";
3
- import https from "https";
4
- import Client from "..";
5
- declare class Network {
6
- private heartbeatInterval;
7
- Headers: {
8
- [key: string]: string;
9
- };
10
- client: Client;
11
- session: Axios;
12
- apiUrl: null | string;
13
- wssUrl: null | string;
14
- ws: WebSocket;
15
- agent: https.Agent;
16
- constructor(client: Client);
17
- getDcs(): Promise<boolean>;
18
- request(url: string, data: Record<string, any>): Promise<any>;
19
- send({ input, method, tmp_session, }: {
20
- input: object;
21
- method: string;
22
- tmp_session: boolean;
23
- }): Promise<any>;
24
- getUpdates(): Promise<void>;
25
- handleConnect(): Promise<void>;
26
- resetConnection(): Promise<void>;
27
- handleMessage(message: string): Promise<void>;
28
- uploadFile(file: Buffer<ArrayBufferLike> | string, mime?: string | null, fileName?: string | null, chunk?: number, callback?: any): Promise<{
29
- mime: string;
30
- size: number;
31
- dc_id: string;
32
- file_id: string;
33
- file_name: string;
34
- access_hash_rec: string;
35
- }>;
36
- }
37
- export default Network;
@@ -1,284 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
- var __importDefault = (this && this.__importDefault) || function (mod) {
45
- return (mod && mod.__esModule) ? mod : { "default": mod };
46
- };
47
- Object.defineProperty(exports, "__esModule", { value: true });
48
- const axios_1 = __importDefault(require("axios"));
49
- const ws_1 = __importDefault(require("ws"));
50
- const crypto_1 = __importDefault(require("../crypto"));
51
- const https_1 = __importDefault(require("https"));
52
- const fs = __importStar(require("fs"));
53
- const path = __importStar(require("path"));
54
- const types_1 = require("../types");
55
- class Network {
56
- constructor(client) {
57
- this.heartbeatInterval = null;
58
- this.Headers = {
59
- origin: "https://web.rubika.ir",
60
- referer: "https://web.rubika.ir/",
61
- "content-type": "application/json",
62
- connection: "keep-alive",
63
- };
64
- this.client = client;
65
- this.Headers["user-agent"] = this.client.userAgent;
66
- if (this.client.defaultPlatform["platform"] === "Android") {
67
- delete this.Headers["origin"];
68
- delete this.Headers["referer"];
69
- this.Headers["user-agent"] = "okhttp/3.12.1";
70
- this.client.defaultPlatform["package"] = "app.rbmain.a";
71
- this.client.defaultPlatform["app_version"] = "3.6.4";
72
- }
73
- this.agent = new https_1.default.Agent({ rejectUnauthorized: false });
74
- const axiosConfig = {
75
- headers: this.Headers,
76
- timeout: this.client.timeout || 10000,
77
- httpsAgent: this.agent,
78
- };
79
- this.session = axios_1.default.create(axiosConfig);
80
- this.apiUrl = null;
81
- this.wssUrl = null;
82
- this.ws = null;
83
- }
84
- getDcs() {
85
- return __awaiter(this, void 0, void 0, function* () {
86
- while (true) {
87
- try {
88
- const response = yield axios_1.default.get("https://getdcmess.iranlms.ir/", {
89
- httpsAgent: this.agent,
90
- });
91
- if (response.status === 200) {
92
- const data = response.data.data;
93
- this.apiUrl = data.API[data.default_api] + "/";
94
- this.wssUrl = data.socket[data.default_socket];
95
- return true;
96
- }
97
- }
98
- catch (error) {
99
- console.error("Error while fetching dcs:", error);
100
- continue;
101
- }
102
- }
103
- });
104
- }
105
- request(url, data) {
106
- return __awaiter(this, void 0, void 0, function* () {
107
- for (let i = 0; i < 3; i++) {
108
- try {
109
- const response = yield this.session.post(url, data);
110
- if (response.status === 200) {
111
- return response.data;
112
- }
113
- }
114
- catch (error) {
115
- console.error("Error in request:", error);
116
- continue;
117
- }
118
- }
119
- throw new Error("Failed to get response after 3 attempts");
120
- });
121
- }
122
- send(_a) {
123
- return __awaiter(this, arguments, void 0, function* ({ input = {}, method = "getUserInfo", tmp_session, }) {
124
- let api_version = this.client.apiVersion;
125
- let auth = this.client.auth;
126
- let client = this.client.defaultPlatform;
127
- if (!this.apiUrl)
128
- yield this.getDcs();
129
- let url = this.apiUrl;
130
- let data = { api_version };
131
- data[tmp_session ? "tmp_session" : "auth"] = tmp_session
132
- ? auth
133
- : this.client.decode_auth;
134
- if (api_version === "6") {
135
- const data_enc = JSON.stringify({
136
- client,
137
- method,
138
- input,
139
- });
140
- data["data_enc"] = crypto_1.default.encrypt(data_enc, this.client.key);
141
- if (!tmp_session) {
142
- data["sign"] = crypto_1.default.sign(data["data_enc"], this.client.privateKey);
143
- }
144
- return yield this.request(url, data);
145
- }
146
- });
147
- }
148
- getUpdates() {
149
- return __awaiter(this, void 0, void 0, function* () {
150
- if (!this.wssUrl)
151
- yield this.getDcs();
152
- this.ws = new ws_1.default(this.wssUrl);
153
- this.ws.on("open", () => __awaiter(this, void 0, void 0, function* () { return yield this.handleConnect(); }));
154
- this.ws.on("message", (message) => __awaiter(this, void 0, void 0, function* () { return yield this.handleMessage(message); }));
155
- this.ws.on("error", () => __awaiter(this, void 0, void 0, function* () { return yield this.resetConnection(); }));
156
- });
157
- }
158
- handleConnect() {
159
- return __awaiter(this, void 0, void 0, function* () {
160
- console.log("Start Bot..");
161
- const handshakeRequest = {
162
- api_version: "5",
163
- auth: this.client.auth,
164
- data: "",
165
- method: "handShake",
166
- };
167
- this.ws.send(JSON.stringify(handshakeRequest));
168
- if (this.heartbeatInterval) {
169
- clearInterval(this.heartbeatInterval);
170
- }
171
- this.heartbeatInterval = setInterval(() => {
172
- if (this.ws.readyState === ws_1.default.OPEN) {
173
- this.ws.send(JSON.stringify({}));
174
- }
175
- }, 30 * 1000);
176
- });
177
- }
178
- resetConnection() {
179
- return __awaiter(this, void 0, void 0, function* () {
180
- setTimeout(() => this.getUpdates(), 5000);
181
- });
182
- }
183
- handleMessage(message) {
184
- return __awaiter(this, void 0, void 0, function* () {
185
- try {
186
- const { data_enc } = JSON.parse(message);
187
- if (!data_enc)
188
- return;
189
- const update = JSON.parse(crypto_1.default.decrypt(data_enc, this.client.key));
190
- this.client.eventHandlers.forEach((_a) => __awaiter(this, [_a], void 0, function* ({ callback, filters = [], updateType }) {
191
- var _b;
192
- const messageData = (_b = update[updateType]) === null || _b === void 0 ? void 0 : _b[0];
193
- if (!messageData)
194
- return;
195
- const isValid = filters.length === 0 ||
196
- filters.every((filter) => filter(messageData));
197
- const dataMessage = new types_1.Message(this.client, messageData);
198
- if (isValid) {
199
- yield callback(dataMessage);
200
- }
201
- }));
202
- }
203
- catch (error) {
204
- console.error("Error in handleMessage:", error);
205
- }
206
- });
207
- }
208
- uploadFile(file_1) {
209
- return __awaiter(this, arguments, void 0, function* (file, mime = null, fileName = null, chunk = 1048576, callback = null) {
210
- if (typeof file === "string") {
211
- if (!fs.existsSync(file))
212
- throw new Error("File not found in the given path");
213
- if (!fileName)
214
- fileName = path.basename(file);
215
- file = yield fs.promises.readFile(file);
216
- }
217
- else if (!Buffer.isBuffer(file))
218
- throw new TypeError("File argument must be a file path or bytes");
219
- if (!fileName)
220
- throw new Error("File name is not set");
221
- if (!mime)
222
- mime = fileName.split(".").pop() || "";
223
- let result = yield this.client.requestSendFile(fileName, file.length, mime);
224
- let response;
225
- let id = result.id;
226
- let index = 0;
227
- let dc_id = result.dc_id;
228
- let total = Math.ceil(file.length / chunk);
229
- let upload_url = result.upload_url;
230
- let access_hash_send = result.access_hash_send;
231
- while (index < total) {
232
- let data = file.slice(index * chunk, index * chunk + chunk);
233
- try {
234
- response = yield this.session.post(upload_url, data, {
235
- headers: {
236
- auth: this.client.auth,
237
- "file-id": id,
238
- "total-part": total.toString(),
239
- "part-number": (index + 1).toString(),
240
- "chunk-size": data.length.toString(),
241
- "access-hash-send": access_hash_send,
242
- },
243
- });
244
- if (response.data.status === "ERROR_TRY_AGAIN") {
245
- console.log("Retrying upload...");
246
- result = yield this.client.requestSendFile(fileName, file.length, mime);
247
- id = result.id;
248
- index = 0;
249
- dc_id = result.dc_id;
250
- total = Math.ceil(file.length / chunk);
251
- upload_url = result.upload_url;
252
- access_hash_send = result.access_hash_send;
253
- continue;
254
- }
255
- if (callback) {
256
- try {
257
- callback(file.length, index * chunk);
258
- }
259
- catch (err) {
260
- console.error("Callback error:", err);
261
- }
262
- }
263
- index++;
264
- }
265
- catch (error) {
266
- console.error("Upload error:", error);
267
- yield new Promise((resolve) => setTimeout(resolve, 5000));
268
- }
269
- if (response.data.status === "OK" && response.data.status_det === "OK") {
270
- return {
271
- mime,
272
- size: file.length,
273
- dc_id,
274
- file_id: id,
275
- file_name: fileName,
276
- access_hash_rec: response.data.data.access_hash_rec,
277
- };
278
- }
279
- throw new Error(response.data.status_det);
280
- }
281
- });
282
- }
283
- }
284
- exports.default = Network;
@@ -1,25 +0,0 @@
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;