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
@@ -0,0 +1,95 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.getDcs = getDcs;
|
7
|
+
exports.sendRequest = sendRequest;
|
8
|
+
exports.sendPayload = sendPayload;
|
9
|
+
const undici_1 = require("undici");
|
10
|
+
const crypto_1 = __importDefault(require("../crypto"));
|
11
|
+
/**
|
12
|
+
* Retrieves API and WSS server URLs
|
13
|
+
*/
|
14
|
+
async function getDcs(network) {
|
15
|
+
const url = 'https://getdcmess.iranlms.ir/';
|
16
|
+
const RETRY_DELAY = 3000;
|
17
|
+
while (true) {
|
18
|
+
try {
|
19
|
+
const res = await (0, undici_1.request)(url, {
|
20
|
+
method: 'GET',
|
21
|
+
dispatcher: network.agent,
|
22
|
+
});
|
23
|
+
if (res.statusCode === 200) {
|
24
|
+
const body = (await res.body.json());
|
25
|
+
if (body?.data) {
|
26
|
+
const dcs = body.data;
|
27
|
+
network.apiUrl = `${dcs.API[dcs.default_api]}/`;
|
28
|
+
network.wssUrl = dcs.socket[dcs.default_socket];
|
29
|
+
return true;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
console.warn('[getDcs] Unexpected status or data format:', res.statusCode);
|
33
|
+
}
|
34
|
+
catch (error) {
|
35
|
+
console.error('[getDcs] Error:', error);
|
36
|
+
}
|
37
|
+
await network.delay(RETRY_DELAY);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
/**
|
41
|
+
* Sends a POST request with retry logic and enhanced error reporting
|
42
|
+
*/
|
43
|
+
async function sendRequest(network, url, data) {
|
44
|
+
const MAX_ATTEMPTS = 3;
|
45
|
+
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
|
46
|
+
try {
|
47
|
+
const res = await (0, undici_1.request)(url, {
|
48
|
+
method: 'POST',
|
49
|
+
headers: {
|
50
|
+
'content-type': 'application/json',
|
51
|
+
...network.headers,
|
52
|
+
},
|
53
|
+
body: JSON.stringify(data),
|
54
|
+
dispatcher: network.agent,
|
55
|
+
});
|
56
|
+
if (res.statusCode === 200) {
|
57
|
+
const responseData = await res.body.json();
|
58
|
+
return responseData;
|
59
|
+
}
|
60
|
+
else {
|
61
|
+
console.warn(`[request] Attempt ${attempt}: Unexpected status ${res.statusCode}`);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
catch (error) {
|
65
|
+
console.error(`[request] Attempt ${attempt} failed:`, error);
|
66
|
+
}
|
67
|
+
await network.delay(1000);
|
68
|
+
}
|
69
|
+
throw new Error(`[request] Failed after ${MAX_ATTEMPTS} attempts: ${url}`);
|
70
|
+
}
|
71
|
+
async function sendPayload(network, datas) {
|
72
|
+
await network.getDcs();
|
73
|
+
while (!network.apiUrl) {
|
74
|
+
await network.delay(1000);
|
75
|
+
}
|
76
|
+
const { auth, decode_auth, key, privateKey } = network.client;
|
77
|
+
if (!key)
|
78
|
+
return;
|
79
|
+
const credentialsKey = datas.tmp_session ? 'tmp_session' : 'auth';
|
80
|
+
const credentialsValue = datas.tmp_session ? auth : decode_auth;
|
81
|
+
const dataPayload = JSON.stringify({
|
82
|
+
client: network.defaultPlatform,
|
83
|
+
method: datas.method,
|
84
|
+
input: datas.input,
|
85
|
+
});
|
86
|
+
const payload = {
|
87
|
+
api_version: '6',
|
88
|
+
data_enc: crypto_1.default.encrypt(dataPayload, key),
|
89
|
+
[credentialsKey]: credentialsValue,
|
90
|
+
};
|
91
|
+
if (!datas.tmp_session && privateKey) {
|
92
|
+
payload.sign = crypto_1.default.sign(payload.data_enc, privateKey);
|
93
|
+
}
|
94
|
+
return network.request(network.apiUrl, payload);
|
95
|
+
}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import Network from '.';
|
2
|
+
export declare function uploadFile(network: Network, filePath: string, chunkSize?: number): Promise<any>;
|
3
|
+
export declare function download(network: Network, dc_id: number, file_id: number, access_hash: string, size: number, chunk?: number): Promise<Buffer>;
|
@@ -0,0 +1,117 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.uploadFile = uploadFile;
|
7
|
+
exports.download = download;
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
9
|
+
const path_1 = __importDefault(require("path"));
|
10
|
+
const undici_1 = require("undici");
|
11
|
+
async function uploadFile(network, filePath, chunkSize = 1048576) {
|
12
|
+
if (!fs_1.default.existsSync(filePath))
|
13
|
+
throw new Error('File not found in the given path');
|
14
|
+
const stat = await fs_1.default.promises.stat(filePath);
|
15
|
+
const fileSize = stat.size;
|
16
|
+
const fileName = path_1.default.basename(filePath);
|
17
|
+
const mime = filePath.split('.').pop();
|
18
|
+
let result = await network.client.requestSendFile(fileName, fileSize, mime);
|
19
|
+
let id = result.id;
|
20
|
+
let dc_id = result.dc_id;
|
21
|
+
let upload_url = result.upload_url;
|
22
|
+
let access_hash_send = result.access_hash_send;
|
23
|
+
let totalParts = Math.ceil(fileSize / chunkSize);
|
24
|
+
const stream = fs_1.default.createReadStream(filePath, { highWaterMark: chunkSize });
|
25
|
+
let index = 0;
|
26
|
+
for await (const chunk of stream) {
|
27
|
+
try {
|
28
|
+
const res = await (0, undici_1.request)(upload_url, {
|
29
|
+
method: 'POST',
|
30
|
+
headers: {
|
31
|
+
auth: network.client.auth,
|
32
|
+
'file-id': id,
|
33
|
+
'total-part': totalParts.toString(),
|
34
|
+
'part-number': (index + 1).toString(),
|
35
|
+
'chunk-size': chunk.length.toString(),
|
36
|
+
'access-hash-send': access_hash_send,
|
37
|
+
},
|
38
|
+
body: chunk,
|
39
|
+
dispatcher: network.agent,
|
40
|
+
});
|
41
|
+
const response = await res.body.json();
|
42
|
+
if (response.status === 'ERROR_TRY_AGAIN') {
|
43
|
+
console.log('Retrying upload...');
|
44
|
+
stream.close();
|
45
|
+
result = await network.client.requestSendFile(fileName, fileSize, mime);
|
46
|
+
id = result.id;
|
47
|
+
dc_id = result.dc_id;
|
48
|
+
upload_url = result.upload_url;
|
49
|
+
access_hash_send = result.access_hash_send;
|
50
|
+
index = 0;
|
51
|
+
return uploadFile(network, filePath, chunkSize);
|
52
|
+
}
|
53
|
+
index++;
|
54
|
+
if (response.status === 'OK' &&
|
55
|
+
response.status_det === 'OK' &&
|
56
|
+
response.data?.access_hash_rec) {
|
57
|
+
return {
|
58
|
+
mime,
|
59
|
+
size: fileSize,
|
60
|
+
dc_id,
|
61
|
+
file_id: id,
|
62
|
+
file_name: fileName,
|
63
|
+
access_hash_rec: response.data.access_hash_rec,
|
64
|
+
};
|
65
|
+
}
|
66
|
+
}
|
67
|
+
catch (error) {
|
68
|
+
console.error('Upload error:', error);
|
69
|
+
await new Promise((resolve) => setTimeout(resolve, 5000));
|
70
|
+
}
|
71
|
+
}
|
72
|
+
throw new Error('Upload failed completely.');
|
73
|
+
}
|
74
|
+
async function download(network, dc_id, file_id, access_hash, size, chunk = 131072) {
|
75
|
+
const headersBase = {
|
76
|
+
auth: network.client.auth,
|
77
|
+
'access-hash-rec': access_hash,
|
78
|
+
'file-id': String(file_id),
|
79
|
+
'user-agent': network.userAgent,
|
80
|
+
};
|
81
|
+
const base_url = `https://messenger${dc_id}.iranlms.ir`;
|
82
|
+
const fetchChunk = async (start_index, last_index) => {
|
83
|
+
const headers = {
|
84
|
+
...headersBase,
|
85
|
+
'start-index': String(start_index),
|
86
|
+
'last-index': String(last_index),
|
87
|
+
};
|
88
|
+
try {
|
89
|
+
const { body, statusCode } = await (0, undici_1.request)(`${base_url}/GetFile.ashx`, {
|
90
|
+
method: 'POST',
|
91
|
+
headers,
|
92
|
+
});
|
93
|
+
if (statusCode !== 200 || !body)
|
94
|
+
return Buffer.alloc(0);
|
95
|
+
const chunks = [];
|
96
|
+
for await (const chunk of body) {
|
97
|
+
chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk);
|
98
|
+
}
|
99
|
+
return Buffer.concat(chunks);
|
100
|
+
}
|
101
|
+
catch (err) {
|
102
|
+
console.error(`[fetchChunk] Failed at ${start_index}-${last_index}`, err);
|
103
|
+
return Buffer.alloc(0);
|
104
|
+
}
|
105
|
+
};
|
106
|
+
let result = Buffer.alloc(0);
|
107
|
+
let start_index = 0;
|
108
|
+
while (start_index < size) {
|
109
|
+
const last_index = Math.min(start_index + chunk, size) - 1;
|
110
|
+
const chunkData = await fetchChunk(start_index, last_index);
|
111
|
+
if (chunkData.length === 0)
|
112
|
+
break;
|
113
|
+
result = Buffer.concat([result, chunkData]);
|
114
|
+
start_index = last_index + 1;
|
115
|
+
}
|
116
|
+
return result;
|
117
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import Client from '../client';
|
2
|
+
import { Agent, WebSocket as UndiciWebSocket } from 'undici';
|
3
|
+
import { delay } from './utils';
|
4
|
+
import { NetworkTypes } from '../types/index.type';
|
5
|
+
export default class Network {
|
6
|
+
client: Client;
|
7
|
+
headers: Record<string, string>;
|
8
|
+
defaultPlatform: NetworkTypes.Platform;
|
9
|
+
agent: Agent;
|
10
|
+
userAgent: string;
|
11
|
+
ws?: InstanceType<typeof UndiciWebSocket>;
|
12
|
+
apiUrl?: string;
|
13
|
+
wssUrl?: string;
|
14
|
+
heartbeatInterval?: NodeJS.Timeout;
|
15
|
+
inactivityTimeout?: NodeJS.Timeout;
|
16
|
+
reconnecting: boolean;
|
17
|
+
constructor(client: Client);
|
18
|
+
getDcs: () => Promise<boolean>;
|
19
|
+
request: (url: string, data: any) => Promise<unknown>;
|
20
|
+
send: (opts: any) => Promise<any>;
|
21
|
+
getUpdates: () => Promise<void>;
|
22
|
+
uploadFile: (filePath: string, chunkSize?: number) => Promise<any>;
|
23
|
+
download: (dc_id: number, file_id: number, access_hash: string, size: number, chunk?: number) => Promise<Buffer<ArrayBufferLike>>;
|
24
|
+
delay: typeof delay;
|
25
|
+
}
|
@@ -0,0 +1,31 @@
|
|
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 utils_1 = require("./utils");
|
8
|
+
const api_1 = require("./api");
|
9
|
+
const websocket_1 = require("./websocket");
|
10
|
+
const user_agents_1 = __importDefault(require("user-agents"));
|
11
|
+
const file_1 = require("./file");
|
12
|
+
class Network {
|
13
|
+
constructor(client) {
|
14
|
+
this.client = client;
|
15
|
+
this.userAgent = new user_agents_1.default().toString();
|
16
|
+
this.reconnecting = false;
|
17
|
+
this.getDcs = () => (0, api_1.getDcs)(this);
|
18
|
+
this.request = (url, data) => (0, api_1.sendRequest)(this, url, data);
|
19
|
+
this.send = (opts) => (0, api_1.sendPayload)(this, opts);
|
20
|
+
this.getUpdates = async () => (0, websocket_1.setupWebSocket)(this);
|
21
|
+
this.uploadFile = (filePath, chunkSize) => (0, file_1.uploadFile)(this, filePath, chunkSize);
|
22
|
+
this.download = (dc_id, file_id, access_hash, size, chunk = 131072) => (0, file_1.download)(this, dc_id, file_id, access_hash, size, chunk);
|
23
|
+
this.delay = utils_1.delay;
|
24
|
+
this.defaultPlatform = (0, utils_1.resolvePlatform)(client.platform);
|
25
|
+
this.headers = (0, utils_1.buildHeaders)(client.platform);
|
26
|
+
this.agent = new undici_1.Agent({
|
27
|
+
connect: { rejectUnauthorized: false },
|
28
|
+
});
|
29
|
+
}
|
30
|
+
}
|
31
|
+
exports.default = Network;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export declare function delay(ms: number): Promise<unknown>;
|
2
|
+
export declare function resolvePlatform(platform: string): {
|
3
|
+
app_name: string;
|
4
|
+
app_version: string;
|
5
|
+
platform: string;
|
6
|
+
package: string;
|
7
|
+
lang_code: string;
|
8
|
+
};
|
9
|
+
export declare function buildHeaders(platform: string): Record<string, string>;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.delay = delay;
|
7
|
+
exports.resolvePlatform = resolvePlatform;
|
8
|
+
exports.buildHeaders = buildHeaders;
|
9
|
+
const user_agents_1 = __importDefault(require("user-agents"));
|
10
|
+
function delay(ms) {
|
11
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
12
|
+
}
|
13
|
+
function resolvePlatform(platform) {
|
14
|
+
const isAndroid = platform?.toLowerCase() === 'android';
|
15
|
+
return {
|
16
|
+
app_name: 'Main',
|
17
|
+
app_version: isAndroid ? '3.6.4' : '4.4.9',
|
18
|
+
platform: isAndroid ? 'Android' : 'Web',
|
19
|
+
package: isAndroid ? 'app.rbmain.a' : 'web.rubika.ir',
|
20
|
+
lang_code: 'fa',
|
21
|
+
};
|
22
|
+
}
|
23
|
+
function buildHeaders(platform) {
|
24
|
+
const headers = {
|
25
|
+
'content-type': 'application/json',
|
26
|
+
connection: 'keep-alive',
|
27
|
+
'user-agent': new user_agents_1.default().toString(),
|
28
|
+
};
|
29
|
+
if (platform.toLowerCase() !== 'android') {
|
30
|
+
headers.origin = 'https://web.rubika.ir';
|
31
|
+
headers.referer = 'https://web.rubika.ir/';
|
32
|
+
}
|
33
|
+
return headers;
|
34
|
+
}
|
@@ -0,0 +1,174 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.setupWebSocket = setupWebSocket;
|
7
|
+
exports.openSocket = openSocket;
|
8
|
+
const crypto_1 = __importDefault(require("../crypto"));
|
9
|
+
const undici_1 = require("undici");
|
10
|
+
const contextConstructors_1 = require("../contexts/contextConstructors");
|
11
|
+
const checkFilters_1 = require("../../../utils/checkFilters");
|
12
|
+
const TYPES = {
|
13
|
+
chat: 'chat_updates',
|
14
|
+
message: 'message_updates',
|
15
|
+
activities: 'show_activities',
|
16
|
+
notifications: 'show_notifications',
|
17
|
+
};
|
18
|
+
async function setupWebSocket(network) {
|
19
|
+
while (!network.wssUrl) {
|
20
|
+
await network.delay(1000);
|
21
|
+
}
|
22
|
+
network.ws = new undici_1.WebSocket(network.wssUrl);
|
23
|
+
network.ws.addEventListener('open', async () => await openSocket(network));
|
24
|
+
network.ws.addEventListener('message', async (event) => await getMessage(event.data, network));
|
25
|
+
network.ws.addEventListener('error', async () => {
|
26
|
+
if (!network.reconnecting) {
|
27
|
+
console.error('WebSocket error, reconnecting...');
|
28
|
+
network.reconnecting = true;
|
29
|
+
await resetConnection(network);
|
30
|
+
}
|
31
|
+
});
|
32
|
+
network.ws.addEventListener('close', async () => {
|
33
|
+
if (!network.reconnecting) {
|
34
|
+
console.warn('WebSocket closed, reconnecting...');
|
35
|
+
network.reconnecting = true;
|
36
|
+
await resetConnection(network);
|
37
|
+
}
|
38
|
+
});
|
39
|
+
}
|
40
|
+
async function openSocket(network) {
|
41
|
+
try {
|
42
|
+
console.log('Starting bot...');
|
43
|
+
if (network.ws && network.ws.readyState === undici_1.WebSocket.OPEN) {
|
44
|
+
const payload = JSON.stringify({
|
45
|
+
api_version: '5',
|
46
|
+
auth: network.client.auth,
|
47
|
+
data: '',
|
48
|
+
method: 'handShake',
|
49
|
+
});
|
50
|
+
network.ws.send(payload);
|
51
|
+
if (network.heartbeatInterval)
|
52
|
+
clearInterval(network.heartbeatInterval);
|
53
|
+
network.heartbeatInterval = setInterval(() => {
|
54
|
+
try {
|
55
|
+
if (network.ws?.readyState === undici_1.WebSocket.OPEN) {
|
56
|
+
network.ws.send(JSON.stringify({}));
|
57
|
+
}
|
58
|
+
}
|
59
|
+
catch (err) {
|
60
|
+
console.error('Error sending heartbeat', err);
|
61
|
+
}
|
62
|
+
}, 30000);
|
63
|
+
}
|
64
|
+
else {
|
65
|
+
console.warn('WebSocket is not open; cannot send handshake');
|
66
|
+
}
|
67
|
+
}
|
68
|
+
catch (err) {
|
69
|
+
console.error('Error during openSocket execution', err);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
async function resetConnection(network) {
|
73
|
+
network.ws?.close();
|
74
|
+
network.ws = undefined;
|
75
|
+
setTimeout(async () => {
|
76
|
+
try {
|
77
|
+
await network.getUpdates();
|
78
|
+
}
|
79
|
+
catch (e) {
|
80
|
+
console.error('Failed to reconnect:', e);
|
81
|
+
}
|
82
|
+
finally {
|
83
|
+
network.reconnecting = false;
|
84
|
+
}
|
85
|
+
}, 5000);
|
86
|
+
}
|
87
|
+
function resetInactivityTimer(network) {
|
88
|
+
if (network.inactivityTimeout)
|
89
|
+
clearTimeout(network.inactivityTimeout);
|
90
|
+
network.inactivityTimeout = setTimeout(() => {
|
91
|
+
console.warn('No updates received for 10 minutes. Reconnecting WebSocket...');
|
92
|
+
void resetConnection(network).catch((err) => {
|
93
|
+
console.error('Error during inactivity reset:', err);
|
94
|
+
});
|
95
|
+
}, 10 * 60 * 1000);
|
96
|
+
}
|
97
|
+
async function getMessage(message, network) {
|
98
|
+
try {
|
99
|
+
const { data_enc } = JSON.parse(message);
|
100
|
+
if (!data_enc || !network.client.key)
|
101
|
+
return;
|
102
|
+
resetInactivityTimer(network);
|
103
|
+
const update = JSON.parse(crypto_1.default.decrypt(data_enc, network.client.key));
|
104
|
+
const tasks = [];
|
105
|
+
for (const ctxKey of Object.keys(TYPES)) {
|
106
|
+
const updateKey = TYPES[ctxKey];
|
107
|
+
const author_title = getAuthorTitle(update);
|
108
|
+
const items = update[updateKey];
|
109
|
+
if (!Array.isArray(items) || items.length === 0)
|
110
|
+
continue;
|
111
|
+
const handlers = network.client.handlers[ctxKey];
|
112
|
+
if (!handlers || handlers.length === 0)
|
113
|
+
continue;
|
114
|
+
tasks.push(handleCategory(ctxKey, handlers, items, network, author_title));
|
115
|
+
}
|
116
|
+
if (tasks.length === 1) {
|
117
|
+
await tasks[0];
|
118
|
+
}
|
119
|
+
else if (tasks.length > 1) {
|
120
|
+
await Promise.all(tasks);
|
121
|
+
}
|
122
|
+
}
|
123
|
+
catch (err) {
|
124
|
+
console.error('[getMessage] Failed to decrypt or process message:', err);
|
125
|
+
}
|
126
|
+
}
|
127
|
+
async function handleCategory(type, handlers, updates, network, author_title) {
|
128
|
+
const CtxClass = contextConstructors_1.ContextConstructors[type];
|
129
|
+
if (!CtxClass) {
|
130
|
+
console.warn(`[handleCategory] No constructor found for type: ${type}`);
|
131
|
+
return;
|
132
|
+
}
|
133
|
+
for (let update of updates) {
|
134
|
+
if (!update.message)
|
135
|
+
update.message = {};
|
136
|
+
update.client_guid = network.client.userGuid;
|
137
|
+
update.message.author_title = author_title;
|
138
|
+
const ctx = new CtxClass(network.client, update);
|
139
|
+
for (const { filters, handler, prefix } of handlers) {
|
140
|
+
// filters
|
141
|
+
const passed = await (0, checkFilters_1.checkFilters)(ctx, filters);
|
142
|
+
if (passed) {
|
143
|
+
// Prefix logic
|
144
|
+
if (type === 'message' && prefix) {
|
145
|
+
const text = ctx.message.text;
|
146
|
+
if (!text)
|
147
|
+
continue;
|
148
|
+
if (typeof prefix === 'string' && text !== prefix)
|
149
|
+
continue;
|
150
|
+
if (prefix instanceof RegExp && !prefix.test(text))
|
151
|
+
continue;
|
152
|
+
}
|
153
|
+
await handler(ctx);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}
|
158
|
+
// utils
|
159
|
+
const getAuthorTitle = (update) => {
|
160
|
+
const notification = update.show_notifications?.[0];
|
161
|
+
const chatUpdate = update.chat_updates?.[0];
|
162
|
+
if (notification) {
|
163
|
+
const objectGuid = notification?.message_data?.object_guid;
|
164
|
+
if (objectGuid?.startsWith('u0'))
|
165
|
+
return notification.title;
|
166
|
+
else if (objectGuid?.startsWith('g0'))
|
167
|
+
return notification.text?.split(':')[0];
|
168
|
+
}
|
169
|
+
else if (chatUpdate) {
|
170
|
+
return chatUpdate.chat?.last_message?.author_title || 'Unknown User';
|
171
|
+
}
|
172
|
+
else
|
173
|
+
return 'Unknown User';
|
174
|
+
};
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import Client from '../
|
2
|
-
import Chat from '
|
3
|
-
import
|
4
|
-
import Message from '
|
5
|
-
import Notifications from '
|
1
|
+
import Client from '../client';
|
2
|
+
import Chat from '../contexts/chat.type';
|
3
|
+
import Activities from '../contexts/activities.type';
|
4
|
+
import Message from '../contexts/message.type';
|
5
|
+
import Notifications from '../contexts/notifications.type';
|
6
6
|
export interface Session {
|
7
7
|
iv: string;
|
8
8
|
enData: string;
|
@@ -17,17 +17,15 @@ export interface RubPlugin {
|
|
17
17
|
version?: string;
|
18
18
|
run: PluginFunction;
|
19
19
|
}
|
20
|
-
export
|
20
|
+
export interface ContextMap {
|
21
21
|
chat: Chat;
|
22
22
|
message: Message;
|
23
23
|
activities: Activities;
|
24
24
|
notifications: Notifications;
|
25
|
-
};
|
26
|
-
export type Middleware<C> = (ctx: C, next: () => Promise<void>) => Promise<void>;
|
27
|
-
export type Handler<C> = (ctx: C) => Promise<void>;
|
28
|
-
export type MiddlewareChain<C> = [...Middleware<C>[], Handler<C>];
|
29
|
-
export interface Command<C> {
|
30
|
-
pattern: string | RegExp;
|
31
|
-
middlewares: MiddlewareChain<C>;
|
32
25
|
}
|
26
|
+
export type Handler<T> = {
|
27
|
+
filters: Array<(ctx: T) => boolean | Promise<boolean>>;
|
28
|
+
handler: (ctx: T) => Promise<void>;
|
29
|
+
prefix?: string | RegExp;
|
30
|
+
};
|
33
31
|
export {};
|
@@ -2,6 +2,4 @@ import * as ClientTypes from './client.type';
|
|
2
2
|
import * as SessionTypes from './session.type';
|
3
3
|
import * as NetworkTypes from './network.type';
|
4
4
|
import * as DecoratorsTypes from './decorators.type';
|
5
|
-
|
6
|
-
import Activities from './activities.type';
|
7
|
-
export { ClientTypes, SessionTypes, NetworkTypes, DecoratorsTypes, Message, Activities, };
|
5
|
+
export { ClientTypes, SessionTypes, NetworkTypes, DecoratorsTypes, };
|
@@ -32,11 +32,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
32
32
|
return result;
|
33
33
|
};
|
34
34
|
})();
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
37
|
-
};
|
38
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
39
|
-
exports.
|
36
|
+
exports.DecoratorsTypes = exports.NetworkTypes = exports.SessionTypes = exports.ClientTypes = void 0;
|
40
37
|
const ClientTypes = __importStar(require("./client.type"));
|
41
38
|
exports.ClientTypes = ClientTypes;
|
42
39
|
const SessionTypes = __importStar(require("./session.type"));
|
@@ -45,7 +42,3 @@ const NetworkTypes = __importStar(require("./network.type"));
|
|
45
42
|
exports.NetworkTypes = NetworkTypes;
|
46
43
|
const DecoratorsTypes = __importStar(require("./decorators.type"));
|
47
44
|
exports.DecoratorsTypes = DecoratorsTypes;
|
48
|
-
const message_type_1 = __importDefault(require("./message.type"));
|
49
|
-
exports.Message = message_type_1.default;
|
50
|
-
const activities_type_1 = __importDefault(require("./activities.type"));
|
51
|
-
exports.Activities = activities_type_1.default;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.MeaagesErrors = exports.BuilderException = void 0;
|
4
|
+
class BuilderException extends Error {
|
5
|
+
constructor(message, code, data) {
|
6
|
+
super(message);
|
7
|
+
this.code = code;
|
8
|
+
this.data = data;
|
9
|
+
this.name = 'BuilderException';
|
10
|
+
}
|
11
|
+
}
|
12
|
+
exports.BuilderException = BuilderException;
|
13
|
+
exports.MeaagesErrors = {
|
14
|
+
INVALID_ACCESS: ' invalid access error:',
|
15
|
+
INVALID_INPUT: ' invalid input error:',
|
16
|
+
};
|
package/lib/index.d.ts
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
-
import Client from './core/client';
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
1
|
+
import Client from './core/client/client';
|
2
|
+
import ClientFilters from './core/client/filters';
|
3
|
+
import ClientUtils from './utils/utils';
|
4
|
+
import Bot from './core/bot/bot';
|
5
|
+
import BotFilters from './core/bot/filters';
|
6
|
+
import { RubPlugin } from './core/client/types/client.type';
|
7
|
+
import type MessageType from './core/client/contexts/message.type';
|
8
|
+
import type ActivitiesType from './core/client/contexts/activities.type';
|
9
|
+
import type ChatType from './core/client/contexts/chat.type';
|
10
|
+
import type NotificationsType from './core/client/contexts/notifications.type';
|
7
11
|
import * as Clients from './clients';
|
8
|
-
export { Client,
|
12
|
+
export { Client, ClientFilters, ClientUtils, Bot, BotFilters, RubPlugin, ChatType, MessageType, ActivitiesType, NotificationsType, Clients, };
|
9
13
|
export default Client;
|
package/lib/index.js
CHANGED
@@ -36,15 +36,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
37
37
|
};
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
39
|
-
exports.Clients = exports.
|
40
|
-
|
39
|
+
exports.Clients = exports.BotFilters = exports.Bot = exports.ClientUtils = exports.ClientFilters = exports.Client = void 0;
|
40
|
+
// client
|
41
|
+
const client_1 = __importDefault(require("./core/client/client"));
|
41
42
|
exports.Client = client_1.default;
|
42
|
-
const filters_1 = __importDefault(require("./core/filters"));
|
43
|
-
exports.
|
44
|
-
const utils_1 = __importDefault(require("./
|
45
|
-
exports.
|
46
|
-
|
47
|
-
|
43
|
+
const filters_1 = __importDefault(require("./core/client/filters"));
|
44
|
+
exports.ClientFilters = filters_1.default;
|
45
|
+
const utils_1 = __importDefault(require("./utils/utils"));
|
46
|
+
exports.ClientUtils = utils_1.default;
|
47
|
+
// robot
|
48
|
+
const bot_1 = __importDefault(require("./core/bot/bot"));
|
49
|
+
exports.Bot = bot_1.default;
|
50
|
+
const filters_2 = __importDefault(require("./core/bot/filters"));
|
51
|
+
exports.BotFilters = filters_2.default;
|
48
52
|
const Clients = __importStar(require("./clients"));
|
49
53
|
exports.Clients = Clients;
|
50
54
|
exports.default = client_1.default;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function checkFilters(ctx: any, filters: (Function | Function[])[]): Promise<boolean>;
|