rubjs 3.0.0 → 3.1.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.
- package/README.md +32 -11
- package/lib/clients/VoiceChatClient.d.ts +4 -3
- package/lib/clients/VoiceChatClient.js +60 -92
- package/lib/clients/loginClient.d.ts +1 -1
- package/lib/clients/loginClient.js +4 -4
- package/lib/{core → clients}/network_login.js +1 -1
- package/lib/core/bot/bot.d.ts +25 -0
- package/lib/core/bot/bot.js +57 -0
- package/lib/core/bot/contexts/inline.context.d.ts +16 -0
- package/lib/core/bot/contexts/inline.context.js +27 -0
- package/lib/core/bot/contexts/message.context.d.ts +17 -0
- package/lib/core/bot/contexts/message.context.js +39 -0
- package/lib/core/bot/filters.d.ts +14 -0
- package/lib/core/bot/filters.js +45 -0
- package/lib/core/bot/methods/advanced/builder.d.ts +3 -0
- package/lib/core/bot/methods/advanced/builder.js +15 -0
- package/lib/core/bot/methods/bot/getMe.d.ts +3 -0
- package/lib/core/bot/methods/bot/getMe.js +6 -0
- package/lib/core/bot/methods/bot/index.d.ts +2 -0
- package/lib/core/bot/methods/bot/index.js +8 -0
- package/lib/core/bot/methods/chat/getChat.d.ts +3 -0
- package/lib/core/bot/methods/chat/getChat.js +6 -0
- package/lib/core/bot/methods/chat/index.d.ts +2 -0
- package/lib/core/bot/methods/chat/index.js +8 -0
- package/lib/core/bot/methods/files/getFile.d.ts +3 -0
- package/lib/core/bot/methods/files/getFile.js +6 -0
- package/lib/core/bot/methods/files/index.d.ts +4 -0
- package/lib/core/bot/methods/files/index.js +12 -0
- package/lib/core/bot/methods/files/requestSendFile.d.ts +4 -0
- package/lib/core/bot/methods/files/requestSendFile.js +6 -0
- package/lib/core/bot/methods/files/uploadFile.d.ts +3 -0
- package/lib/core/bot/methods/files/uploadFile.js +32 -0
- package/lib/core/bot/methods/index.d.ts +34 -0
- package/lib/core/bot/methods/index.js +116 -0
- package/lib/core/bot/methods/messages/deleteMessage.d.ts +3 -0
- package/lib/core/bot/methods/messages/deleteMessage.js +9 -0
- package/lib/core/bot/methods/messages/editChatKeypad.d.ts +4 -0
- package/lib/core/bot/methods/messages/editChatKeypad.js +14 -0
- package/lib/core/bot/methods/messages/editMessageKeypad.d.ts +4 -0
- package/lib/core/bot/methods/messages/editMessageKeypad.js +11 -0
- package/lib/core/bot/methods/messages/editMessageText.d.ts +3 -0
- package/lib/core/bot/methods/messages/editMessageText.js +10 -0
- package/lib/core/bot/methods/messages/forwardMessage.d.ts +3 -0
- package/lib/core/bot/methods/messages/forwardMessage.js +11 -0
- package/lib/core/bot/methods/messages/index.d.ts +10 -0
- package/lib/core/bot/methods/messages/index.js +24 -0
- package/lib/core/bot/methods/messages/sendContact.d.ts +4 -0
- package/lib/core/bot/methods/messages/sendContact.js +24 -0
- package/lib/core/bot/methods/messages/sendLocation.d.ts +4 -0
- package/lib/core/bot/methods/messages/sendLocation.js +23 -0
- package/lib/core/bot/methods/messages/sendMessage.d.ts +4 -0
- package/lib/core/bot/methods/messages/sendMessage.js +22 -0
- package/lib/core/bot/methods/messages/sendPoll.d.ts +3 -0
- package/lib/core/bot/methods/messages/sendPoll.js +6 -0
- package/lib/core/bot/methods/settings/index.d.ts +3 -0
- package/lib/core/bot/methods/settings/index.js +10 -0
- package/lib/core/bot/methods/settings/setCommands.d.ts +4 -0
- package/lib/core/bot/methods/settings/setCommands.js +6 -0
- package/lib/core/bot/methods/settings/updateBotEndpoints.d.ts +4 -0
- package/lib/core/bot/methods/settings/updateBotEndpoints.js +9 -0
- package/lib/core/bot/methods/utilities/getUpdates.d.ts +3 -0
- package/lib/core/bot/methods/utilities/getUpdates.js +6 -0
- package/lib/core/bot/methods/utilities/handleUpdates.d.ts +4 -0
- package/lib/core/bot/methods/utilities/handleUpdates.js +41 -0
- package/lib/core/bot/methods/utilities/index.d.ts +5 -0
- package/lib/core/bot/methods/utilities/index.js +14 -0
- package/lib/core/bot/methods/utilities/run.d.ts +4 -0
- package/lib/core/bot/methods/utilities/run.js +13 -0
- package/lib/core/bot/methods/utilities/start.d.ts +3 -0
- package/lib/core/bot/methods/utilities/start.js +27 -0
- package/lib/core/bot/methods/utilities/webhook.d.ts +4 -0
- package/lib/core/bot/methods/utilities/webhook.js +57 -0
- package/lib/core/bot/network/index.d.ts +9 -0
- package/lib/core/bot/network/index.js +48 -0
- package/lib/core/bot/network/polling.d.ts +0 -0
- package/lib/core/bot/network/polling.js +44 -0
- package/lib/core/bot/types/bot.type.d.ts +26 -0
- package/lib/core/bot/types/models.d.ts +303 -0
- package/lib/core/bot/types/models.js +131 -0
- package/lib/core/client/client.d.ts +29 -0
- package/lib/core/client/client.js +65 -0
- package/lib/{types → core/client/contexts}/activities.type.d.ts +2 -2
- package/lib/{types → core/client/contexts}/chat.type.d.ts +2 -2
- package/lib/core/client/contexts/contextConstructors.d.ts +10 -0
- package/lib/core/client/contexts/contextConstructors.js +16 -0
- package/lib/core/client/contexts/index.d.ts +5 -0
- package/lib/core/client/contexts/index.js +14 -0
- package/lib/{types → core/client/contexts}/message.type.d.ts +2 -2
- package/lib/{types → core/client/contexts}/notifications.type.d.ts +2 -2
- package/lib/core/{filters.d.ts → client/filters.d.ts} +3 -3
- package/lib/core/{filters.js → client/filters.js} +27 -27
- package/lib/core/client/methods/advanced/index.d.ts +2 -0
- package/lib/core/client/methods/advanced/index.js +8 -0
- package/lib/core/{methods → client/methods}/extras/onEditMessages.d.ts +1 -1
- package/lib/core/{methods → client/methods}/groups/joinGroup.js +0 -1
- package/lib/core/{methods → client/methods}/index.d.ts +4 -3
- package/lib/core/{methods → client/methods}/index.js +8 -17
- package/lib/core/client/methods/utilities/download.d.ts +4 -0
- package/lib/core/client/methods/utilities/download.js +6 -0
- package/lib/core/client/methods/utilities/downloadProfilePicture.d.ts +4 -0
- package/lib/core/client/methods/utilities/downloadProfilePicture.js +28 -0
- package/lib/core/client/methods/utilities/index.d.ts +8 -0
- package/lib/core/{methods → client/methods}/utilities/index.js +5 -5
- package/lib/core/{methods → client/methods}/utilities/start.js +2 -3
- package/lib/core/{methods → client/methods}/utilities/usePlugin.d.ts +1 -1
- package/lib/core/client/network/api.d.ts +16 -0
- package/lib/core/client/network/api.js +95 -0
- package/lib/core/client/network/file.d.ts +3 -0
- package/lib/core/client/network/file.js +117 -0
- package/lib/core/client/network/index.d.ts +25 -0
- package/lib/core/client/network/index.js +31 -0
- package/lib/core/client/network/utils.d.ts +9 -0
- package/lib/core/client/network/utils.js +34 -0
- package/lib/core/client/network/websocket.d.ts +3 -0
- package/lib/core/client/network/websocket.js +174 -0
- package/lib/{types → core/client/types}/client.type.d.ts +11 -13
- package/lib/{types → core/client/types}/index.type.d.ts +1 -3
- package/lib/{types → core/client/types}/index.type.js +1 -8
- package/lib/core/client/types/session.type.d.ts +11 -0
- package/lib/core/client/types/session.type.js +2 -0
- package/lib/exceptions/index.d.ts +6 -0
- package/lib/exceptions/index.js +16 -0
- package/lib/index.d.ts +11 -7
- package/lib/index.js +12 -8
- package/lib/utils/checkFilters.d.ts +1 -0
- package/lib/utils/checkFilters.js +20 -0
- package/lib/{core → utils}/session.d.ts +4 -2
- package/lib/{core → utils}/session.js +27 -11
- package/package.json +49 -43
- package/lib/core/client.d.ts +0 -38
- package/lib/core/client.js +0 -53
- package/lib/core/methods/utilities/index.d.ts +0 -8
- package/lib/core/methods/utilities/runErrorMiddlewares.d.ts +0 -3
- package/lib/core/methods/utilities/runErrorMiddlewares.js +0 -13
- package/lib/core/methods/utilities/useError.d.ts +0 -4
- package/lib/core/methods/utilities/useError.js +0 -6
- package/lib/core/network.d.ts +0 -49
- package/lib/core/network.js +0 -436
- package/lib/types/session.type.d.ts +0 -7
- /package/lib/{core → clients}/network_login.d.ts +0 -0
- /package/lib/core/{methods → bot/methods}/advanced/index.d.ts +0 -0
- /package/lib/core/{methods → bot/methods}/advanced/index.js +0 -0
- /package/lib/{types/client.type.js → core/bot/types/bot.type.js} +0 -0
- /package/lib/{types → core/client/contexts}/activities.type.js +0 -0
- /package/lib/{types → core/client/contexts}/chat.type.js +0 -0
- /package/lib/{types → core/client/contexts}/message.type.js +0 -0
- /package/lib/{types → core/client/contexts}/notifications.type.js +0 -0
- /package/lib/core/{crypto.d.ts → client/crypto.d.ts} +0 -0
- /package/lib/core/{crypto.js → client/crypto.js} +0 -0
- /package/lib/core/{methods → client/methods}/advanced/builder.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/advanced/builder.js +0 -0
- /package/lib/core/{methods → client/methods}/auth/index.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/auth/index.js +0 -0
- /package/lib/core/{methods → client/methods}/auth/logout.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/auth/logout.js +0 -0
- /package/lib/core/{methods → client/methods}/auth/registerDevice.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/auth/registerDevice.js +0 -0
- /package/lib/core/{methods → client/methods}/auth/sendCode.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/auth/sendCode.js +0 -0
- /package/lib/core/{methods → client/methods}/auth/signIn.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/auth/signIn.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/addChannel.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/addChannel.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/addChannelMembers.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/addChannelMembers.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/banChannelMember.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/banChannelMember.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/cancelChangeObjectOwner.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/cancelChangeObjectOwner.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/channelPreviewByJoinLink.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/channelPreviewByJoinLink.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/checkChannelUsername.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/checkChannelUsername.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/createChannelVoiceChat.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/createChannelVoiceChat.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/discardChannelVoiceChat.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/discardChannelVoiceChat.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/editChannelInfo.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/editChannelInfo.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/getBannedChannelMembers.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/getBannedChannelMembers.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/getChannelAdminAccessList.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/getChannelAdminAccessList.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/getChannelAdminMembers.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/getChannelAdminMembers.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/getChannelAllMembers.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/getChannelAllMembers.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/getChannelInfo.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/getChannelInfo.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/getChannelLink.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/getChannelLink.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/getPendingObjectOwner.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/getPendingObjectOwner.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/index.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/index.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/joinChannelAction.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/joinChannelAction.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/joinChannelByLink.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/joinChannelByLink.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/leaveChannelVoiceChat.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/leaveChannelVoiceChat.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/removeChannel.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/removeChannel.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/requestChangeObjectOwner.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/requestChangeObjectOwner.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/seenChannelMessages.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/seenChannelMessages.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/setChannelLink.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/setChannelLink.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/setChannelVoiceChatSetting.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/setChannelVoiceChatSetting.js +0 -0
- /package/lib/core/{methods → client/methods}/channels/updateChannelUsername.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/channels/updateChannelUsername.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/actionOnJoinRequest.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/actionOnJoinRequest.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/addLiveComment.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/addLiveComment.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/clickMessageUrl.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/clickMessageUrl.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/createJoinLink.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/createJoinLink.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/deleteAvatar.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/deleteAvatar.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/deleteChatHistory.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/deleteChatHistory.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/editJoinLink.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/editJoinLink.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/getAbsObjects.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/getAbsObjects.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/getAvatars.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/getAvatars.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/getChatReaction.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/getChatReaction.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/getChats.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/getChats.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/getChatsUpdates.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/getChatsUpdates.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/getJoinLinks.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/getJoinLinks.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/getJoinRequests.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/getJoinRequests.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/getLinkFromAppUrl.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/getLinkFromAppUrl.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/getLiveComments.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/getLiveComments.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/getLivePlayUrl.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/getLivePlayUrl.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/getLiveStatus.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/getLiveStatus.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/getObjectInfoByUsername.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/getObjectInfoByUsername.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/getTopChatUsers.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/getTopChatUsers.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/index.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/index.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/removeFromTopChatUsers.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/removeFromTopChatUsers.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/removeJoinLink.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/removeJoinLink.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/searchChatMessages.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/searchChatMessages.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/searchGlobalMessages.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/searchGlobalMessages.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/seenChats.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/seenChats.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/sendChatActivity.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/sendChatActivity.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/sendLive.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/sendLive.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/setActionChat.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/setActionChat.js +0 -0
- /package/lib/core/{methods → client/methods}/chats/uploadAvatar.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/chats/uploadAvatar.js +0 -0
- /package/lib/core/{methods → client/methods}/contacts/addAddressBook.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/contacts/addAddressBook.js +0 -0
- /package/lib/core/{methods → client/methods}/contacts/deleteContact.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/contacts/deleteContact.js +0 -0
- /package/lib/core/{methods → client/methods}/contacts/getContacts.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/contacts/getContacts.js +0 -0
- /package/lib/core/{methods → client/methods}/contacts/getContactsLastOnline.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/contacts/getContactsLastOnline.js +0 -0
- /package/lib/core/{methods → client/methods}/contacts/getContactsUpdates.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/contacts/getContactsUpdates.js +0 -0
- /package/lib/core/{methods → client/methods}/contacts/index.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/contacts/index.js +0 -0
- /package/lib/core/{methods → client/methods}/contacts/resetContacts.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/contacts/resetContacts.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/banMember.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/banMember.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/deleteMessagebyCount.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/deleteMessagebyCount.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/getInfo.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/getInfo.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/getObjectByUsername.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/getObjectByUsername.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/getProfileLinkItems.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/getProfileLinkItems.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/getRelatedObjects.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/getRelatedObjects.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/getTranscription.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/getTranscription.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/index.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/index.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/join.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/join.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/joinVoiceChat.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/joinVoiceChat.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/leaveChat.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/leaveChat.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/onEditMessages.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/reportObject.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/reportObject.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/searchGlobalObjects.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/searchGlobalObjects.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/sendVoiceChatActivity.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/sendVoiceChatActivity.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/setVoiceChatState.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/setVoiceChatState.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/transcribeVoice.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/transcribeVoice.js +0 -0
- /package/lib/core/{methods → client/methods}/extras/userIsAdmin.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/extras/userIsAdmin.js +0 -0
- /package/lib/core/{methods → client/methods}/gif/addToMyGifSet.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/gif/addToMyGifSet.js +0 -0
- /package/lib/core/{methods → client/methods}/gif/getMyGifSet.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/gif/getMyGifSet.js +0 -0
- /package/lib/core/{methods → client/methods}/gif/index.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/gif/index.js +0 -0
- /package/lib/core/{methods → client/methods}/gif/removeFromMyGifSet.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/gif/removeFromMyGifSet.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/addGroup.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/addGroup.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/addGroupMembers.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/addGroupMembers.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/banGroupMember.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/banGroupMember.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/createGroupVoiceChat.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/createGroupVoiceChat.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/deleteNoAccessGroupChat.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/deleteNoAccessGroupChat.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/discardGroupVoiceChat.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/discardGroupVoiceChat.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/editGroupInfo.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/editGroupInfo.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/getBannedGroupMembers.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/getBannedGroupMembers.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupAdminAccessList.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupAdminAccessList.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupAdminMembers.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupAdminMembers.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupAllMembers.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupAllMembers.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupDefaultAccess.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupDefaultAccess.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupInfo.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupInfo.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupLink.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupLink.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupMentionList.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupMentionList.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupOnlineCount.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupOnlineCount.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupVoiceChatParticipants.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupVoiceChatParticipants.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupVoiceChatUpdates.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/getGroupVoiceChatUpdates.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/groupPreviewByJoinLink.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/groupPreviewByJoinLink.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/index.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/index.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/joinGroup.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/joinGroupVoiceChat.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/joinGroupVoiceChat.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/leaveGroup.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/leaveGroup.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/leaveGroupVoiceChat.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/leaveGroupVoiceChat.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/removeGroup.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/removeGroup.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/seenGroupMessages.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/seenGroupMessages.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/setGroupAdmin.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/setGroupAdmin.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/setGroupDefaultAccess.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/setGroupDefaultAccess.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/setGroupLink.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/setGroupLink.js +0 -0
- /package/lib/core/{methods → client/methods}/groups/setGroupVoiceChatSetting.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/groups/setGroupVoiceChatSetting.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/actionOnMessageReaction.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/actionOnMessageReaction.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/createPoll.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/createPoll.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/deleteMessages.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/deleteMessages.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/editMessage.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/editMessage.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/forwardMessages.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/forwardMessages.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/getMessageShareUrl.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/getMessageShareUrl.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/getMessages.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/getMessages.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/getMessagesByID.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/getMessagesByID.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/getMessagesInterval.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/getMessagesInterval.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/getMessagesUpdates.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/getMessagesUpdates.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/getPollOptionVoters.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/getPollOptionVoters.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/getPollStatus.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/getPollStatus.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/index.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/index.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendDocument.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendDocument.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendFileInline.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendFileInline.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendGif.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendGif.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendMessage.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendMessage.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendMusic.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendMusic.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendPhoto.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendPhoto.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendSticker.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendSticker.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendText.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendText.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendVideo.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendVideo.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendVideoMessage.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendVideoMessage.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendVoice.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/sendVoice.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/setPinMessage.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/setPinMessage.js +0 -0
- /package/lib/core/{methods → client/methods}/messages/votePoll.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/messages/votePoll.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/changePassword.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/changePassword.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/checkTwoStepPasscode.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/checkTwoStepPasscode.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/deleteFolder.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/deleteFolder.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/getBlockedUsers.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/getBlockedUsers.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/getFolders.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/getFolders.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/getMySessions.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/getMySessions.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/getPrivacySetting.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/getPrivacySetting.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/getSuggestedFolders.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/getSuggestedFolders.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/getTwoPasscodeStatus.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/getTwoPasscodeStatus.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/index.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/index.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/requestRecoveryEmail.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/requestRecoveryEmail.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/setSetting.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/setSetting.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/setupTwoStepVerification.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/setupTwoStepVerification.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/terminateOtherSessions.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/terminateOtherSessions.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/terminateSession.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/terminateSession.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/turnOffTwoStep.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/turnOffTwoStep.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/updateProfile.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/updateProfile.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/updateUsername.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/updateUsername.js +0 -0
- /package/lib/core/{methods → client/methods}/settings/verifyRecoveryEmail.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/settings/verifyRecoveryEmail.js +0 -0
- /package/lib/core/{methods → client/methods}/stickers/actionOnStickerSet.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/stickers/actionOnStickerSet.js +0 -0
- /package/lib/core/{methods → client/methods}/stickers/getMyStickerSets.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/stickers/getMyStickerSets.js +0 -0
- /package/lib/core/{methods → client/methods}/stickers/getStickerSetByID.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/stickers/getStickerSetByID.js +0 -0
- /package/lib/core/{methods → client/methods}/stickers/getStickersByEmoji.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/stickers/getStickersByEmoji.js +0 -0
- /package/lib/core/{methods → client/methods}/stickers/getStickersBySetIds.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/stickers/getStickersBySetIds.js +0 -0
- /package/lib/core/{methods → client/methods}/stickers/getTrendStickerSets.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/stickers/getTrendStickerSets.js +0 -0
- /package/lib/core/{methods → client/methods}/stickers/index.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/stickers/index.js +0 -0
- /package/lib/core/{methods → client/methods}/stickers/searchStickers.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/stickers/searchStickers.js +0 -0
- /package/lib/core/{methods → client/methods}/users/checkUserUsername.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/users/checkUserUsername.js +0 -0
- /package/lib/core/{methods → client/methods}/users/deleteUserChat.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/users/deleteUserChat.js +0 -0
- /package/lib/core/{methods → client/methods}/users/getMe.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/users/getMe.js +0 -0
- /package/lib/core/{methods → client/methods}/users/getUserInfo.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/users/getUserInfo.js +0 -0
- /package/lib/core/{methods → client/methods}/users/index.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/users/index.js +0 -0
- /package/lib/core/{methods → client/methods}/users/setBlockUser.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/users/setBlockUser.js +0 -0
- /package/lib/core/{methods → client/methods}/utilities/requestSendFile.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/utilities/requestSendFile.js +0 -0
- /package/lib/core/{methods → client/methods}/utilities/run.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/utilities/run.js +0 -0
- /package/lib/core/{methods → client/methods}/utilities/start.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/utilities/thumbnail.d.ts +0 -0
- /package/lib/core/{methods → client/methods}/utilities/thumbnail.js +0 -0
- /package/lib/core/{methods → client/methods}/utilities/usePlugin.js +0 -0
- /package/lib/core/{parser.d.ts → client/parser.d.ts} +0 -0
- /package/lib/core/{parser.js → client/parser.js} +0 -0
- /package/lib/{types/decorators.type.js → core/client/types/client.type.js} +0 -0
- /package/lib/{types → core/client/types}/decorators.type.d.ts +0 -0
- /package/lib/{types/network.type.js → core/client/types/decorators.type.js} +0 -0
- /package/lib/{types → core/client/types}/network.type.d.ts +0 -0
- /package/lib/{types/session.type.js → core/client/types/network.type.js} +0 -0
- /package/lib/{core → utils}/utils.d.ts +0 -0
- /package/lib/{core → utils}/utils.js +0 -0
package/lib/core/network.js
DELETED
@@ -1,436 +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
|
-
const undici_1 = require("undici");
|
7
|
-
const user_agents_1 = __importDefault(require("user-agents"));
|
8
|
-
const index_type_1 = require("../types/index.type");
|
9
|
-
const crypto_1 = __importDefault(require("./crypto"));
|
10
|
-
const fs_1 = __importDefault(require("fs"));
|
11
|
-
const path_1 = __importDefault(require("path"));
|
12
|
-
const chat_type_1 = __importDefault(require("../types/chat.type"));
|
13
|
-
const notifications_type_1 = __importDefault(require("../types/notifications.type"));
|
14
|
-
const types = {
|
15
|
-
activities: 'show_activities',
|
16
|
-
chat: 'chat_updates',
|
17
|
-
message: 'message_updates',
|
18
|
-
notifications: 'show_notifications',
|
19
|
-
};
|
20
|
-
class Network {
|
21
|
-
constructor(client) {
|
22
|
-
this.client = client;
|
23
|
-
this.userAgent = new user_agents_1.default().toString();
|
24
|
-
this.apiVersion = '6';
|
25
|
-
this.reconnecting = false;
|
26
|
-
this.defaultPlatform = this.resolvePlatform(client.platform);
|
27
|
-
this.headers = this.buildHeaders(client.platform);
|
28
|
-
this.agent = new undici_1.Agent({
|
29
|
-
connect: {
|
30
|
-
rejectUnauthorized: false,
|
31
|
-
},
|
32
|
-
});
|
33
|
-
}
|
34
|
-
/**
|
35
|
-
* Retrieves API and WSS server URLs
|
36
|
-
*/
|
37
|
-
async getDcs() {
|
38
|
-
const url = 'https://getdcmess.iranlms.ir/';
|
39
|
-
const RETRY_DELAY = 3000;
|
40
|
-
while (true) {
|
41
|
-
try {
|
42
|
-
const res = await (0, undici_1.request)(url, {
|
43
|
-
method: 'GET',
|
44
|
-
dispatcher: this.agent,
|
45
|
-
});
|
46
|
-
if (res.statusCode === 200) {
|
47
|
-
const body = (await res.body.json());
|
48
|
-
if (body?.data) {
|
49
|
-
const dcs = body.data;
|
50
|
-
this.apiUrl = `${dcs.API[dcs.default_api]}/`;
|
51
|
-
this.wssUrl = dcs.socket[dcs.default_socket];
|
52
|
-
return true;
|
53
|
-
}
|
54
|
-
}
|
55
|
-
console.warn('[getDcs] Unexpected status or data format:', res.statusCode);
|
56
|
-
}
|
57
|
-
catch (error) {
|
58
|
-
console.error('[getDcs] Error:', error);
|
59
|
-
}
|
60
|
-
await this.delay(RETRY_DELAY);
|
61
|
-
}
|
62
|
-
}
|
63
|
-
/**
|
64
|
-
* Sends a POST request with retry logic and enhanced error reporting
|
65
|
-
*/
|
66
|
-
async request(url, data) {
|
67
|
-
const MAX_ATTEMPTS = 3;
|
68
|
-
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
|
69
|
-
try {
|
70
|
-
const res = await (0, undici_1.request)(url, {
|
71
|
-
method: 'POST',
|
72
|
-
headers: {
|
73
|
-
'content-type': 'application/json',
|
74
|
-
...this.headers,
|
75
|
-
},
|
76
|
-
body: JSON.stringify(data),
|
77
|
-
dispatcher: this.agent,
|
78
|
-
});
|
79
|
-
if (res.statusCode === 200) {
|
80
|
-
const responseData = await res.body.json();
|
81
|
-
return responseData;
|
82
|
-
}
|
83
|
-
else {
|
84
|
-
console.warn(`[request] Attempt ${attempt}: Unexpected status ${res.statusCode}`);
|
85
|
-
}
|
86
|
-
}
|
87
|
-
catch (error) {
|
88
|
-
console.error(`[request] Attempt ${attempt} failed:`, error);
|
89
|
-
}
|
90
|
-
await this.delay(1000);
|
91
|
-
}
|
92
|
-
throw new Error(`[request] Failed after ${MAX_ATTEMPTS} attempts: ${url}`);
|
93
|
-
}
|
94
|
-
async send({ input = {}, method = 'getUserInfo', tmp_session, }) {
|
95
|
-
while (!this.apiUrl) {
|
96
|
-
await this.getDcs();
|
97
|
-
await this.delay(1000);
|
98
|
-
}
|
99
|
-
const { auth, decode_auth, key, privateKey } = this.client;
|
100
|
-
if (!key)
|
101
|
-
return;
|
102
|
-
const credentialsKey = tmp_session ? 'tmp_session' : 'auth';
|
103
|
-
const credentialsValue = tmp_session ? auth : decode_auth;
|
104
|
-
const payload = {
|
105
|
-
api_version: this.apiVersion,
|
106
|
-
[credentialsKey]: credentialsValue,
|
107
|
-
};
|
108
|
-
const dataPayload = JSON.stringify({
|
109
|
-
client: this.defaultPlatform,
|
110
|
-
method,
|
111
|
-
input,
|
112
|
-
});
|
113
|
-
payload.data_enc = crypto_1.default.encrypt(dataPayload, key);
|
114
|
-
if (!tmp_session && privateKey) {
|
115
|
-
payload.sign = crypto_1.default.sign(payload.data_enc, privateKey);
|
116
|
-
}
|
117
|
-
return this.request(this.apiUrl, payload);
|
118
|
-
}
|
119
|
-
async getUpdates() {
|
120
|
-
while (!this.wssUrl) {
|
121
|
-
await this.getDcs();
|
122
|
-
await this.delay(1000);
|
123
|
-
}
|
124
|
-
this.ws = new undici_1.WebSocket(this.wssUrl);
|
125
|
-
this.ws.addEventListener('open', async () => {
|
126
|
-
await this.handleConnect();
|
127
|
-
this.resetInactivityTimer();
|
128
|
-
});
|
129
|
-
this.ws.addEventListener('message', async (event) => {
|
130
|
-
await this.handleMessage(event.data);
|
131
|
-
this.resetInactivityTimer();
|
132
|
-
});
|
133
|
-
this.ws.addEventListener('error', async (event) => {
|
134
|
-
if (!this.reconnecting) {
|
135
|
-
console.error('WebSocket error, reconnecting...');
|
136
|
-
this.reconnecting = true;
|
137
|
-
await this.resetConnection();
|
138
|
-
}
|
139
|
-
});
|
140
|
-
this.ws.addEventListener('close', async () => {
|
141
|
-
if (!this.reconnecting) {
|
142
|
-
console.warn('WebSocket closed, reconnecting...');
|
143
|
-
this.reconnecting = true;
|
144
|
-
await this.resetConnection();
|
145
|
-
}
|
146
|
-
});
|
147
|
-
}
|
148
|
-
async handleConnect() {
|
149
|
-
console.log('Start Bot..');
|
150
|
-
if (this.ws?.readyState === undici_1.WebSocket.OPEN) {
|
151
|
-
this.ws?.send(JSON.stringify({
|
152
|
-
api_version: '5',
|
153
|
-
auth: this.client.auth,
|
154
|
-
data: '',
|
155
|
-
method: 'handShake',
|
156
|
-
}));
|
157
|
-
}
|
158
|
-
if (this.heartbeatInterval)
|
159
|
-
clearInterval(this.heartbeatInterval);
|
160
|
-
this.heartbeatInterval = setInterval(() => {
|
161
|
-
if (this.ws?.readyState === WebSocket.OPEN) {
|
162
|
-
this.ws.send(JSON.stringify({}));
|
163
|
-
}
|
164
|
-
}, 30000);
|
165
|
-
}
|
166
|
-
async handleMessage(message) {
|
167
|
-
const { data_enc } = JSON.parse(message);
|
168
|
-
if (!data_enc || !this.client.key)
|
169
|
-
return;
|
170
|
-
const update = JSON.parse(crypto_1.default.decrypt(data_enc, this.client.key));
|
171
|
-
for (let [event, data] of Object.entries(this.client.handlers)) {
|
172
|
-
if (data.length === 0)
|
173
|
-
continue;
|
174
|
-
// has message
|
175
|
-
const updates = update[types[event]];
|
176
|
-
if (!Array.isArray(updates) || updates.length === 0)
|
177
|
-
continue;
|
178
|
-
// get user name
|
179
|
-
let username = null;
|
180
|
-
const notification = update.show_notifications?.[0];
|
181
|
-
const chatUpdate = update.chat_updates?.[0];
|
182
|
-
if (notification) {
|
183
|
-
const objectGuid = notification?.message_data?.object_guid;
|
184
|
-
if (objectGuid?.startsWith('u0'))
|
185
|
-
username = notification.title;
|
186
|
-
else if (objectGuid?.startsWith('g0'))
|
187
|
-
username = notification.text?.split(':')[0];
|
188
|
-
}
|
189
|
-
else if (chatUpdate) {
|
190
|
-
username =
|
191
|
-
chatUpdate.chat?.last_message?.author_title || 'Unknown User';
|
192
|
-
}
|
193
|
-
else
|
194
|
-
username = 'Unknown User';
|
195
|
-
// start handlers
|
196
|
-
for (let messageData of updates) {
|
197
|
-
messageData = {
|
198
|
-
client_guid: this.client.userGuid,
|
199
|
-
...messageData,
|
200
|
-
message: {
|
201
|
-
author_title: username,
|
202
|
-
...messageData.message,
|
203
|
-
},
|
204
|
-
};
|
205
|
-
for (const chain of data) {
|
206
|
-
await this.runMiddlewareChain(event, chain, messageData, this.client);
|
207
|
-
}
|
208
|
-
}
|
209
|
-
}
|
210
|
-
if (update?.message_updates) {
|
211
|
-
for (let ctx of update.message_updates) {
|
212
|
-
ctx = new index_type_1.Message(this.client, ctx);
|
213
|
-
for (const { middlewares, pattern } of this.client.cmd) {
|
214
|
-
const text = ctx.message?.text;
|
215
|
-
if (!text)
|
216
|
-
return;
|
217
|
-
if ((typeof pattern === 'string' && text === pattern) ||
|
218
|
-
(pattern instanceof RegExp && pattern.test(text))) {
|
219
|
-
await this.runMiddlewareChain('message', middlewares, ctx, this.client);
|
220
|
-
}
|
221
|
-
}
|
222
|
-
}
|
223
|
-
}
|
224
|
-
}
|
225
|
-
async runMiddlewareChain(event, middlewares, ctx, client) {
|
226
|
-
let index = -1;
|
227
|
-
if (event === 'message') {
|
228
|
-
ctx = new index_type_1.Message(client, ctx);
|
229
|
-
}
|
230
|
-
else if (event === 'chat') {
|
231
|
-
ctx = new chat_type_1.default(client, ctx);
|
232
|
-
}
|
233
|
-
else if (event === 'activities') {
|
234
|
-
ctx = new index_type_1.Activities(client, ctx);
|
235
|
-
}
|
236
|
-
else if (event === 'notifications') {
|
237
|
-
ctx = new notifications_type_1.default(client, ctx);
|
238
|
-
}
|
239
|
-
const dispatch = async (i) => {
|
240
|
-
if (i <= index)
|
241
|
-
throw new Error('next() called multiple times');
|
242
|
-
index = i;
|
243
|
-
if (i === middlewares.length)
|
244
|
-
return;
|
245
|
-
const fn = middlewares[i];
|
246
|
-
try {
|
247
|
-
await fn(ctx, () => dispatch(i + 1));
|
248
|
-
}
|
249
|
-
catch (err) {
|
250
|
-
await this.client.runErrorMiddlewares(err, ctx);
|
251
|
-
}
|
252
|
-
};
|
253
|
-
await dispatch(0);
|
254
|
-
}
|
255
|
-
async resetConnection() {
|
256
|
-
this.ws?.close();
|
257
|
-
this.ws = undefined;
|
258
|
-
setTimeout(async () => {
|
259
|
-
await this.getUpdates();
|
260
|
-
this.reconnecting = false;
|
261
|
-
}, 5000);
|
262
|
-
}
|
263
|
-
resetInactivityTimer() {
|
264
|
-
clearTimeout(this.inactivityTimeout);
|
265
|
-
this.inactivityTimeout = setTimeout(async () => {
|
266
|
-
console.warn('No updates received for 10 minutes. Reconnecting WebSocket...');
|
267
|
-
await this.resetConnection();
|
268
|
-
}, 10 * 60 * 1000);
|
269
|
-
}
|
270
|
-
async uploadFile(filePath, chunkSize = 1048576) {
|
271
|
-
if (!fs_1.default.existsSync(filePath))
|
272
|
-
throw new Error('File not found in the given path');
|
273
|
-
const stat = await fs_1.default.promises.stat(filePath);
|
274
|
-
const fileSize = stat.size;
|
275
|
-
const fileName = path_1.default.basename(filePath);
|
276
|
-
const mime = filePath.split('.').pop();
|
277
|
-
let result = await this.client.requestSendFile(fileName, fileSize, mime);
|
278
|
-
let id = result.id;
|
279
|
-
let dc_id = result.dc_id;
|
280
|
-
let upload_url = result.upload_url;
|
281
|
-
let access_hash_send = result.access_hash_send;
|
282
|
-
let totalParts = Math.ceil(fileSize / chunkSize);
|
283
|
-
const stream = fs_1.default.createReadStream(filePath, { highWaterMark: chunkSize });
|
284
|
-
let index = 0;
|
285
|
-
for await (const chunk of stream) {
|
286
|
-
try {
|
287
|
-
const res = await (0, undici_1.request)(upload_url, {
|
288
|
-
method: 'POST',
|
289
|
-
headers: {
|
290
|
-
auth: this.client.auth,
|
291
|
-
'file-id': id,
|
292
|
-
'total-part': totalParts.toString(),
|
293
|
-
'part-number': (index + 1).toString(),
|
294
|
-
'chunk-size': chunk.length.toString(),
|
295
|
-
'access-hash-send': access_hash_send,
|
296
|
-
},
|
297
|
-
body: chunk,
|
298
|
-
dispatcher: this.agent,
|
299
|
-
});
|
300
|
-
const response = await res.body.json();
|
301
|
-
if (response.status === 'ERROR_TRY_AGAIN') {
|
302
|
-
console.log('Retrying upload...');
|
303
|
-
stream.close();
|
304
|
-
result = await this.client.requestSendFile(fileName, fileSize, mime);
|
305
|
-
id = result.id;
|
306
|
-
dc_id = result.dc_id;
|
307
|
-
upload_url = result.upload_url;
|
308
|
-
access_hash_send = result.access_hash_send;
|
309
|
-
index = 0;
|
310
|
-
return this.uploadFile(filePath, chunkSize);
|
311
|
-
}
|
312
|
-
index++;
|
313
|
-
if (response.status === 'OK' &&
|
314
|
-
response.status_det === 'OK' &&
|
315
|
-
response.data?.access_hash_rec) {
|
316
|
-
return {
|
317
|
-
mime,
|
318
|
-
size: fileSize,
|
319
|
-
dc_id,
|
320
|
-
file_id: id,
|
321
|
-
file_name: fileName,
|
322
|
-
access_hash_rec: response.data.access_hash_rec,
|
323
|
-
};
|
324
|
-
}
|
325
|
-
}
|
326
|
-
catch (error) {
|
327
|
-
console.error('Upload error:', error);
|
328
|
-
await new Promise((resolve) => setTimeout(resolve, 5000));
|
329
|
-
}
|
330
|
-
}
|
331
|
-
throw new Error('Upload failed completely.');
|
332
|
-
}
|
333
|
-
// async download(
|
334
|
-
// dc_id: number,
|
335
|
-
// file_id: number,
|
336
|
-
// access_hash: string,
|
337
|
-
// size: number,
|
338
|
-
// chunk: number = 131072,
|
339
|
-
// callback?: (totalSize: number, downloadedSize: number) => Promise<void>,
|
340
|
-
// speed: boolean = false
|
341
|
-
// ): Promise<Buffer> {
|
342
|
-
// const headers = {
|
343
|
-
// auth: this.client.auth,
|
344
|
-
// "access-hash-rec": access_hash,
|
345
|
-
// "file-id": String(file_id),
|
346
|
-
// "user-agent": this.userAgent,
|
347
|
-
// };
|
348
|
-
// const base_url = `https://messenger${dc_id}.iranlms.ir`;
|
349
|
-
// const fetchChunk = async (
|
350
|
-
// start_index: number,
|
351
|
-
// last_index: number
|
352
|
-
// ): Promise<Buffer> => {
|
353
|
-
// const chunk_headers = {
|
354
|
-
// ...headers,
|
355
|
-
// "start-index": String(start_index),
|
356
|
-
// "last-index": String(last_index),
|
357
|
-
// };
|
358
|
-
// try {
|
359
|
-
// const config: AxiosRequestConfig = {
|
360
|
-
// headers: chunk_headers,
|
361
|
-
// responseType: "arraybuffer",
|
362
|
-
// };
|
363
|
-
// const response = await axios.post(
|
364
|
-
// `${base_url}/GetFile.ashx`,
|
365
|
-
// {},
|
366
|
-
// config
|
367
|
-
// );
|
368
|
-
// return Buffer.from(response.data);
|
369
|
-
// } catch (e) {
|
370
|
-
// return Buffer.alloc(0);
|
371
|
-
// }
|
372
|
-
// };
|
373
|
-
// if (speed) {
|
374
|
-
// const tasks: Promise<Buffer>[] = [];
|
375
|
-
// for (let start_index = 0; start_index < size; start_index += chunk) {
|
376
|
-
// const last_index = Math.min(start_index + chunk, size) - 1;
|
377
|
-
// tasks.push(fetchChunk(start_index, last_index));
|
378
|
-
// }
|
379
|
-
// const resultChunks = await Promise.all(tasks);
|
380
|
-
// const result = Buffer.concat(resultChunks);
|
381
|
-
// if (callback) {
|
382
|
-
// await callback(size, result.length);
|
383
|
-
// }
|
384
|
-
// return result;
|
385
|
-
// } else {
|
386
|
-
// let result = Buffer.alloc(0);
|
387
|
-
// let start_index = 0;
|
388
|
-
// while (start_index < size) {
|
389
|
-
// const last_index = Math.min(start_index + chunk, size) - 1;
|
390
|
-
// const data = await fetchChunk(start_index, last_index);
|
391
|
-
// if (data.length === 0) break;
|
392
|
-
// result = Buffer.concat([result, data]);
|
393
|
-
// start_index = last_index + 1;
|
394
|
-
// if (callback) {
|
395
|
-
// await callback(size, result.length);
|
396
|
-
// }
|
397
|
-
// }
|
398
|
-
// return result;
|
399
|
-
// }
|
400
|
-
// }
|
401
|
-
/**
|
402
|
-
* Delay utility
|
403
|
-
*/
|
404
|
-
delay(ms) {
|
405
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
406
|
-
}
|
407
|
-
/**
|
408
|
-
* Resolves platform configuration based on input
|
409
|
-
*/
|
410
|
-
resolvePlatform(platform) {
|
411
|
-
const isAndroid = platform?.toLowerCase() === 'android';
|
412
|
-
return {
|
413
|
-
app_name: 'Main',
|
414
|
-
app_version: isAndroid ? '3.6.4' : '4.4.9',
|
415
|
-
platform: isAndroid ? 'Android' : 'Web',
|
416
|
-
package: isAndroid ? 'app.rbmain.a' : 'web.rubika.ir',
|
417
|
-
lang_code: 'fa',
|
418
|
-
};
|
419
|
-
}
|
420
|
-
/**
|
421
|
-
* Builds HTTP headers based on platform
|
422
|
-
*/
|
423
|
-
buildHeaders(platform) {
|
424
|
-
const headers = {
|
425
|
-
'content-type': 'application/json',
|
426
|
-
connection: 'keep-alive',
|
427
|
-
'user-agent': new user_agents_1.default().toString(),
|
428
|
-
};
|
429
|
-
if (platform.toLowerCase() !== 'android') {
|
430
|
-
headers.origin = 'https://web.rubika.ir';
|
431
|
-
headers.referer = 'https://web.rubika.ir/';
|
432
|
-
}
|
433
|
-
return headers;
|
434
|
-
}
|
435
|
-
}
|
436
|
-
exports.default = Network;
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|