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/README.md
CHANGED
@@ -5,28 +5,49 @@
|
|
5
5
|
|
6
6
|
# RubJS
|
7
7
|
|
8
|
-
> یک فریمورک مدرن، زیبا و کاملاً غیرهمزمان برای تعامل با API رسمی روبیکا
|
8
|
+
> یک فریمورک مدرن، زیبا و کاملاً غیرهمزمان برای تعامل با API رسمی روبیکا
|
9
9
|
|
10
10
|
---
|
11
11
|
|
12
12
|
## 🚀 معرفی
|
13
13
|
|
14
|
-
**RubJS** یک فریمورک سبک و ماژولار برای توسعه سریع رباتهای روبیکایی است. این فریمورک با معماری مبتنی بر
|
14
|
+
**RubJS** یک فریمورک سبک و ماژولار برای توسعه سریع رباتهای روبیکایی است. این فریمورک با معماری مبتنی بر Fileter-Base سیستم فرماندهی، زمانبندی و تایپسیف، به شما این امکان را میدهد که در کمترین زمان، رباتهایی سریع، تمیز و قابل گسترش بسازید.
|
15
15
|
|
16
16
|
---
|
17
17
|
|
18
|
-
##
|
18
|
+
## نمونه کد اولیه برای سلف
|
19
19
|
|
20
20
|
```js
|
21
|
-
const { Client,
|
21
|
+
const { Client, ClientFilters } = require("rubjs");
|
22
22
|
|
23
|
-
const
|
23
|
+
const client = new Client("rubjs");
|
24
24
|
|
25
|
-
|
25
|
+
client.command("/admin", [ClientFilters.isPrivate], async (ctx) => {
|
26
26
|
await ctx.reply("شما ادمین هستید ✅");
|
27
27
|
});
|
28
28
|
|
29
|
-
|
29
|
+
client.on("message", [ClientFilters.isGroup], async (ctx) => {
|
30
|
+
await ctx.reply("سلام");
|
31
|
+
});
|
32
|
+
|
33
|
+
client.run();
|
34
|
+
```
|
35
|
+
|
36
|
+
---
|
37
|
+
|
38
|
+
|
39
|
+
## نمونه کد اولیه برای ربات
|
40
|
+
|
41
|
+
```js
|
42
|
+
const { Bot, BotFilters } = require("rubjs");
|
43
|
+
|
44
|
+
const bot = new Bot("rubjs");
|
45
|
+
|
46
|
+
bot.command("/start", async (ctx) => {
|
47
|
+
await ctx.reply("ربات استارت شد.");
|
48
|
+
});
|
49
|
+
|
50
|
+
bot.on("message", [Filters.isText], async (ctx) => {
|
30
51
|
await ctx.reply("سلام");
|
31
52
|
});
|
32
53
|
|
@@ -39,14 +60,14 @@ bot.run();
|
|
39
60
|
### پشتیبانی از پلاگینها (Plugin System)
|
40
61
|
امکان افزودن قابلیتهای جدید با پلاگینهای جداگانه
|
41
62
|
|
42
|
-
### طراحی
|
43
|
-
|
63
|
+
### طراحی Filters-based
|
64
|
+
اجرای نوع جدیدی از فیلتر روی پیام ها برای فیلت کردن پیام کاربران
|
44
65
|
|
45
66
|
### تایپسیف کامل (TypeScript Ready)
|
46
67
|
طراحی شده با پشتیبانی کامل از تایپها برای توسعهدهندگان حرفهای.
|
47
68
|
|
48
69
|
### سیستم فرمانها (Commands)
|
49
|
-
استفاده از `bot.command(pattern,
|
70
|
+
استفاده از `bot.command(pattern, handler)` برای مدیریت پیامهای فرمانمحور.
|
50
71
|
|
51
72
|
### ابزارهای داخلی توسعه
|
52
73
|
مثل `Utils.Bold`, `Utils.Italic` و ... برای زیباتر کردن پاسخها به کاربر.
|
@@ -67,4 +88,4 @@ npm install rubjs
|
|
67
88
|
### مستندات و آموزشها
|
68
89
|
برای مشاهده مستندات کامل، نمونههای بیشتر و راهنمای استفاده، به صفحه رسمی مستندات RubJS مراجعه کنید:
|
69
90
|
|
70
|
-
🔗 [مشاهده مستندات RubJS](https://hadi-rostami.github.io/rubjs-
|
91
|
+
🔗 [مشاهده مستندات RubJS](https://hadi-rostami.github.io/rubjs-document/)
|
@@ -4,7 +4,6 @@ declare class VoiceChatClient {
|
|
4
4
|
private source;
|
5
5
|
private track;
|
6
6
|
private ffmpeg?;
|
7
|
-
private buffer;
|
8
7
|
private frameSize;
|
9
8
|
private playlist;
|
10
9
|
private currentIndex;
|
@@ -13,7 +12,8 @@ declare class VoiceChatClient {
|
|
13
12
|
private client?;
|
14
13
|
private isPaused;
|
15
14
|
private lastPosition;
|
16
|
-
private
|
15
|
+
private audioTimer?;
|
16
|
+
private updateTimers;
|
17
17
|
private isManualSkip;
|
18
18
|
private getMusicUrl?;
|
19
19
|
constructor(getMusicUrl?: () => Promise<string>);
|
@@ -25,6 +25,7 @@ declare class VoiceChatClient {
|
|
25
25
|
addToPlaylist(filePath: string): void;
|
26
26
|
removeFromPlaylist(filePath: string): void;
|
27
27
|
joinVoiceChat(chatGuid: string, voiceChatId: string, client: Client): Promise<void>;
|
28
|
-
private
|
28
|
+
private setTimers;
|
29
|
+
private clearTimers;
|
29
30
|
}
|
30
31
|
export default VoiceChatClient;
|
@@ -5,15 +5,15 @@ const optional_require_1 = require("optional-require");
|
|
5
5
|
const optionalWrtc = (0, optional_require_1.optionalRequire)('wrtc');
|
6
6
|
class VoiceChatClient {
|
7
7
|
constructor(getMusicUrl) {
|
8
|
-
this.
|
9
|
-
this.frameSize = 960;
|
8
|
+
this.frameSize = 960 * 2; // 960 samples * 2 bytes
|
10
9
|
this.playlist = [];
|
11
10
|
this.currentIndex = 0;
|
12
11
|
this.isPaused = false;
|
13
12
|
this.lastPosition = 0;
|
13
|
+
this.updateTimers = [];
|
14
14
|
this.isManualSkip = false;
|
15
15
|
if (!optionalWrtc) {
|
16
|
-
throw new Error('wrtc module is not installed.
|
16
|
+
throw new Error('wrtc module is not installed.');
|
17
17
|
}
|
18
18
|
this.pc = new optionalWrtc.RTCPeerConnection();
|
19
19
|
this.source = new optionalWrtc.nonstandard.RTCAudioSource();
|
@@ -22,123 +22,80 @@ class VoiceChatClient {
|
|
22
22
|
this.getMusicUrl = getMusicUrl;
|
23
23
|
}
|
24
24
|
async play(filePath) {
|
25
|
-
|
26
|
-
this.stop();
|
25
|
+
this.stop(); // clean up previous
|
27
26
|
if (!filePath) {
|
28
|
-
if (this.playlist.length
|
29
|
-
|
30
|
-
this.playlist = [await this.getMusicUrl()];
|
31
|
-
}
|
32
|
-
else
|
33
|
-
return;
|
27
|
+
if (!this.playlist.length && this.getMusicUrl) {
|
28
|
+
this.playlist = [await this.getMusicUrl()];
|
34
29
|
}
|
35
30
|
filePath = this.playlist[this.currentIndex];
|
36
31
|
}
|
37
|
-
if (!this.chatGuid || !this.voiceChatId || !this.client) {
|
38
|
-
throw new Error('Voice chat not initialized.
|
32
|
+
if (!filePath || !this.chatGuid || !this.voiceChatId || !this.client) {
|
33
|
+
throw new Error('Voice chat not initialized.');
|
39
34
|
}
|
40
35
|
this.isPaused = false;
|
41
36
|
this.isManualSkip = false;
|
42
|
-
this.buffer = Buffer.alloc(0);
|
43
37
|
const seekArgs = this.lastPosition > 0 ? ['-ss', this.lastPosition.toString()] : [];
|
44
38
|
this.ffmpeg = (0, child_process_1.spawn)('ffmpeg', [
|
45
|
-
'-loglevel',
|
46
|
-
'quiet',
|
39
|
+
'-loglevel', 'quiet',
|
47
40
|
'-re',
|
48
|
-
'-threads',
|
49
|
-
'
|
50
|
-
'-protocol_whitelist',
|
51
|
-
'file,http,https,tcp,tls',
|
41
|
+
'-threads', '1',
|
42
|
+
'-protocol_whitelist', 'file,http,https,tcp,tls',
|
52
43
|
...seekArgs,
|
53
|
-
'-i',
|
54
|
-
|
55
|
-
'-
|
56
|
-
'
|
57
|
-
'-
|
58
|
-
'48000',
|
59
|
-
'-ac',
|
60
|
-
'1',
|
61
|
-
'-f',
|
62
|
-
's16le',
|
44
|
+
'-i', filePath,
|
45
|
+
'-acodec', 'pcm_s16le',
|
46
|
+
'-ar', '48000',
|
47
|
+
'-ac', '1',
|
48
|
+
'-f', 's16le',
|
63
49
|
'pipe:1',
|
64
50
|
]);
|
65
|
-
|
66
|
-
this.ffmpeg.
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
this.ffmpeg.on('close', async (code) => {
|
79
|
-
if (!this.isManualSkip && code !== null && !this.isPaused) {
|
51
|
+
this.audioTimer = setInterval(() => {
|
52
|
+
if (!this.ffmpeg || this.isPaused)
|
53
|
+
return;
|
54
|
+
const chunk = this.ffmpeg.stdout.read(this.frameSize);
|
55
|
+
if (!chunk)
|
56
|
+
return;
|
57
|
+
const samples = new Int16Array(chunk.buffer, chunk.byteOffset, chunk.length / 2);
|
58
|
+
this.source.onData({ samples, sampleRate: 48000 });
|
59
|
+
this.lastPosition += 0.02;
|
60
|
+
}, 20); // 20ms = 960 samples
|
61
|
+
this.ffmpeg.on('close', async () => {
|
62
|
+
clearInterval(this.audioTimer);
|
63
|
+
if (!this.isManualSkip && !this.isPaused) {
|
80
64
|
await this.next();
|
81
65
|
}
|
82
66
|
this.isManualSkip = false;
|
83
67
|
});
|
84
|
-
this.
|
85
|
-
this.intervalId = setInterval(async () => {
|
86
|
-
try {
|
87
|
-
if (!this.client || !this.chatGuid || !this.voiceChatId)
|
88
|
-
return;
|
89
|
-
await this.client.getGroupVoiceChatUpdates(this.chatGuid, this.voiceChatId);
|
90
|
-
}
|
91
|
-
catch { }
|
92
|
-
}, 10 * 1000);
|
93
|
-
this.intervalId = setInterval(async () => {
|
94
|
-
try {
|
95
|
-
if (this.isPaused ||
|
96
|
-
!this.client ||
|
97
|
-
!this.chatGuid ||
|
98
|
-
!this.voiceChatId ||
|
99
|
-
!this.client.userGuid)
|
100
|
-
return;
|
101
|
-
await this.client.sendVoiceChatActivity(this.chatGuid, this.voiceChatId, this.client.userGuid);
|
102
|
-
}
|
103
|
-
catch { }
|
104
|
-
}, 2 * 1000);
|
68
|
+
this.setTimers();
|
105
69
|
}
|
106
70
|
stop() {
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
}
|
71
|
+
this.ffmpeg?.kill();
|
72
|
+
this.ffmpeg = undefined;
|
73
|
+
this.isPaused = true;
|
74
|
+
clearInterval(this.audioTimer);
|
75
|
+
this.clearTimers();
|
113
76
|
}
|
114
77
|
resume() {
|
115
78
|
if (this.isPaused)
|
116
|
-
this.play();
|
79
|
+
this.play(this.playlist[this.currentIndex]);
|
117
80
|
}
|
118
81
|
async next() {
|
119
|
-
if (this.
|
82
|
+
if (this.currentIndex + 1 < this.playlist.length) {
|
120
83
|
this.isManualSkip = true;
|
121
|
-
this.
|
122
|
-
this.currentIndex += 1;
|
84
|
+
this.currentIndex++;
|
123
85
|
this.lastPosition = 0;
|
124
|
-
this.isPaused = true;
|
125
86
|
this.play(this.playlist[this.currentIndex]);
|
126
87
|
}
|
127
|
-
else {
|
128
|
-
|
129
|
-
|
130
|
-
await this.next();
|
131
|
-
}
|
88
|
+
else if (this.getMusicUrl) {
|
89
|
+
this.playlist.push(await this.getMusicUrl());
|
90
|
+
await this.next();
|
132
91
|
}
|
133
92
|
}
|
134
93
|
previous() {
|
135
94
|
if (this.currentIndex > 0) {
|
136
95
|
this.isManualSkip = true;
|
137
|
-
this.stop();
|
138
96
|
this.currentIndex--;
|
139
97
|
this.lastPosition = 0;
|
140
|
-
this.
|
141
|
-
this.play();
|
98
|
+
this.play(this.playlist[this.currentIndex]);
|
142
99
|
}
|
143
100
|
}
|
144
101
|
addToPlaylist(filePath) {
|
@@ -162,18 +119,29 @@ class VoiceChatClient {
|
|
162
119
|
return;
|
163
120
|
await this.pc.setLocalDescription(offer);
|
164
121
|
const connect = await client.joinGroupVoiceChat(chatGuid, voiceChatId, offer.sdp, client.userGuid);
|
165
|
-
const sdpAnswer = connect.sdp_answer_data;
|
166
122
|
await this.pc.setRemoteDescription(new optionalWrtc.RTCSessionDescription({
|
167
123
|
type: 'answer',
|
168
|
-
sdp:
|
124
|
+
sdp: connect.sdp_answer_data,
|
169
125
|
}));
|
170
126
|
await client.setVoiceChatState(chatGuid, voiceChatId);
|
171
127
|
}
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
this.
|
176
|
-
|
128
|
+
setTimers() {
|
129
|
+
this.clearTimers();
|
130
|
+
this.updateTimers.push(setInterval(async () => {
|
131
|
+
if (this.client && this.chatGuid && this.voiceChatId) {
|
132
|
+
await this.client.getGroupVoiceChatUpdates(this.chatGuid, this.voiceChatId);
|
133
|
+
}
|
134
|
+
}, 10 * 1000));
|
135
|
+
this.updateTimers.push(setInterval(async () => {
|
136
|
+
if (this.client && this.chatGuid && this.voiceChatId &&
|
137
|
+
this.client.userGuid && !this.isPaused) {
|
138
|
+
await this.client.sendVoiceChatActivity(this.chatGuid, this.voiceChatId, this.client.userGuid);
|
139
|
+
}
|
140
|
+
}, 2 * 1000));
|
141
|
+
}
|
142
|
+
clearTimers() {
|
143
|
+
this.updateTimers.forEach(clearInterval);
|
144
|
+
this.updateTimers = [];
|
177
145
|
}
|
178
146
|
}
|
179
147
|
exports.default = VoiceChatClient;
|
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const crypto_1 = __importDefault(require("../core/crypto"));
|
7
|
-
const network_login_1 = __importDefault(require("
|
8
|
-
const session_1 = __importDefault(require("../
|
6
|
+
const crypto_1 = __importDefault(require("../core/client/crypto"));
|
7
|
+
const network_login_1 = __importDefault(require("./network_login"));
|
8
|
+
const session_1 = __importDefault(require("../utils/session"));
|
9
9
|
class LoginClient {
|
10
10
|
static async sendCode(phone_number, pass_key) {
|
11
11
|
const network = new network_login_1.default();
|
@@ -64,7 +64,7 @@ class LoginClient {
|
|
64
64
|
private_key: privateKey,
|
65
65
|
};
|
66
66
|
if (sessionPath) {
|
67
|
-
const session = new session_1.default(sessionPath);
|
67
|
+
const session = new session_1.default(sessionPath, undefined, 'CLIENT');
|
68
68
|
session.saveSession(sessionData);
|
69
69
|
}
|
70
70
|
return { isOk: true, status: 'Sucessfull', sessionData };
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const undici_1 = require("undici");
|
7
|
-
const crypto_1 = __importDefault(require("
|
7
|
+
const crypto_1 = __importDefault(require("../core/client/crypto"));
|
8
8
|
class Network {
|
9
9
|
constructor() {
|
10
10
|
this.apiUrl = null;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import SessionManager from '../../utils/session';
|
2
|
+
import Message from './contexts/message.context';
|
3
|
+
import Methods from './methods';
|
4
|
+
import Network from './network';
|
5
|
+
import { BotType, ContextMap, Handler, SessionType } from './types/bot.type';
|
6
|
+
import { FastifyInstance } from 'fastify';
|
7
|
+
declare class Bot extends Methods {
|
8
|
+
token: SessionType;
|
9
|
+
BASE_URL: string;
|
10
|
+
protected sessionDB: SessionManager;
|
11
|
+
protected initialize: boolean;
|
12
|
+
protected network: Network;
|
13
|
+
sendToken: string;
|
14
|
+
handlers: {
|
15
|
+
[K in keyof ContextMap]: Handler<ContextMap[K]>[];
|
16
|
+
};
|
17
|
+
server: FastifyInstance;
|
18
|
+
bot?: BotType;
|
19
|
+
constructor(token: SessionType);
|
20
|
+
on<T extends keyof typeof this.handlers>(type: T, handler: (ctx: ContextMap[T]) => Promise<void>): void;
|
21
|
+
on<T extends keyof typeof this.handlers>(type: T, filters: Array<(ctx: ContextMap[T]) => boolean | Promise<boolean>>, handler: (ctx: ContextMap[T]) => Promise<void>): void;
|
22
|
+
command(prefix: string | RegExp, handler: (ctx: Message) => Promise<void>): void;
|
23
|
+
command(prefix: string | RegExp, filters: Array<(ctx: Message) => boolean | Promise<boolean>>, handler: (ctx: Message) => Promise<void>): void;
|
24
|
+
}
|
25
|
+
export default Bot;
|
@@ -0,0 +1,57 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const session_1 = __importDefault(require("../../utils/session"));
|
7
|
+
const methods_1 = __importDefault(require("./methods"));
|
8
|
+
const network_1 = __importDefault(require("./network"));
|
9
|
+
const fastify_1 = __importDefault(require("fastify"));
|
10
|
+
class Bot extends methods_1.default {
|
11
|
+
constructor(token) {
|
12
|
+
super();
|
13
|
+
this.token = token;
|
14
|
+
this.BASE_URL = `https://botapi.rubika.ir/v3`;
|
15
|
+
this.initialize = false;
|
16
|
+
this.sendToken = '';
|
17
|
+
this.handlers = { inline: [], message: [] };
|
18
|
+
this.sessionDB = new session_1.default(token, undefined, 'BOT');
|
19
|
+
this.network = new network_1.default(this);
|
20
|
+
this.server = (0, fastify_1.default)();
|
21
|
+
this.start();
|
22
|
+
}
|
23
|
+
on(type, filtersOrHandler, maybeHandler) {
|
24
|
+
if (typeof filtersOrHandler === 'function') {
|
25
|
+
this.handlers[type].push({
|
26
|
+
filters: [],
|
27
|
+
handler: filtersOrHandler,
|
28
|
+
});
|
29
|
+
}
|
30
|
+
else if (Array.isArray(filtersOrHandler) && maybeHandler) {
|
31
|
+
this.handlers[type].push({
|
32
|
+
filters: filtersOrHandler,
|
33
|
+
handler: maybeHandler,
|
34
|
+
});
|
35
|
+
}
|
36
|
+
}
|
37
|
+
command(prefix, filtersOrHandler, maybeHandler) {
|
38
|
+
if (typeof filtersOrHandler === 'function') {
|
39
|
+
this.handlers.message.push({
|
40
|
+
filters: [],
|
41
|
+
handler: filtersOrHandler,
|
42
|
+
prefix,
|
43
|
+
});
|
44
|
+
}
|
45
|
+
else if (Array.isArray(filtersOrHandler) && maybeHandler) {
|
46
|
+
this.handlers.message.push({
|
47
|
+
filters: filtersOrHandler,
|
48
|
+
handler: maybeHandler,
|
49
|
+
prefix,
|
50
|
+
});
|
51
|
+
}
|
52
|
+
else {
|
53
|
+
throw new Error('Invalid arguments for command()');
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
exports.default = Bot;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { Bot } from '../../..';
|
2
|
+
import { File, Location, AuxData, InlineMessage as InlineMessageType, Keypad, ChatKeypadTypeEnum, InlineKeypad } from '../types/models';
|
3
|
+
declare class InlineMessage implements InlineMessageType {
|
4
|
+
sender_id: string;
|
5
|
+
text: string;
|
6
|
+
file?: File;
|
7
|
+
location?: Location;
|
8
|
+
aux_data?: AuxData;
|
9
|
+
message_id: string;
|
10
|
+
chat_id: string;
|
11
|
+
store: Record<string, any>;
|
12
|
+
bot: Bot;
|
13
|
+
constructor(bot: Bot, update: InlineMessageType);
|
14
|
+
reply(text: string, chat_keypad?: Keypad, inline_keypad?: InlineKeypad, disable_notification?: boolean, reply_to_message_id?: string, chat_keypad_type?: ChatKeypadTypeEnum): Promise<void>;
|
15
|
+
}
|
16
|
+
export default InlineMessage;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
class InlineMessage {
|
4
|
+
constructor(bot, update) {
|
5
|
+
this.store = {};
|
6
|
+
Object.defineProperty(this, 'bot', {
|
7
|
+
value: bot,
|
8
|
+
enumerable: false,
|
9
|
+
writable: true,
|
10
|
+
configurable: true,
|
11
|
+
});
|
12
|
+
this.chat_id = update.chat_id;
|
13
|
+
this.sender_id = update.sender_id;
|
14
|
+
this.text = update.text;
|
15
|
+
if (update?.file)
|
16
|
+
this.file = update.file;
|
17
|
+
if (update?.location)
|
18
|
+
this.location = update.location;
|
19
|
+
if (update?.aux_data)
|
20
|
+
this.aux_data = update.aux_data;
|
21
|
+
this.message_id = update.message_id;
|
22
|
+
}
|
23
|
+
async reply(text, chat_keypad, inline_keypad, disable_notification = false, reply_to_message_id, chat_keypad_type) {
|
24
|
+
await this.bot.sendMessage(this.chat_id, text, chat_keypad, inline_keypad, disable_notification, reply_to_message_id, chat_keypad_type);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
exports.default = InlineMessage;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { Bot } from '../../..';
|
2
|
+
import { PaymentStatus, Update, UpdateTypeEnum, Message as MessageUpdate, Keypad, ChatKeypadTypeEnum, InlineKeypad } from '../types/models';
|
3
|
+
declare class Message implements Update {
|
4
|
+
type: UpdateTypeEnum;
|
5
|
+
chat_id: string;
|
6
|
+
removed_message_id?: string;
|
7
|
+
new_message?: MessageUpdate;
|
8
|
+
updated_message?: MessageUpdate;
|
9
|
+
updated_payment?: PaymentStatus;
|
10
|
+
store: Record<string, any>;
|
11
|
+
bot: Bot;
|
12
|
+
constructor(bot: Bot, update: Update);
|
13
|
+
reply(text: string, chat_keypad?: Keypad, inline_keypad?: InlineKeypad, disable_notification?: boolean, reply_to_message_id?: string, chat_keypad_type?: ChatKeypadTypeEnum): Promise<void>;
|
14
|
+
forward(to_chat_id: string, disable_notification?: boolean): Promise<void>;
|
15
|
+
delete(): Promise<void>;
|
16
|
+
}
|
17
|
+
export default Message;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
class Message {
|
4
|
+
constructor(bot, update) {
|
5
|
+
this.store = {};
|
6
|
+
Object.defineProperty(this, 'bot', {
|
7
|
+
value: bot,
|
8
|
+
enumerable: false,
|
9
|
+
writable: true,
|
10
|
+
configurable: true,
|
11
|
+
});
|
12
|
+
this.type = update.type;
|
13
|
+
this.chat_id = update.chat_id;
|
14
|
+
if (update?.new_message)
|
15
|
+
this.new_message = update?.new_message;
|
16
|
+
if (update?.updated_message)
|
17
|
+
this.updated_message = update?.updated_message;
|
18
|
+
if (update?.updated_payment)
|
19
|
+
this.updated_payment = update?.updated_payment;
|
20
|
+
if (update.removed_message_id)
|
21
|
+
this.removed_message_id = update.removed_message_id;
|
22
|
+
}
|
23
|
+
async reply(text, chat_keypad, inline_keypad, disable_notification = false, reply_to_message_id, chat_keypad_type) {
|
24
|
+
await this.bot.sendMessage(this.chat_id, text, chat_keypad, inline_keypad, disable_notification, reply_to_message_id, chat_keypad_type);
|
25
|
+
}
|
26
|
+
async forward(to_chat_id, disable_notification = false) {
|
27
|
+
const message_id = this.new_message?.message_id || this.updated_message?.message_id;
|
28
|
+
if (!message_id)
|
29
|
+
return;
|
30
|
+
await this.bot.forwardMessage(this.chat_id, message_id, to_chat_id, disable_notification);
|
31
|
+
}
|
32
|
+
async delete() {
|
33
|
+
const message_id = this.new_message?.message_id || this.updated_message?.message_id;
|
34
|
+
if (!message_id)
|
35
|
+
return;
|
36
|
+
await this.bot.deleteMessage(this.chat_id, message_id);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
exports.default = Message;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import Message from './contexts/message.context';
|
2
|
+
export default class BotFilters {
|
3
|
+
static isText(message: Message): boolean;
|
4
|
+
static isLocation(message: Message): boolean;
|
5
|
+
static isSticker(message: Message): boolean;
|
6
|
+
static isForward(message: Message): boolean;
|
7
|
+
static isReply(message: Message): boolean;
|
8
|
+
static isContact(message: Message): boolean;
|
9
|
+
static isPoll(message: Message): boolean;
|
10
|
+
static isLiveLocation(message: Message): boolean;
|
11
|
+
static isFile(message: Message): boolean;
|
12
|
+
static isDelete(message: Message): boolean;
|
13
|
+
static kypadID(button_id: string): (message: Message) => boolean;
|
14
|
+
}
|
@@ -0,0 +1,45 @@
|
|
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 filters_1 = __importDefault(require("../client/filters"));
|
7
|
+
class BotFilters {
|
8
|
+
static isText(message) {
|
9
|
+
return !!filters_1.default.findKey(message, 'text');
|
10
|
+
}
|
11
|
+
static isLocation(message) {
|
12
|
+
return !!filters_1.default.findKey(message, 'location');
|
13
|
+
}
|
14
|
+
static isSticker(message) {
|
15
|
+
return !!filters_1.default.findKey(message, 'sticker');
|
16
|
+
}
|
17
|
+
static isForward(message) {
|
18
|
+
return !!filters_1.default.findKey(message, 'forwarded_from');
|
19
|
+
}
|
20
|
+
static isReply(message) {
|
21
|
+
return !!filters_1.default.findKey(message, 'reply_to_message_id');
|
22
|
+
}
|
23
|
+
static isContact(message) {
|
24
|
+
return !!filters_1.default.findKey(message, 'contact_message');
|
25
|
+
}
|
26
|
+
static isPoll(message) {
|
27
|
+
return !!filters_1.default.findKey(message, 'poll');
|
28
|
+
}
|
29
|
+
static isLiveLocation(message) {
|
30
|
+
return !!filters_1.default.findKey(message, 'live_location');
|
31
|
+
}
|
32
|
+
static isFile(message) {
|
33
|
+
return !!filters_1.default.findKey(message, 'file');
|
34
|
+
}
|
35
|
+
static isDelete(message) {
|
36
|
+
return !!filters_1.default.findKey(message, 'removed_message_id');
|
37
|
+
}
|
38
|
+
static kypadID(button_id) {
|
39
|
+
return (message) => {
|
40
|
+
const res = filters_1.default.findKey(message, 'button_id');
|
41
|
+
return res === button_id;
|
42
|
+
};
|
43
|
+
}
|
44
|
+
}
|
45
|
+
exports.default = BotFilters;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const exceptions_1 = require("../../../../exceptions");
|
4
|
+
async function builder(method, input = {}) {
|
5
|
+
if (!this.sendToken) {
|
6
|
+
throw new Error('[builder] Bot token is not set. Please provide a valid token.');
|
7
|
+
}
|
8
|
+
const response = await this.network.request(method, input);
|
9
|
+
if (response?.status === 'OK') {
|
10
|
+
return response.data;
|
11
|
+
}
|
12
|
+
const msg = `[builder] ${exceptions_1.MeaagesErrors[response?.status] || 'unknown error:'}`;
|
13
|
+
throw new exceptions_1.BuilderException(msg, response?.status, response);
|
14
|
+
}
|
15
|
+
exports.default = builder;
|