rubjs 2.4.1 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/rubjs/client.d.ts +35 -0
- package/rubjs/client.js +48 -0
- package/rubjs/crypto/index.d.ts +12 -0
- package/rubjs/crypto/index.js +95 -0
- package/rubjs/index.d.ts +7 -0
- package/rubjs/index.js +51 -0
- package/rubjs/methods/advanced/builder.d.ts +3 -0
- package/rubjs/methods/advanced/builder.js +41 -0
- package/rubjs/methods/advanced/index.d.ts +2 -0
- package/rubjs/methods/advanced/index.js +8 -0
- package/rubjs/methods/auth/index.d.ts +5 -0
- package/rubjs/methods/auth/index.js +14 -0
- package/rubjs/methods/auth/logout.d.ts +3 -0
- package/rubjs/methods/auth/logout.js +17 -0
- package/rubjs/methods/auth/registerDevice.d.ts +3 -0
- package/rubjs/methods/auth/registerDevice.js +61 -0
- package/rubjs/methods/auth/sendCode.d.ts +3 -0
- package/rubjs/methods/auth/sendCode.js +25 -0
- package/rubjs/methods/auth/signIn.d.ts +3 -0
- package/rubjs/methods/auth/signIn.js +24 -0
- package/rubjs/methods/channels/addChannel.d.ts +3 -0
- package/rubjs/methods/channels/addChannel.js +26 -0
- package/rubjs/methods/channels/addChannelMembers.d.ts +3 -0
- package/rubjs/methods/channels/addChannelMembers.js +22 -0
- package/rubjs/methods/channels/banChannelMember.d.ts +3 -0
- package/rubjs/methods/channels/banChannelMember.js +23 -0
- package/rubjs/methods/channels/cancelChangeObjectOwner.d.ts +3 -0
- package/rubjs/methods/channels/cancelChangeObjectOwner.js +17 -0
- package/rubjs/methods/channels/channelPreviewByJoinLink.d.ts +3 -0
- package/rubjs/methods/channels/channelPreviewByJoinLink.js +19 -0
- package/rubjs/methods/channels/checkChannelUsername.d.ts +3 -0
- package/rubjs/methods/channels/checkChannelUsername.js +19 -0
- package/rubjs/methods/channels/createChannelVoiceChat.d.ts +3 -0
- package/rubjs/methods/channels/createChannelVoiceChat.js +17 -0
- package/rubjs/methods/channels/discardChannelVoiceChat.d.ts +3 -0
- package/rubjs/methods/channels/discardChannelVoiceChat.js +20 -0
- package/rubjs/methods/channels/editChannelInfo.d.ts +4 -0
- package/rubjs/methods/channels/editChannelInfo.js +48 -0
- package/rubjs/methods/channels/getBannedChannelMembers.d.ts +3 -0
- package/rubjs/methods/channels/getBannedChannelMembers.js +20 -0
- package/rubjs/methods/channels/getChannelAdminAccessList.d.ts +3 -0
- package/rubjs/methods/channels/getChannelAdminAccessList.js +20 -0
- package/rubjs/methods/channels/getChannelAdminMembers.d.ts +3 -0
- package/rubjs/methods/channels/getChannelAdminMembers.js +20 -0
- package/rubjs/methods/channels/getChannelAllMembers.d.ts +3 -0
- package/rubjs/methods/channels/getChannelAllMembers.js +21 -0
- package/rubjs/methods/channels/getChannelInfo.d.ts +3 -0
- package/rubjs/methods/channels/getChannelInfo.js +17 -0
- package/rubjs/methods/channels/getChannelLink.d.ts +3 -0
- package/rubjs/methods/channels/getChannelLink.js +17 -0
- package/rubjs/methods/channels/getPendingObjectOwner.d.ts +3 -0
- package/rubjs/methods/channels/getPendingObjectOwner.js +17 -0
- package/rubjs/methods/channels/index.d.ts +26 -0
- package/rubjs/methods/channels/index.js +56 -0
- package/rubjs/methods/channels/joinChannelAction.d.ts +3 -0
- package/rubjs/methods/channels/joinChannelAction.js +19 -0
- package/rubjs/methods/channels/joinChannelByLink.d.ts +3 -0
- package/rubjs/methods/channels/joinChannelByLink.js +19 -0
- package/rubjs/methods/channels/leaveChannelVoiceChat.d.ts +3 -0
- package/rubjs/methods/channels/leaveChannelVoiceChat.js +20 -0
- package/rubjs/methods/channels/removeChannel.d.ts +3 -0
- package/rubjs/methods/channels/removeChannel.js +17 -0
- package/rubjs/methods/channels/requestChangeObjectOwner.d.ts +3 -0
- package/rubjs/methods/channels/requestChangeObjectOwner.js +20 -0
- package/rubjs/methods/channels/seenChannelMessages.d.ts +3 -0
- package/rubjs/methods/channels/seenChannelMessages.js +21 -0
- package/rubjs/methods/channels/setChannelLink.d.ts +3 -0
- package/rubjs/methods/channels/setChannelLink.js +17 -0
- package/rubjs/methods/channels/setChannelVoiceChatSetting.d.ts +3 -0
- package/rubjs/methods/channels/setChannelVoiceChatSetting.js +26 -0
- package/rubjs/methods/channels/updateChannelUsername.d.ts +3 -0
- package/rubjs/methods/channels/updateChannelUsername.js +20 -0
- package/rubjs/methods/chats/actionOnJoinRequest.d.ts +3 -0
- package/rubjs/methods/chats/actionOnJoinRequest.js +22 -0
- package/rubjs/methods/chats/addLiveComment.d.ts +3 -0
- package/rubjs/methods/chats/addLiveComment.js +17 -0
- package/rubjs/methods/chats/clickMessageUrl.d.ts +3 -0
- package/rubjs/methods/chats/clickMessageUrl.js +17 -0
- package/rubjs/methods/chats/createJoinLink.d.ts +3 -0
- package/rubjs/methods/chats/createJoinLink.js +23 -0
- package/rubjs/methods/chats/deleteAvatar.d.ts +3 -0
- package/rubjs/methods/chats/deleteAvatar.js +17 -0
- package/rubjs/methods/chats/deleteChatHistory.d.ts +3 -0
- package/rubjs/methods/chats/deleteChatHistory.js +20 -0
- package/rubjs/methods/chats/editJoinLink.d.ts +3 -0
- package/rubjs/methods/chats/editJoinLink.js +34 -0
- package/rubjs/methods/chats/getAbsObjects.d.ts +3 -0
- package/rubjs/methods/chats/getAbsObjects.js +19 -0
- package/rubjs/methods/chats/getAvatars.d.ts +3 -0
- package/rubjs/methods/chats/getAvatars.js +17 -0
- package/rubjs/methods/chats/getChatReaction.d.ts +3 -0
- package/rubjs/methods/chats/getChatReaction.js +17 -0
- package/rubjs/methods/chats/getChats.d.ts +3 -0
- package/rubjs/methods/chats/getChats.js +17 -0
- package/rubjs/methods/chats/getChatsUpdates.d.ts +3 -0
- package/rubjs/methods/chats/getChatsUpdates.js +17 -0
- package/rubjs/methods/chats/getJoinLinks.d.ts +3 -0
- package/rubjs/methods/chats/getJoinLinks.js +17 -0
- package/rubjs/methods/chats/getJoinRequests.d.ts +3 -0
- package/rubjs/methods/chats/getJoinRequests.js +17 -0
- package/rubjs/methods/chats/getLinkFromAppUrl.d.ts +3 -0
- package/rubjs/methods/chats/getLinkFromAppUrl.js +17 -0
- package/rubjs/methods/chats/getLiveComments.d.ts +3 -0
- package/rubjs/methods/chats/getLiveComments.js +17 -0
- package/rubjs/methods/chats/getLivePlayUrl.d.ts +3 -0
- package/rubjs/methods/chats/getLivePlayUrl.js +17 -0
- package/rubjs/methods/chats/getLiveStatus.d.ts +3 -0
- package/rubjs/methods/chats/getLiveStatus.js +17 -0
- package/rubjs/methods/chats/getObjectInfoByUsername.d.ts +3 -0
- package/rubjs/methods/chats/getObjectInfoByUsername.js +19 -0
- package/rubjs/methods/chats/getTopChatUsers.d.ts +3 -0
- package/rubjs/methods/chats/getTopChatUsers.js +18 -0
- package/rubjs/methods/chats/index.d.ts +29 -0
- package/rubjs/methods/chats/index.js +62 -0
- package/rubjs/methods/chats/removeFromTopChatUsers.d.ts +3 -0
- package/rubjs/methods/chats/removeFromTopChatUsers.js +17 -0
- package/rubjs/methods/chats/removeJoinLink.d.ts +3 -0
- package/rubjs/methods/chats/removeJoinLink.js +19 -0
- package/rubjs/methods/chats/searchChatMessages.d.ts +3 -0
- package/rubjs/methods/chats/searchChatMessages.js +23 -0
- package/rubjs/methods/chats/searchGlobalMessages.d.ts +3 -0
- package/rubjs/methods/chats/searchGlobalMessages.js +17 -0
- package/rubjs/methods/chats/seenChats.d.ts +3 -0
- package/rubjs/methods/chats/seenChats.js +17 -0
- package/rubjs/methods/chats/sendChatActivity.d.ts +3 -0
- package/rubjs/methods/chats/sendChatActivity.js +19 -0
- package/rubjs/methods/chats/sendLive.d.ts +3 -0
- package/rubjs/methods/chats/sendLive.js +28 -0
- package/rubjs/methods/chats/setActionChat.d.ts +3 -0
- package/rubjs/methods/chats/setActionChat.js +19 -0
- package/rubjs/methods/chats/uploadAvatar.d.ts +3 -0
- package/rubjs/methods/chats/uploadAvatar.js +29 -0
- package/rubjs/methods/contacts/addAddressBook.d.ts +3 -0
- package/rubjs/methods/contacts/addAddressBook.js +17 -0
- package/rubjs/methods/contacts/deleteContact.d.ts +3 -0
- package/rubjs/methods/contacts/deleteContact.js +17 -0
- package/rubjs/methods/contacts/getContacts.d.ts +3 -0
- package/rubjs/methods/contacts/getContacts.js +17 -0
- package/rubjs/methods/contacts/getContactsLastOnline.d.ts +3 -0
- package/rubjs/methods/contacts/getContactsLastOnline.js +17 -0
- package/rubjs/methods/contacts/getContactsUpdates.d.ts +3 -0
- package/rubjs/methods/contacts/getContactsUpdates.js +17 -0
- package/rubjs/methods/contacts/index.d.ts +7 -0
- package/rubjs/methods/contacts/index.js +18 -0
- package/rubjs/methods/contacts/resetContacts.d.ts +3 -0
- package/rubjs/methods/contacts/resetContacts.js +18 -0
- package/rubjs/methods/extras/banMember.d.ts +3 -0
- package/rubjs/methods/extras/banMember.js +20 -0
- package/rubjs/methods/extras/getInfo.d.ts +3 -0
- package/rubjs/methods/extras/getInfo.js +26 -0
- package/rubjs/methods/extras/getObjectByUsername.d.ts +3 -0
- package/rubjs/methods/extras/getObjectByUsername.js +19 -0
- package/rubjs/methods/extras/getProfileLinkItems.d.ts +3 -0
- package/rubjs/methods/extras/getProfileLinkItems.js +17 -0
- package/rubjs/methods/extras/getRelatedObjects.d.ts +3 -0
- package/rubjs/methods/extras/getRelatedObjects.js +17 -0
- package/rubjs/methods/extras/getTranscription.d.ts +3 -0
- package/rubjs/methods/extras/getTranscription.js +20 -0
- package/rubjs/methods/extras/index.d.ts +13 -0
- package/rubjs/methods/extras/index.js +30 -0
- package/rubjs/methods/extras/join.d.ts +3 -0
- package/rubjs/methods/extras/join.js +22 -0
- package/rubjs/methods/extras/leaveChat.d.ts +3 -0
- package/rubjs/methods/extras/leaveChat.js +20 -0
- package/rubjs/methods/extras/reportObject.d.ts +14 -0
- package/rubjs/methods/extras/reportObject.js +32 -0
- package/rubjs/methods/extras/searchGlobalObjects.d.ts +3 -0
- package/rubjs/methods/extras/searchGlobalObjects.js +17 -0
- package/rubjs/methods/extras/transcribeVoice.d.ts +3 -0
- package/rubjs/methods/extras/transcribeVoice.js +17 -0
- package/rubjs/methods/extras/userIsAdmin.d.ts +3 -0
- package/rubjs/methods/extras/userIsAdmin.js +29 -0
- package/rubjs/methods/gif/addToMyGifSet.d.ts +3 -0
- package/rubjs/methods/gif/addToMyGifSet.js +17 -0
- package/rubjs/methods/gif/getMyGifSet.d.ts +3 -0
- package/rubjs/methods/gif/getMyGifSet.js +17 -0
- package/rubjs/methods/gif/index.d.ts +4 -0
- package/rubjs/methods/gif/index.js +12 -0
- package/rubjs/methods/gif/removeFromMyGifSet.d.ts +3 -0
- package/rubjs/methods/gif/removeFromMyGifSet.js +17 -0
- package/rubjs/methods/groups/addGroup.d.ts +3 -0
- package/rubjs/methods/groups/addGroup.js +19 -0
- package/rubjs/methods/groups/addGroupMembers.d.ts +3 -0
- package/rubjs/methods/groups/addGroupMembers.js +19 -0
- package/rubjs/methods/groups/banGroupMember.d.ts +3 -0
- package/rubjs/methods/groups/banGroupMember.js +23 -0
- package/rubjs/methods/groups/createGroupVoiceChat.d.ts +3 -0
- package/rubjs/methods/groups/createGroupVoiceChat.js +17 -0
- package/rubjs/methods/groups/deleteNoAccessGroupChat.d.ts +3 -0
- package/rubjs/methods/groups/deleteNoAccessGroupChat.js +17 -0
- package/rubjs/methods/groups/discardGroupVoiceChat.d.ts +3 -0
- package/rubjs/methods/groups/discardGroupVoiceChat.js +20 -0
- package/rubjs/methods/groups/editGroupInfo.d.ts +6 -0
- package/rubjs/methods/groups/editGroupInfo.js +51 -0
- package/rubjs/methods/groups/getBannedGroupMembers.d.ts +3 -0
- package/rubjs/methods/groups/getBannedGroupMembers.js +17 -0
- package/rubjs/methods/groups/getGroupAdminAccessList.d.ts +3 -0
- package/rubjs/methods/groups/getGroupAdminAccessList.js +20 -0
- package/rubjs/methods/groups/getGroupAdminMembers.d.ts +3 -0
- package/rubjs/methods/groups/getGroupAdminMembers.js +17 -0
- package/rubjs/methods/groups/getGroupAllMembers.d.ts +3 -0
- package/rubjs/methods/groups/getGroupAllMembers.js +21 -0
- package/rubjs/methods/groups/getGroupDefaultAccess.d.ts +3 -0
- package/rubjs/methods/groups/getGroupDefaultAccess.js +17 -0
- package/rubjs/methods/groups/getGroupInfo.d.ts +3 -0
- package/rubjs/methods/groups/getGroupInfo.js +17 -0
- package/rubjs/methods/groups/getGroupLink.d.ts +3 -0
- package/rubjs/methods/groups/getGroupLink.js +17 -0
- package/rubjs/methods/groups/getGroupMentionList.d.ts +3 -0
- package/rubjs/methods/groups/getGroupMentionList.js +20 -0
- package/rubjs/methods/groups/getGroupOnlineCount.d.ts +3 -0
- package/rubjs/methods/groups/getGroupOnlineCount.js +17 -0
- package/rubjs/methods/groups/getGroupVoiceChatUpdates.d.ts +3 -0
- package/rubjs/methods/groups/getGroupVoiceChatUpdates.js +21 -0
- package/rubjs/methods/groups/groupPreviewByJoinLink.d.ts +3 -0
- package/rubjs/methods/groups/groupPreviewByJoinLink.js +19 -0
- package/rubjs/methods/groups/index.d.ts +28 -0
- package/rubjs/methods/groups/index.js +60 -0
- package/rubjs/methods/groups/joinGroup.d.ts +3 -0
- package/rubjs/methods/groups/joinGroup.js +19 -0
- package/rubjs/methods/groups/leaveGroup.d.ts +3 -0
- package/rubjs/methods/groups/leaveGroup.js +17 -0
- package/rubjs/methods/groups/leaveGroupVoiceChat.d.ts +3 -0
- package/rubjs/methods/groups/leaveGroupVoiceChat.js +20 -0
- package/rubjs/methods/groups/removeGroup.d.ts +3 -0
- package/rubjs/methods/groups/removeGroup.js +17 -0
- package/rubjs/methods/groups/seenGroupMessages.d.ts +3 -0
- package/rubjs/methods/groups/seenGroupMessages.js +21 -0
- package/rubjs/methods/groups/setGroupAdmin.d.ts +5 -0
- package/rubjs/methods/groups/setGroupAdmin.js +26 -0
- package/rubjs/methods/groups/setGroupDefaultAccess.d.ts +4 -0
- package/rubjs/methods/groups/setGroupDefaultAccess.js +22 -0
- package/rubjs/methods/groups/setGroupLink.d.ts +3 -0
- package/rubjs/methods/groups/setGroupLink.js +17 -0
- package/rubjs/methods/groups/setGroupVoiceChatSetting.d.ts +3 -0
- package/rubjs/methods/groups/setGroupVoiceChatSetting.js +26 -0
- package/rubjs/methods/index.d.ts +195 -0
- package/rubjs/methods/index.js +929 -0
- package/rubjs/methods/messages/actionOnMessageReaction.d.ts +3 -0
- package/rubjs/methods/messages/actionOnMessageReaction.js +25 -0
- package/rubjs/methods/messages/createPoll.d.ts +3 -0
- package/rubjs/methods/messages/createPoll.js +35 -0
- package/rubjs/methods/messages/deleteMessages.d.ts +3 -0
- package/rubjs/methods/messages/deleteMessages.js +26 -0
- package/rubjs/methods/messages/editMessage.d.ts +3 -0
- package/rubjs/methods/messages/editMessage.js +23 -0
- package/rubjs/methods/messages/forwardMessages.d.ts +3 -0
- package/rubjs/methods/messages/forwardMessages.js +31 -0
- package/rubjs/methods/messages/getMessageShareUrl.d.ts +3 -0
- package/rubjs/methods/messages/getMessageShareUrl.js +17 -0
- package/rubjs/methods/messages/getMessages.d.ts +3 -0
- package/rubjs/methods/messages/getMessages.js +23 -0
- package/rubjs/methods/messages/getMessagesByID.d.ts +3 -0
- package/rubjs/methods/messages/getMessagesByID.js +22 -0
- package/rubjs/methods/messages/getMessagesInterval.d.ts +3 -0
- package/rubjs/methods/messages/getMessagesInterval.js +20 -0
- package/rubjs/methods/messages/getMessagesUpdates.d.ts +3 -0
- package/rubjs/methods/messages/getMessagesUpdates.js +17 -0
- package/rubjs/methods/messages/getPollOptionVoters.d.ts +3 -0
- package/rubjs/methods/messages/getPollOptionVoters.js +21 -0
- package/rubjs/methods/messages/getPollStatus.d.ts +3 -0
- package/rubjs/methods/messages/getPollStatus.js +17 -0
- package/rubjs/methods/messages/index.d.ts +26 -0
- package/rubjs/methods/messages/index.js +56 -0
- package/rubjs/methods/messages/requestSendFile.d.ts +4 -0
- package/rubjs/methods/messages/requestSendFile.js +22 -0
- package/rubjs/methods/messages/sendDocument.d.ts +3 -0
- package/rubjs/methods/messages/sendDocument.js +17 -0
- package/rubjs/methods/messages/sendGif.d.ts +3 -0
- package/rubjs/methods/messages/sendGif.js +17 -0
- package/rubjs/methods/messages/sendMessage.d.ts +3 -0
- package/rubjs/methods/messages/sendMessage.js +145 -0
- package/rubjs/methods/messages/sendMusic.d.ts +3 -0
- package/rubjs/methods/messages/sendMusic.js +17 -0
- package/rubjs/methods/messages/sendPhoto.d.ts +3 -0
- package/rubjs/methods/messages/sendPhoto.js +17 -0
- package/rubjs/methods/messages/sendSticker.d.ts +3 -0
- package/rubjs/methods/messages/sendSticker.js +17 -0
- package/rubjs/methods/messages/sendText.d.ts +3 -0
- package/rubjs/methods/messages/sendText.js +17 -0
- package/rubjs/methods/messages/sendVideo.d.ts +3 -0
- package/rubjs/methods/messages/sendVideo.js +17 -0
- package/rubjs/methods/messages/sendVideoMessage.d.ts +3 -0
- package/rubjs/methods/messages/sendVideoMessage.js +17 -0
- package/rubjs/methods/messages/sendVoice.d.ts +3 -0
- package/rubjs/methods/messages/sendVoice.js +17 -0
- package/rubjs/methods/messages/setPinMessage.d.ts +3 -0
- package/rubjs/methods/messages/setPinMessage.js +23 -0
- package/rubjs/methods/messages/votePoll.d.ts +3 -0
- package/rubjs/methods/messages/votePoll.js +17 -0
- package/rubjs/methods/settings/changePassword.d.ts +3 -0
- package/rubjs/methods/settings/changePassword.js +17 -0
- package/rubjs/methods/settings/checkTwoStepPasscode.d.ts +3 -0
- package/rubjs/methods/settings/checkTwoStepPasscode.js +17 -0
- package/rubjs/methods/settings/deleteFolder.d.ts +3 -0
- package/rubjs/methods/settings/deleteFolder.js +17 -0
- package/rubjs/methods/settings/getBlockedUsers.d.ts +3 -0
- package/rubjs/methods/settings/getBlockedUsers.js +17 -0
- package/rubjs/methods/settings/getFolders.d.ts +3 -0
- package/rubjs/methods/settings/getFolders.js +17 -0
- package/rubjs/methods/settings/getMySessions.d.ts +3 -0
- package/rubjs/methods/settings/getMySessions.js +17 -0
- package/rubjs/methods/settings/getPrivacySetting.d.ts +3 -0
- package/rubjs/methods/settings/getPrivacySetting.js +17 -0
- package/rubjs/methods/settings/getSuggestedFolders.d.ts +3 -0
- package/rubjs/methods/settings/getSuggestedFolders.js +17 -0
- package/rubjs/methods/settings/getTwoPasscodeStatus.d.ts +3 -0
- package/rubjs/methods/settings/getTwoPasscodeStatus.js +17 -0
- package/rubjs/methods/settings/index.d.ts +19 -0
- package/rubjs/methods/settings/index.js +42 -0
- package/rubjs/methods/settings/requestRecoveryEmail.d.ts +3 -0
- package/rubjs/methods/settings/requestRecoveryEmail.js +20 -0
- package/rubjs/methods/settings/setSetting.d.ts +5 -0
- package/rubjs/methods/settings/setSetting.js +50 -0
- package/rubjs/methods/settings/setupTwoStepVerification.d.ts +3 -0
- package/rubjs/methods/settings/setupTwoStepVerification.js +21 -0
- package/rubjs/methods/settings/terminateOtherSessions.d.ts +3 -0
- package/rubjs/methods/settings/terminateOtherSessions.js +18 -0
- package/rubjs/methods/settings/terminateSession.d.ts +3 -0
- package/rubjs/methods/settings/terminateSession.js +17 -0
- package/rubjs/methods/settings/turnOffTwoStep.d.ts +3 -0
- package/rubjs/methods/settings/turnOffTwoStep.js +18 -0
- package/rubjs/methods/settings/updateProfile.d.ts +3 -0
- package/rubjs/methods/settings/updateProfile.js +30 -0
- package/rubjs/methods/settings/updateUsername.d.ts +3 -0
- package/rubjs/methods/settings/updateUsername.js +17 -0
- package/rubjs/methods/settings/verifyRecoveryEmail.d.ts +3 -0
- package/rubjs/methods/settings/verifyRecoveryEmail.js +17 -0
- package/rubjs/methods/stickers/actionOnStickerSet.d.ts +3 -0
- package/rubjs/methods/stickers/actionOnStickerSet.js +19 -0
- package/rubjs/methods/stickers/getMyStickerSets.d.ts +3 -0
- package/rubjs/methods/stickers/getMyStickerSets.js +17 -0
- package/rubjs/methods/stickers/getStickerSetByID.d.ts +3 -0
- package/rubjs/methods/stickers/getStickerSetByID.js +17 -0
- package/rubjs/methods/stickers/getStickersByEmoji.d.ts +3 -0
- package/rubjs/methods/stickers/getStickersByEmoji.js +17 -0
- package/rubjs/methods/stickers/getStickersBySetIds.d.ts +3 -0
- package/rubjs/methods/stickers/getStickersBySetIds.js +19 -0
- package/rubjs/methods/stickers/getTrendStickerSets.d.ts +3 -0
- package/rubjs/methods/stickers/getTrendStickerSets.js +17 -0
- package/rubjs/methods/stickers/index.d.ts +8 -0
- package/rubjs/methods/stickers/index.js +20 -0
- package/rubjs/methods/stickers/searchStickers.d.ts +3 -0
- package/rubjs/methods/stickers/searchStickers.js +17 -0
- package/rubjs/methods/users/checkUserUsername.d.ts +3 -0
- package/rubjs/methods/users/checkUserUsername.js +17 -0
- package/rubjs/methods/users/deleteUserChat.d.ts +3 -0
- package/rubjs/methods/users/deleteUserChat.js +20 -0
- package/rubjs/methods/users/getMe.d.ts +3 -0
- package/rubjs/methods/users/getMe.js +17 -0
- package/rubjs/methods/users/getUserInfo.d.ts +4 -0
- package/rubjs/methods/users/getUserInfo.js +18 -0
- package/rubjs/methods/users/index.d.ts +6 -0
- package/rubjs/methods/users/index.js +16 -0
- package/rubjs/methods/users/setBlockUser.d.ts +3 -0
- package/rubjs/methods/users/setBlockUser.js +19 -0
- package/rubjs/methods/utilities/download.d.ts +4 -0
- package/rubjs/methods/utilities/download.js +17 -0
- package/rubjs/methods/utilities/downloadProfilePicture.d.ts +3 -0
- package/rubjs/methods/utilities/downloadProfilePicture.js +27 -0
- package/rubjs/methods/utilities/get.d.ts +4 -0
- package/rubjs/methods/utilities/get.js +21 -0
- package/rubjs/methods/utilities/index.d.ts +8 -0
- package/rubjs/methods/utilities/index.js +20 -0
- package/rubjs/methods/utilities/post.d.ts +4 -0
- package/rubjs/methods/utilities/post.js +21 -0
- package/rubjs/methods/utilities/run.d.ts +3 -0
- package/rubjs/methods/utilities/run.js +24 -0
- package/rubjs/methods/utilities/start.d.ts +3 -0
- package/rubjs/methods/utilities/start.js +70 -0
- package/rubjs/methods/utilities/thumbnail.d.ts +6 -0
- package/rubjs/methods/utilities/thumbnail.js +75 -0
- package/rubjs/network/index.d.ts +38 -0
- package/rubjs/network/index.js +338 -0
- package/rubjs/parser/index.d.ts +25 -0
- package/rubjs/parser/index.js +112 -0
- package/rubjs/session/index.d.ts +18 -0
- package/rubjs/session/index.js +57 -0
- package/rubjs/types/auth.d.ts +40 -0
- package/rubjs/types/auth.js +2 -0
- package/rubjs/types/chats.d.ts +79 -0
- package/rubjs/types/chats.js +2 -0
- package/rubjs/types/decorators.d.ts +168 -0
- package/rubjs/types/decorators.js +2 -0
- package/rubjs/types/groups.d.ts +129 -0
- package/rubjs/types/groups.js +2 -0
- package/rubjs/types/index.d.ts +8 -0
- package/rubjs/types/index.js +53 -0
- package/rubjs/types/message.d.ts +25 -0
- package/rubjs/types/message.js +61 -0
- package/rubjs/types/messages.d.ts +176 -0
- package/rubjs/types/messages.js +2 -0
- package/rubjs/types/users.d.ts +64 -0
- package/rubjs/types/users.js +2 -0
- package/rubjs/utils/filters.d.ts +29 -0
- package/rubjs/utils/filters.js +123 -0
- package/rubjs/utils/index.d.ts +3 -0
- package/rubjs/utils/index.js +10 -0
- package/rubjs/utils/utils.d.ts +10 -0
- package/rubjs/utils/utils.js +12 -0
@@ -0,0 +1,338 @@
|
|
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
|
+
}
|
71
|
+
this.agent = new https_1.default.Agent({ rejectUnauthorized: false });
|
72
|
+
const axiosConfig = {
|
73
|
+
headers: this.Headers,
|
74
|
+
timeout: this.client.timeout || 10000,
|
75
|
+
httpsAgent: this.agent,
|
76
|
+
};
|
77
|
+
this.session = axios_1.default.create(axiosConfig);
|
78
|
+
this.apiUrl = null;
|
79
|
+
this.wssUrl = null;
|
80
|
+
this.ws = null;
|
81
|
+
}
|
82
|
+
getDcs() {
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
84
|
+
while (true) {
|
85
|
+
try {
|
86
|
+
const response = yield axios_1.default.get("https://getdcmess.iranlms.ir/", {
|
87
|
+
httpsAgent: this.agent,
|
88
|
+
});
|
89
|
+
if (response.status === 200) {
|
90
|
+
const data = response.data.data;
|
91
|
+
this.apiUrl = data.API[data.default_api] + "/";
|
92
|
+
this.wssUrl = data.socket[data.default_socket];
|
93
|
+
return true;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
catch (_a) {
|
97
|
+
console.error("Error while fetching dcs");
|
98
|
+
continue;
|
99
|
+
}
|
100
|
+
}
|
101
|
+
});
|
102
|
+
}
|
103
|
+
request(url, data) {
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
105
|
+
for (let i = 0; i < 3; i++) {
|
106
|
+
try {
|
107
|
+
const response = yield this.session.post(url, data);
|
108
|
+
if (response.status === 200) {
|
109
|
+
return response.data;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
catch (error) {
|
113
|
+
console.error("Error in request ");
|
114
|
+
continue;
|
115
|
+
}
|
116
|
+
}
|
117
|
+
throw new Error("Failed to get response after 3 attempts");
|
118
|
+
});
|
119
|
+
}
|
120
|
+
send(_a) {
|
121
|
+
return __awaiter(this, arguments, void 0, function* ({ input = {}, method = "getUserInfo", tmp_session, }) {
|
122
|
+
let api_version = this.client.apiVersion;
|
123
|
+
let auth = this.client.auth;
|
124
|
+
let client = this.client.defaultPlatform;
|
125
|
+
if (!this.apiUrl)
|
126
|
+
yield this.getDcs();
|
127
|
+
let url = this.apiUrl;
|
128
|
+
let data = { api_version };
|
129
|
+
data[tmp_session ? "tmp_session" : "auth"] = tmp_session
|
130
|
+
? auth
|
131
|
+
: this.client.decode_auth;
|
132
|
+
if (api_version === "6") {
|
133
|
+
const data_enc = JSON.stringify({
|
134
|
+
client,
|
135
|
+
method,
|
136
|
+
input,
|
137
|
+
});
|
138
|
+
data["data_enc"] = crypto_1.default.encrypt(data_enc, this.client.key);
|
139
|
+
if (!tmp_session) {
|
140
|
+
data["sign"] = crypto_1.default.sign(data["data_enc"], this.client.privateKey);
|
141
|
+
}
|
142
|
+
return yield this.request(url, data);
|
143
|
+
}
|
144
|
+
});
|
145
|
+
}
|
146
|
+
getUpdates() {
|
147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
148
|
+
if (!this.wssUrl)
|
149
|
+
yield this.getDcs();
|
150
|
+
this.ws = new ws_1.default(this.wssUrl);
|
151
|
+
this.ws.on("open", () => __awaiter(this, void 0, void 0, function* () { return yield this.handleConnect(); }));
|
152
|
+
this.ws.on("message", (message) => __awaiter(this, void 0, void 0, function* () { return yield this.handleMessage(message); }));
|
153
|
+
this.ws.on("error", () => __awaiter(this, void 0, void 0, function* () { return yield this.resetConnection(); }));
|
154
|
+
});
|
155
|
+
}
|
156
|
+
handleConnect() {
|
157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
158
|
+
console.log("Start Bot..");
|
159
|
+
const handshakeRequest = {
|
160
|
+
api_version: "5",
|
161
|
+
auth: this.client.auth,
|
162
|
+
data: "",
|
163
|
+
method: "handShake",
|
164
|
+
};
|
165
|
+
this.ws.send(JSON.stringify(handshakeRequest));
|
166
|
+
if (this.heartbeatInterval) {
|
167
|
+
clearInterval(this.heartbeatInterval);
|
168
|
+
}
|
169
|
+
this.heartbeatInterval = setInterval(() => {
|
170
|
+
if (this.ws.readyState === ws_1.default.OPEN) {
|
171
|
+
this.ws.send(JSON.stringify({}));
|
172
|
+
}
|
173
|
+
}, 30 * 1000);
|
174
|
+
});
|
175
|
+
}
|
176
|
+
resetConnection() {
|
177
|
+
return __awaiter(this, void 0, void 0, function* () {
|
178
|
+
setTimeout(() => this.getUpdates(), 5000);
|
179
|
+
});
|
180
|
+
}
|
181
|
+
handleMessage(message) {
|
182
|
+
return __awaiter(this, void 0, void 0, function* () {
|
183
|
+
try {
|
184
|
+
const { data_enc } = JSON.parse(message);
|
185
|
+
if (!data_enc)
|
186
|
+
return;
|
187
|
+
const update = JSON.parse(crypto_1.default.decrypt(data_enc, this.client.key));
|
188
|
+
this.client.eventHandlers.forEach((_a) => __awaiter(this, [_a], void 0, function* ({ callback, filters = [], updateType }) {
|
189
|
+
var _b;
|
190
|
+
const messageData = (_b = update[updateType]) === null || _b === void 0 ? void 0 : _b[0];
|
191
|
+
if (!messageData)
|
192
|
+
return;
|
193
|
+
const isValid = filters.length === 0 ||
|
194
|
+
filters.every((filter) => filter(messageData));
|
195
|
+
const dataMessage = new types_1.Message(this.client, messageData);
|
196
|
+
if (isValid) {
|
197
|
+
yield callback(dataMessage);
|
198
|
+
}
|
199
|
+
}));
|
200
|
+
}
|
201
|
+
catch (error) {
|
202
|
+
console.error("Error in handleMessage:", error);
|
203
|
+
}
|
204
|
+
});
|
205
|
+
}
|
206
|
+
uploadFile(file_1) {
|
207
|
+
return __awaiter(this, arguments, void 0, function* (file, mime = null, fileName = null, chunk = 1048576, callback = null) {
|
208
|
+
var _a;
|
209
|
+
if (typeof file === "string") {
|
210
|
+
if (!fs.existsSync(file))
|
211
|
+
throw new Error("File not found in the given path");
|
212
|
+
if (!fileName)
|
213
|
+
fileName = path.basename(file);
|
214
|
+
file = yield fs.promises.readFile(file);
|
215
|
+
}
|
216
|
+
else if (!Buffer.isBuffer(file))
|
217
|
+
throw new TypeError("File argument must be a file path or bytes");
|
218
|
+
if (!fileName)
|
219
|
+
throw new Error("File name is not set");
|
220
|
+
if (!mime)
|
221
|
+
mime = fileName.split(".").pop() || "application/octet-stream";
|
222
|
+
let result = yield this.client.requestSendFile(fileName, file.length, mime);
|
223
|
+
let response;
|
224
|
+
let id = result.id;
|
225
|
+
let index = 0;
|
226
|
+
let dc_id = result.dc_id;
|
227
|
+
let total = Math.ceil(file.length / chunk);
|
228
|
+
let upload_url = result.upload_url;
|
229
|
+
let access_hash_send = result.access_hash_send;
|
230
|
+
while (index < total) {
|
231
|
+
let data = file.slice(index * chunk, index * chunk + chunk);
|
232
|
+
try {
|
233
|
+
response = yield this.session.post(upload_url, data, {
|
234
|
+
headers: {
|
235
|
+
auth: this.client.auth,
|
236
|
+
"file-id": id,
|
237
|
+
"total-part": total.toString(),
|
238
|
+
"part-number": (index + 1).toString(),
|
239
|
+
"chunk-size": data.length.toString(),
|
240
|
+
"access-hash-send": access_hash_send,
|
241
|
+
},
|
242
|
+
});
|
243
|
+
if (response.data.status === "ERROR_TRY_AGAIN") {
|
244
|
+
console.log("Retrying upload...");
|
245
|
+
result = yield this.client.requestSendFile(fileName, file.length, mime);
|
246
|
+
id = result.id;
|
247
|
+
index = 0;
|
248
|
+
dc_id = result.dc_id;
|
249
|
+
total = Math.ceil(file.length / chunk);
|
250
|
+
upload_url = result.upload_url;
|
251
|
+
access_hash_send = result.access_hash_send;
|
252
|
+
continue;
|
253
|
+
}
|
254
|
+
if (callback) {
|
255
|
+
try {
|
256
|
+
callback(file.length, index * chunk);
|
257
|
+
}
|
258
|
+
catch (err) {
|
259
|
+
console.error("Callback error:", err);
|
260
|
+
}
|
261
|
+
}
|
262
|
+
index++;
|
263
|
+
}
|
264
|
+
catch (error) {
|
265
|
+
console.error("Upload error:", error);
|
266
|
+
yield new Promise((resolve) => setTimeout(resolve, 5000));
|
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!!");
|
271
|
+
return {
|
272
|
+
mime,
|
273
|
+
size: file.length,
|
274
|
+
dc_id,
|
275
|
+
file_id: id,
|
276
|
+
file_name: fileName,
|
277
|
+
access_hash_rec: response.data.data.access_hash_rec,
|
278
|
+
};
|
279
|
+
}
|
280
|
+
throw new Error(response.data.status_det);
|
281
|
+
}
|
282
|
+
});
|
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
|
+
}
|
337
|
+
}
|
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;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
interface SessionData {
|
2
|
+
phone: string;
|
3
|
+
auth: string;
|
4
|
+
guid: string;
|
5
|
+
agent: string;
|
6
|
+
private_key: string;
|
7
|
+
}
|
8
|
+
declare class SQLiteSession {
|
9
|
+
private dbFile;
|
10
|
+
private db;
|
11
|
+
constructor(sessionName: string);
|
12
|
+
private handleError;
|
13
|
+
private initializeDB;
|
14
|
+
getSession(): SessionData | null;
|
15
|
+
saveSession(phone: string, auth: string, guid: string, agent: string, privateKey: string): void;
|
16
|
+
closeDB(): void;
|
17
|
+
}
|
18
|
+
export default SQLiteSession;
|
@@ -0,0 +1,57 @@
|
|
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
|
+
const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
|
7
|
+
class SQLiteSession {
|
8
|
+
constructor(sessionName) {
|
9
|
+
this.dbFile = sessionName.endsWith(".rp") ? sessionName : `${sessionName}.rp`;
|
10
|
+
this.db = new better_sqlite3_1.default(this.dbFile);
|
11
|
+
this.initializeDB();
|
12
|
+
}
|
13
|
+
handleError(operation, callback) {
|
14
|
+
try {
|
15
|
+
return callback();
|
16
|
+
}
|
17
|
+
catch (error) {
|
18
|
+
console.error(`Error in ${operation}:`, error);
|
19
|
+
throw new Error(`Failed to execute ${operation}`);
|
20
|
+
}
|
21
|
+
}
|
22
|
+
initializeDB() {
|
23
|
+
this.handleError("initializeDB", () => {
|
24
|
+
this.db.pragma("journal_mode = DELETE");
|
25
|
+
const sessionTable = this.db
|
26
|
+
.prepare("SELECT name FROM sqlite_master WHERE type=? AND name=?")
|
27
|
+
.get("table", "session");
|
28
|
+
if (!sessionTable) {
|
29
|
+
this.db.prepare(`CREATE TABLE session (
|
30
|
+
phone TEXT PRIMARY KEY,
|
31
|
+
auth TEXT,
|
32
|
+
guid TEXT,
|
33
|
+
agent TEXT,
|
34
|
+
private_key TEXT
|
35
|
+
)`).run();
|
36
|
+
}
|
37
|
+
});
|
38
|
+
}
|
39
|
+
getSession() {
|
40
|
+
return this.handleError("getSession", () => {
|
41
|
+
const result = this.db.prepare("SELECT * FROM session").get();
|
42
|
+
return result ? result : null;
|
43
|
+
});
|
44
|
+
}
|
45
|
+
saveSession(phone, auth, guid, agent, privateKey) {
|
46
|
+
this.handleError("saveSession", () => {
|
47
|
+
this.db.prepare(`INSERT OR REPLACE INTO session (phone, auth, guid, agent, private_key)
|
48
|
+
VALUES (?, ?, ?, ?, ?)`).run(phone, auth, guid, agent, privateKey);
|
49
|
+
});
|
50
|
+
}
|
51
|
+
closeDB() {
|
52
|
+
this.handleError("closeDB", () => {
|
53
|
+
this.db.close();
|
54
|
+
});
|
55
|
+
}
|
56
|
+
}
|
57
|
+
exports.default = SQLiteSession;
|
@@ -0,0 +1,40 @@
|
|
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
|
+
}
|
10
|
+
interface AvatarThumbnail {
|
11
|
+
file_id: string;
|
12
|
+
mime: string;
|
13
|
+
dc_id: string;
|
14
|
+
access_hash_rec: string;
|
15
|
+
}
|
16
|
+
interface OnlineTime {
|
17
|
+
type: string;
|
18
|
+
exact_time: number;
|
19
|
+
}
|
20
|
+
interface User {
|
21
|
+
user_guid: string;
|
22
|
+
first_name: string;
|
23
|
+
last_name: string;
|
24
|
+
phone: string;
|
25
|
+
username: string;
|
26
|
+
avatar_thumbnail: AvatarThumbnail;
|
27
|
+
last_online: number;
|
28
|
+
bio: string | boolean;
|
29
|
+
is_deleted: boolean;
|
30
|
+
is_verified: boolean;
|
31
|
+
online_time: OnlineTime;
|
32
|
+
}
|
33
|
+
interface SignIn {
|
34
|
+
status: string;
|
35
|
+
auth: string;
|
36
|
+
user: User;
|
37
|
+
timestamp: number;
|
38
|
+
}
|
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 };
|