1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 08:39:00 +01:00

Concurrency fix

This commit is contained in:
Daniil Gentili 2021-05-04 14:05:52 +02:00
parent 25267a0ea8
commit 0fab07e246
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
9 changed files with 124 additions and 90 deletions

View File

@ -251,6 +251,7 @@ You can find examples for nearly every MadelineProto function in
* <a href="https://docs.madelineproto.xyz/API_docs/methods/photos.deletePhotos.html" name="photos.deletePhotos">Deletes profile photos: photos.deletePhotos</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/photos.deletePhotos.html" name="photos.deletePhotos">Deletes profile photos: photos.deletePhotos</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/contacts.deleteContacts.html" name="contacts.deleteContacts">Deletes several contacts from the list: contacts.deleteContacts</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/contacts.deleteContacts.html" name="contacts.deleteContacts">Deletes several contacts from the list: contacts.deleteContacts</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/contacts.unblock.html" name="contacts.unblock">Deletes the user from the blacklist: contacts.unblock</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/contacts.unblock.html" name="contacts.unblock">Deletes the user from the blacklist: contacts.unblock</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/help.dismissSuggestion.html" name="help.dismissSuggestion">Dismiss a suggestion: help.dismissSuggestion</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/upload.getCdnFile.html" name="upload.getCdnFile">Download a CDN file: upload.getCdnFile</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/upload.getCdnFile.html" name="upload.getCdnFile">Download a CDN file: upload.getCdnFile</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.editInlineBotMessage.html" name="messages.editInlineBotMessage">Edit an inline bot message: messages.editInlineBotMessage</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.editInlineBotMessage.html" name="messages.editInlineBotMessage">Edit an inline bot message: messages.editInlineBotMessage</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.editLocation.html" name="channels.editLocation">Edit location of geogroup: channels.editLocation</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.editLocation.html" name="channels.editLocation">Edit location of geogroup: channels.editLocation</a>
@ -273,10 +274,13 @@ You can find examples for nearly every MadelineProto function in
* <a href="https://docs.madelineproto.xyz/API_docs/methods/stats.getBroadcastStats.html" name="stats.getBroadcastStats">Get channel statistics: stats.getBroadcastStats</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/stats.getBroadcastStats.html" name="stats.getBroadcastStats">Get channel statistics: stats.getBroadcastStats</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.getMessages.html" name="channels.getMessages">Get channel/supergroup messages: channels.getMessages</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.getMessages.html" name="channels.getMessages">Get channel/supergroup messages: channels.getMessages</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.getAdminedPublicChannels.html" name="channels.getAdminedPublicChannels">Get channels/supergroups/geogroups we're admin in. Usually called when the user exceeds the limit for owned public channels/supergroups/geogroups, and the user is given the choice to remove one of his channels/supergroups/geogroups: channels.getAdminedPublicChannels</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.getAdminedPublicChannels.html" name="channels.getAdminedPublicChannels">Get channels/supergroups/geogroups we're admin in. Usually called when the user exceeds the limit for owned public channels/supergroups/geogroups, and the user is given the choice to remove one of his channels/supergroups/geogroups: channels.getAdminedPublicChannels</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getDiscussionMessage.html" name="messages.getDiscussionMessage">Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group: messages.getDiscussionMessage</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getDialogFilters.html" name="messages.getDialogFilters">Get folders: messages.getDialogFilters</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getDialogFilters.html" name="messages.getDialogFilters">Get folders: messages.getDialogFilters</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getWebPage.html" name="messages.getWebPage">Get instant view page: messages.getWebPage</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getWebPage.html" name="messages.getWebPage">Get instant view page: messages.getWebPage</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/stats.getMessageStats.html" name="stats.getMessageStats">Get message statistics: stats.getMessageStats</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/help.getPassportConfig.html" name="help.getPassportConfig">Get passport configuration: help.getPassportConfig</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/help.getPassportConfig.html" name="help.getPassportConfig">Get passport configuration: help.getPassportConfig</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getSuggestedDialogFilters.html" name="messages.getSuggestedDialogFilters">Get suggested folders: messages.getSuggestedDialogFilters</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getSuggestedDialogFilters.html" name="messages.getSuggestedDialogFilters">Get suggested folders: messages.getSuggestedDialogFilters</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/stats.getMegagroupStats.html" name="stats.getMegagroupStats">Get supergroup statistics: stats.getMegagroupStats</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getDocumentByHash.html" name="messages.getDocumentByHash">Get a document by its SHA256 hash, mainly used for gifs: messages.getDocumentByHash</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getDocumentByHash.html" name="messages.getDocumentByHash">Get a document by its SHA256 hash, mainly used for gifs: messages.getDocumentByHash</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.getLeftChannels.html" name="channels.getLeftChannels">Get a list of channels/supergroups we left: channels.getLeftChannels</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.getLeftChannels.html" name="channels.getLeftChannels">Get a list of channels/supergroups we left: channels.getLeftChannels</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/payments.getPaymentForm.html" name="payments.getPaymentForm">Get a payment form: payments.getPaymentForm</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/payments.getPaymentForm.html" name="payments.getPaymentForm">Get a payment form: payments.getPaymentForm</a>
@ -301,6 +305,7 @@ You can find examples for nearly every MadelineProto function in
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getFavedStickers.html" name="messages.getFavedStickers">Get faved stickers: messages.getFavedStickers</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getFavedStickers.html" name="messages.getFavedStickers">Get faved stickers: messages.getFavedStickers</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getFeaturedStickers.html" name="messages.getFeaturedStickers">Get featured stickers: messages.getFeaturedStickers</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getFeaturedStickers.html" name="messages.getFeaturedStickers">Get featured stickers: messages.getFeaturedStickers</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.getFullChannel.html" name="channels.getFullChannel">Get full info about a channel: channels.getFullChannel</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.getFullChannel.html" name="channels.getFullChannel">Get full info about a channel: channels.getFullChannel</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getGlobalPrivacySettings.html" name="account.getGlobalPrivacySettings">Get global privacy settings: account.getGlobalPrivacySettings</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getInlineGameHighScores.html" name="messages.getInlineGameHighScores">Get highscores of a game sent using an inline bot: messages.getInlineGameHighScores</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getInlineGameHighScores.html" name="messages.getInlineGameHighScores">Get highscores of a game sent using an inline bot: messages.getInlineGameHighScores</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getGameHighScores.html" name="messages.getGameHighScores">Get highscores of a game: messages.getGameHighScores</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getGameHighScores.html" name="messages.getGameHighScores">Get highscores of a game: messages.getGameHighScores</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.getInactiveChannels.html" name="channels.getInactiveChannels">Get inactive channels and supergroups: channels.getInactiveChannels</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.getInactiveChannels.html" name="channels.getInactiveChannels">Get inactive channels and supergroups: channels.getInactiveChannels</a>
@ -324,8 +329,10 @@ You can find examples for nearly every MadelineProto function in
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getAuthorizations.html" name="account.getAuthorizations">Get logged-in sessions: account.getAuthorizations</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getAuthorizations.html" name="account.getAuthorizations">Get logged-in sessions: account.getAuthorizations</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getAutoDownloadSettings.html" name="account.getAutoDownloadSettings">Get media autodownload settings: account.getAutoDownloadSettings</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getAutoDownloadSettings.html" name="account.getAutoDownloadSettings">Get media autodownload settings: account.getAutoDownloadSettings</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getSplitRanges.html" name="messages.getSplitRanges">Get message ranges for saving the user's chat history: messages.getSplitRanges</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getSplitRanges.html" name="messages.getSplitRanges">Get message ranges for saving the user's chat history: messages.getSplitRanges</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getReplies.html" name="messages.getReplies">Get messages in a reply thread: messages.getReplies</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.requestUrlAuth.html" name="messages.requestUrlAuth">Get more info about a Seamless Telegram Login authorization request, for more info click here »: messages.requestUrlAuth</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.requestUrlAuth.html" name="messages.requestUrlAuth">Get more info about a Seamless Telegram Login authorization request, for more info click here »: messages.requestUrlAuth</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/contacts.getTopPeers.html" name="contacts.getTopPeers">Get most used peers: contacts.getTopPeers</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/contacts.getTopPeers.html" name="contacts.getTopPeers">Get most used peers: contacts.getTopPeers</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/help.getCountriesList.html" name="help.getCountriesList">Get name, ISO code, localized name and phone codes/patterns of all available countries: help.getCountriesList</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/updates.getDifference.html" name="updates.getDifference">Get new updates: updates.getDifference</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/updates.getDifference.html" name="updates.getDifference">Get new updates: updates.getDifference</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/langpack.getDifference.html" name="langpack.getDifference">Get new strings in languagepack: langpack.getDifference</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/langpack.getDifference.html" name="langpack.getDifference">Get new strings in languagepack: langpack.getDifference</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/payments.getPaymentReceipt.html" name="payments.getPaymentReceipt">Get payment receipt: payments.getPaymentReceipt</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/payments.getPaymentReceipt.html" name="payments.getPaymentReceipt">Get payment receipt: payments.getPaymentReceipt</a>
@ -395,6 +402,7 @@ You can find examples for nearly every MadelineProto function in
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.markDialogUnread.html" name="messages.markDialogUnread">Manually mark dialog as unread: messages.markDialogUnread</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.markDialogUnread.html" name="messages.markDialogUnread">Manually mark dialog as unread: messages.markDialogUnread</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.readHistory.html" name="channels.readHistory">Mark channel/supergroup history as read: channels.readHistory</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.readHistory.html" name="channels.readHistory">Mark channel/supergroup history as read: channels.readHistory</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.readMessageContents.html" name="channels.readMessageContents">Mark channel/supergroup message contents as read: channels.readMessageContents</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.readMessageContents.html" name="channels.readMessageContents">Mark channel/supergroup message contents as read: channels.readMessageContents</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.readDiscussion.html" name="messages.readDiscussion">Mark a thread as read: messages.readDiscussion</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.faveSticker.html" name="messages.faveSticker">Mark a sticker as favorite: messages.faveSticker</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.faveSticker.html" name="messages.faveSticker">Mark a sticker as favorite: messages.faveSticker</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.readMentions.html" name="messages.readMentions">Mark mentions as read: messages.readMentions</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.readMentions.html" name="messages.readMentions">Mark mentions as read: messages.readMentions</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.readFeaturedStickers.html" name="messages.readFeaturedStickers">Mark new featured stickers as read: messages.readFeaturedStickers</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.readFeaturedStickers.html" name="messages.readFeaturedStickers">Mark new featured stickers as read: messages.readFeaturedStickers</a>
@ -406,6 +414,7 @@ You can find examples for nearly every MadelineProto function in
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.sendScreenshotNotification.html" name="messages.sendScreenshotNotification">Notify the other user in a private chat that a screenshot of the chat was taken: messages.sendScreenshotNotification</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.sendScreenshotNotification.html" name="messages.sendScreenshotNotification">Notify the other user in a private chat that a screenshot of the chat was taken: messages.sendScreenshotNotification</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/users.setSecureValueErrors.html" name="users.setSecureValueErrors">Notify the user that the sent passport data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change): users.setSecureValueErrors</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/users.setSecureValueErrors.html" name="users.setSecureValueErrors">Notify the user that the sent passport data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change): users.setSecureValueErrors</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getPassword.html" name="account.getPassword">Obtain configuration for two-factor authorization with password: account.getPassword</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getPassword.html" name="account.getPassword">Obtain configuration for two-factor authorization with password: account.getPassword</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/stats.getMessagePublicForwards.html" name="stats.getMessagePublicForwards">Obtains a list of messages, indicating to which other public channels was a channel message forwarded. : stats.getMessagePublicForwards</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.setBotPrecheckoutResults.html" name="messages.setBotPrecheckoutResults">Once the user has confirmed their payment and shipping details, the bot receives an updateBotPrecheckoutQuery update. : messages.setBotPrecheckoutResults</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.setBotPrecheckoutResults.html" name="messages.setBotPrecheckoutResults">Once the user has confirmed their payment and shipping details, the bot receives an updateBotPrecheckoutQuery update. : messages.setBotPrecheckoutResults</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/phone.receivedCall.html" name="phone.receivedCall">Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended: phone.receivedCall</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/phone.receivedCall.html" name="phone.receivedCall">Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended: phone.receivedCall</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.updatePinnedMessage.html" name="messages.updatePinnedMessage">Pin a message: messages.updatePinnedMessage</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.updatePinnedMessage.html" name="messages.updatePinnedMessage">Pin a message: messages.updatePinnedMessage</a>
@ -470,9 +479,10 @@ You can find examples for nearly every MadelineProto function in
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.searchGlobal.html" name="messages.searchGlobal">Search for messages and peers globally: messages.searchGlobal</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.searchGlobal.html" name="messages.searchGlobal">Search for messages and peers globally: messages.searchGlobal</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.searchStickerSets.html" name="messages.searchStickerSets">Search for stickersets: messages.searchStickerSets</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.searchStickerSets.html" name="messages.searchStickerSets">Search for stickersets: messages.searchStickerSets</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.saveSecureValue.html" name="account.saveSecureValue">Securely save Telegram Passport document, for more info see the passport docs »: account.saveSecureValue</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/account.saveSecureValue.html" name="account.saveSecureValue">Securely save Telegram Passport document, for more info see the passport docs »: account.saveSecureValue</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/phone.sendSignalingData.html" name="phone.sendSignalingData">Send VoIP signaling data: phone.sendSignalingData</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.sendMedia.html" name="messages.sendMedia">Send a media: messages.sendMedia</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.sendMedia.html" name="messages.sendMedia">Send a media: messages.sendMedia</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.sendInlineBotResult.html" name="messages.sendInlineBotResult">Send a result obtained using messages.getInlineBotResults: messages.sendInlineBotResult</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.sendInlineBotResult.html" name="messages.sendInlineBotResult">Send a result obtained using messages.getInlineBotResults: messages.sendInlineBotResult</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.sendMultiMedia.html" name="messages.sendMultiMedia">Send an album of media: messages.sendMultiMedia</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.sendMultiMedia.html" name="messages.sendMultiMedia">Send an album or grouped media: messages.sendMultiMedia</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/payments.sendPaymentForm.html" name="payments.sendPaymentForm">Send compiled payment form: payments.sendPaymentForm</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/payments.sendPaymentForm.html" name="payments.sendPaymentForm">Send compiled payment form: payments.sendPaymentForm</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.sendConfirmPhoneCode.html" name="account.sendConfirmPhoneCode">Send confirmation code to cancel account deletion, for more info click here »: account.sendConfirmPhoneCode</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/account.sendConfirmPhoneCode.html" name="account.sendConfirmPhoneCode">Send confirmation code to cancel account deletion, for more info click here »: account.sendConfirmPhoneCode</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/phone.saveCallDebug.html" name="phone.saveCallDebug">Send phone call debug data to server: phone.saveCallDebug</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/phone.saveCallDebug.html" name="phone.saveCallDebug">Send phone call debug data to server: phone.saveCallDebug</a>
@ -492,6 +502,7 @@ You can find examples for nearly every MadelineProto function in
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.updatePasswordSettings.html" name="account.updatePasswordSettings">Set a new 2FA password: account.updatePasswordSettings</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/account.updatePasswordSettings.html" name="account.updatePasswordSettings">Set a new 2FA password: account.updatePasswordSettings</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.setAccountTTL.html" name="account.setAccountTTL">Set account self-destruction period: account.setAccountTTL</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/account.setAccountTTL.html" name="account.setAccountTTL">Set account self-destruction period: account.setAccountTTL</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/bots.setBotCommands.html" name="bots.setBotCommands">Set bot command list: bots.setBotCommands</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/bots.setBotCommands.html" name="bots.setBotCommands">Set bot command list: bots.setBotCommands</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.setGlobalPrivacySettings.html" name="account.setGlobalPrivacySettings">Set global privacy settings: account.setGlobalPrivacySettings</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.setContentSettings.html" name="account.setContentSettings">Set sensitive content settings (for viewing or hiding NSFW content): account.setContentSettings</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/account.setContentSettings.html" name="account.setContentSettings">Set sensitive content settings (for viewing or hiding NSFW content): account.setContentSettings</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/stickers.setStickerSetThumb.html" name="stickers.setStickerSetThumb">Set stickerset thumbnail: stickers.setStickerSetThumb</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/stickers.setStickerSetThumb.html" name="stickers.setStickerSetThumb">Set stickerset thumbnail: stickers.setStickerSetThumb</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.setBotCallbackAnswer.html" name="messages.setBotCallbackAnswer">Set the callback answer to a user button press (bots only): messages.setBotCallbackAnswer</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.setBotCallbackAnswer.html" name="messages.setBotCallbackAnswer">Set the callback answer to a user button press (bots only): messages.setBotCallbackAnswer</a>
@ -499,6 +510,7 @@ You can find examples for nearly every MadelineProto function in
* <a href="https://docs.madelineproto.xyz/API_docs/methods/auth.signIn.html" name="auth.signIn">Signs in a user with a validated phone number: auth.signIn</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/auth.signIn.html" name="auth.signIn">Signs in a user with a validated phone number: auth.signIn</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.startBot.html" name="messages.startBot">Start a conversation with a bot using a deep linking parameter: messages.startBot</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.startBot.html" name="messages.startBot">Start a conversation with a bot using a deep linking parameter: messages.startBot</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/phone.requestCall.html" name="phone.requestCall">Start a telegram phone call: phone.requestCall</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/phone.requestCall.html" name="phone.requestCall">Start a telegram phone call: phone.requestCall</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/contacts.blockFromReplies.html" name="contacts.blockFromReplies">Stop getting notifications about thread replies of a certain user in @replies: contacts.blockFromReplies</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/payments.validateRequestedInfo.html" name="payments.validateRequestedInfo">Submit requested order information for validation: payments.validateRequestedInfo</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/payments.validateRequestedInfo.html" name="payments.validateRequestedInfo">Submit requested order information for validation: payments.validateRequestedInfo</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/auth.resetAuthorizations.html" name="auth.resetAuthorizations">Terminates all user's authorized sessions except for the current one: auth.resetAuthorizations</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/auth.resetAuthorizations.html" name="auth.resetAuthorizations">Terminates all user's authorized sessions except for the current one: auth.resetAuthorizations</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.setContactSignUpNotification.html" name="account.setContactSignUpNotification">Toggle contact sign up notifications: account.setContactSignUpNotification</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/account.setContactSignUpNotification.html" name="account.setContactSignUpNotification">Toggle contact sign up notifications: account.setContactSignUpNotification</a>
@ -527,6 +539,7 @@ You can find examples for nearly every MadelineProto function in
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.updateDeviceLocked.html" name="account.updateDeviceLocked">When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications: account.updateDeviceLocked</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/account.updateDeviceLocked.html" name="account.updateDeviceLocked">When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications: account.updateDeviceLocked</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getContactSignUpNotification.html" name="account.getContactSignUpNotification">Whether the user will receive notifications when contacts sign up: account.getContactSignUpNotification</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getContactSignUpNotification.html" name="account.getContactSignUpNotification">Whether the user will receive notifications when contacts sign up: account.getContactSignUpNotification</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/phone.confirmCall.html" name="phone.confirmCall">Complete phone call E2E encryption key exchange »: phone.confirmCall</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/phone.confirmCall.html" name="phone.confirmCall">Complete phone call E2E encryption key exchange »: phone.confirmCall</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.unpinAllMessages.html" name="messages.unpinAllMessages">Unpin all pinned messages: messages.unpinAllMessages</a>
* [Peers](https://docs.madelineproto.xyz/docs/USING_METHODS.html#peers) * [Peers](https://docs.madelineproto.xyz/docs/USING_METHODS.html#peers)
* [Files](https://docs.madelineproto.xyz/docs/FILES.html) * [Files](https://docs.madelineproto.xyz/docs/FILES.html)
* [Secret chats](https://docs.madelineproto.xyz/docs/USING_METHODS.html#secret-chats) * [Secret chats](https://docs.madelineproto.xyz/docs/USING_METHODS.html#secret-chats)

View File

@ -100,7 +100,7 @@ $settings->getLogger()->setLevel(Logger::LEVEL_ULTRA_VERBOSE);
// $settings->setDb((new Postgres)->setDatabase('MadelineProto')->setUsername('daniil')->setPassword('pony')); // $settings->setDb((new Postgres)->setDatabase('MadelineProto')->setUsername('daniil')->setPassword('pony'));
// $settings->setDb((new Mysql)->setDatabase('MadelineProto')->setUsername('daniil')->setPassword('pony')); // $settings->setDb((new Mysql)->setDatabase('MadelineProto')->setUsername('daniil')->setPassword('pony'));
$MadelineProto = new API('bot.madeline', $settings); $MadelineProto = new API('uwu.madeline', $settings);
// Reduce boilerplate with new wrapper method. // Reduce boilerplate with new wrapper method.
// Also initializes error reporting, catching and reporting all errors surfacing from the event loop. // Also initializes error reporting, catching and reporting all errors surfacing from the event loop.

View File

@ -44,11 +44,11 @@ $MadelineProto->loop(static function() use($MadelineProto) {
$threads = 5; $threads = 5;
$step = 20; $step = 20;
$totalMessages = 0; $totalMessages = 0;
$start = microtime(true); $start = \microtime(true);
while (true) { while (true) {
$promises = []; $promises = [];
for ($i = 0; $i < $threads; $i++) { for ($i = 0; $i < $threads; $i++) {
$promises[] = $MadelineProto->messages->getMessages(['id' => range($lastMessageId+1, $lastMessageId+$step)]); $promises[] = $MadelineProto->messages->getMessages(['id' => \range($lastMessageId+1, $lastMessageId+$step)]);
$lastMessageId +=$step; $lastMessageId +=$step;
} }
$results = yield \Amp\Promise\all($promises); $results = yield \Amp\Promise\all($promises);
@ -62,6 +62,6 @@ $MadelineProto->loop(static function() use($MadelineProto) {
} }
} }
}; };
$time = microtime(true)-$start; $time = \microtime(true)-$start;
yield $MadelineProto->echo("\nTime: {$time}\n"); yield $MadelineProto->echo("\nTime: {$time}\n");
}); });

View File

@ -232,7 +232,7 @@ class API extends InternalDoc
if ($this->API instanceof Client) { if ($this->API instanceof Client) {
$this->logger->logger("Restarting to full instance..."); $this->logger->logger("Restarting to full instance...");
try { try {
if (!isset($_GET['MadelineSelfRestart']) && yield $this->hasEventHandler()) { if (!isset($_GET['MadelineSelfRestart']) && ((yield $this->hasEventHandler()) || !(yield $this->isIpcWorker()))) {
$this->logger->logger("Restarting to full instance: the bot is already running!"); $this->logger->logger("Restarting to full instance: the bot is already running!");
MTProto::closeConnection('The bot is already running!'); MTProto::closeConnection('The bot is already running!');
return false; return false;
@ -256,7 +256,7 @@ class API extends InternalDoc
return; return;
} }
$API = new Client($result, $this->session, Logger::$default, $this->async); $API = new Client($result, $this->session, Logger::$default, $this->async);
if (yield from $API->hasEventHandler()) { if ((yield from $API->hasEventHandler()) || !(yield from $API->isIpcWorker())) {
$this->logger->logger("Restarting to full instance (again): the bot is already running!"); $this->logger->logger("Restarting to full instance (again): the bot is already running!");
yield $API->disconnect(); yield $API->disconnect();
$API->unreference(); $API->unreference();

View File

@ -1021,17 +1021,17 @@ interface account
public function getMultiWallPapers($params); public function getMultiWallPapers($params);
/** /**
* * Get global privacy settings.
* *
* @return GlobalPrivacySettings * @return GlobalPrivacySettings
*/ */
public function getGlobalPrivacySettings(); public function getGlobalPrivacySettings();
/** /**
* * Set global privacy settings.
* *
* Parameters: * Parameters:
* * `GlobalPrivacySettings` **settings** -. * * `GlobalPrivacySettings` **settings** - Global privacy settings
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -1157,7 +1157,7 @@ interface contacts
* Adds the user to the blacklist. * Adds the user to the blacklist.
* *
* Parameters: * Parameters:
* * `InputPeer` **id** - * * `InputPeer` **id** - User ID
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -1169,7 +1169,7 @@ interface contacts
* Deletes the user from the blacklist. * Deletes the user from the blacklist.
* *
* Parameters: * Parameters:
* * `InputPeer` **id** - * * `InputPeer` **id** - User ID
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -1321,13 +1321,13 @@ interface contacts
public function getLocated($params); public function getLocated($params);
/** /**
* * Stop getting notifications about [thread replies](https://core.telegram.org/api/threads) of a certain user in `@replies`.
* *
* Parameters: * Parameters:
* * `boolean` **delete_message** - Optional: * * `boolean` **delete_message** - Optional: Whether to delete the specified message as well
* * `boolean` **delete_history** - Optional: * * `boolean` **delete_history** - Optional: Whether to delete all `@replies` messages from this user as well
* * `boolean` **report_spam** - Optional: * * `boolean` **report_spam** - Optional: Whether to also report this user for spam
* * `int` **msg_id** -. * * `int` **msg_id** - ID of the message in the [@replies](https://core.telegram.org/api/threads#replies) chat
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -1393,8 +1393,8 @@ interface messages
* Parameters: * Parameters:
* * `InputPeer` **peer** - User or chat, histories with which are searched, or [(inputPeerEmpty)](https://docs.madelineproto.xyz/API_docs/constructors/inputPeerEmpty.html) constructor for global search * * `InputPeer` **peer** - User or chat, histories with which are searched, or [(inputPeerEmpty)](https://docs.madelineproto.xyz/API_docs/constructors/inputPeerEmpty.html) constructor for global search
* * `string` **q** - Text search request * * `string` **q** - Text search request
* * `InputPeer` **from_id** - Optional: * * `InputPeer` **from_id** - Optional: Only return messages sent by the specified user ID
* * `int` **top_msg_id** - Optional: * * `int` **top_msg_id** - Optional: [Thread ID](https://core.telegram.org/api/threads)
* * `MessagesFilter` **filter** - Filter to return only specified message types * * `MessagesFilter` **filter** - Filter to return only specified message types
* * `int` **min_date** - If a positive value was transferred, only messages with a sending date bigger than the transferred one will be returned * * `int` **min_date** - If a positive value was transferred, only messages with a sending date bigger than the transferred one will be returned
* * `int` **max_date** - If a positive value was transferred, only messages with a sending date smaller than the transferred one will be returned * * `int` **max_date** - If a positive value was transferred, only messages with a sending date smaller than the transferred one will be returned
@ -1469,7 +1469,7 @@ interface messages
* *
* Parameters: * Parameters:
* * `InputPeer` **peer** - Target user or group * * `InputPeer` **peer** - Target user or group
* * `int` **top_msg_id** - Optional: * * `int` **top_msg_id** - Optional: [Thread ID](https://core.telegram.org/api/threads)
* * `SendMessageAction` **action** - Type of action<br>Parameter added in [Layer 17](https://core.telegram.org/api/layers#layer-17). * * `SendMessageAction` **action** - Type of action<br>Parameter added in [Layer 17](https://core.telegram.org/api/layers#layer-17).
* *
* @param array $params Parameters * @param array $params Parameters
@ -1491,7 +1491,7 @@ interface messages
* * `string` **message** - The message * * `string` **message** - The message
* * `ReplyMarkup` **reply_markup** - Optional: Reply markup for sending bot buttons * * `ReplyMarkup` **reply_markup** - Optional: Reply markup for sending bot buttons
* * `[MessageEntity]` **entities** - Optional: Message [entities](https://core.telegram.org/api/entities) for sending styled text * * `[MessageEntity]` **entities** - Optional: Message [entities](https://core.telegram.org/api/entities) for sending styled text
* * `int` **schedule_date** - Optional: Scheduled message date for scheduled messages * * `int` **schedule_date** - Optional: Scheduled message date for [scheduled messages](https://core.telegram.org/api/scheduled-messages)
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -1512,7 +1512,7 @@ interface messages
* * `string` **message** - Caption * * `string` **message** - Caption
* * `ReplyMarkup` **reply_markup** - Optional: Reply markup for bot keyboards * * `ReplyMarkup` **reply_markup** - Optional: Reply markup for bot keyboards
* * `[MessageEntity]` **entities** - Optional: Message [entities](https://core.telegram.org/api/entities) for styled text * * `[MessageEntity]` **entities** - Optional: Message [entities](https://core.telegram.org/api/entities) for styled text
* * `int` **schedule_date** - Optional: Scheduled message date for scheduled messages * * `int` **schedule_date** - Optional: Scheduled message date for [scheduled messages](https://core.telegram.org/api/scheduled-messages)
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -1748,7 +1748,7 @@ interface messages
* Sends a text message to a secret chat. * Sends a text message to a secret chat.
* *
* Parameters: * Parameters:
* * `boolean` **silent** - Optional: * * `boolean` **silent** - Optional: Send encrypted message without a notification
* * `InputEncryptedChat` **peer** - Secret chat ID * * `InputEncryptedChat` **peer** - Secret chat ID
* * `DecryptedMessage` **message** - * * `DecryptedMessage` **message** -
* *
@ -1762,7 +1762,7 @@ interface messages
* Sends a message with a file attachment to a secret chat. * Sends a message with a file attachment to a secret chat.
* *
* Parameters: * Parameters:
* * `boolean` **silent** - Optional: * * `boolean` **silent** - Optional: Whether to send the file without triggering a notification
* * `InputEncryptedChat` **peer** - Secret chat ID * * `InputEncryptedChat` **peer** - Secret chat ID
* * `DecryptedMessage` **message** - * * `DecryptedMessage` **message** -
* * `InputEncryptedFile` **file** - File attachment for the secret chat * * `InputEncryptedFile` **file** - File attachment for the secret chat
@ -1993,9 +1993,9 @@ interface messages
* Parameters: * Parameters:
* * `int` **folder_id** - Optional: [Peer folder ID, for more info click here](https://core.telegram.org/api/folders#peer-folders) * * `int` **folder_id** - Optional: [Peer folder ID, for more info click here](https://core.telegram.org/api/folders#peer-folders)
* * `string` **q** - Query * * `string` **q** - Query
* * `MessagesFilter` **filter** - * * `MessagesFilter` **filter** - Global search filter
* * `int` **min_date** - * * `int` **min_date** - If a positive value was specified, the method will return only messages with date bigger than min\_date
* * `int` **max_date** - * * `int` **max_date** - If a positive value was transferred, the method will return only messages with date smaller than max\_date
* * `int` **offset_rate** - Initially 0, then set to the [`next_rate` parameter of messages.messagesSlice](https://docs.madelineproto.xyz/API_docs/constructors/messages.messagesSlice.html) * * `int` **offset_rate** - Initially 0, then set to the [`next_rate` parameter of messages.messagesSlice](https://docs.madelineproto.xyz/API_docs/constructors/messages.messagesSlice.html)
* * `InputPeer` **offset_peer** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) * * `InputPeer` **offset_peer** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets)
* * `int` **offset_id** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) * * `int` **offset_id** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets)
@ -2137,7 +2137,7 @@ interface messages
* * `InputMedia` **media** - Optional: New attached media * * `InputMedia` **media** - Optional: New attached media
* * `ReplyMarkup` **reply_markup** - Optional: Reply markup for inline keyboards * * `ReplyMarkup` **reply_markup** - Optional: Reply markup for inline keyboards
* * `[MessageEntity]` **entities** - Optional: [Message entities for styled text](https://core.telegram.org/api/entities) * * `[MessageEntity]` **entities** - Optional: [Message entities for styled text](https://core.telegram.org/api/entities)
* * `int` **schedule_date** - Optional: Scheduled message date for scheduled messages * * `int` **schedule_date** - Optional: Scheduled message date for [scheduled messages](https://core.telegram.org/api/scheduled-messages)
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -2170,7 +2170,7 @@ interface messages
* * `InputPeer` **peer** - Where was the inline keyboard sent * * `InputPeer` **peer** - Where was the inline keyboard sent
* * `int` **msg_id** - ID of the Message with the inline keyboard * * `int` **msg_id** - ID of the Message with the inline keyboard
* * `bytes` **data** - Optional: Callback data * * `bytes` **data** - Optional: Callback data
* * `InputCheckPasswordSRP` **password** - Optional: * * `InputCheckPasswordSRP` **password** - Optional: For buttons [requiring you to verify your identity with your 2FA password](https://docs.madelineproto.xyz/API_docs/constructors/keyboardButtonCallback.html), the SRP payload generated using [SRP](https://core.telegram.org/api/srp).
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -2593,7 +2593,7 @@ interface messages
public function getRecentLocations($params); public function getRecentLocations($params);
/** /**
* Send an album of media. * Send an [album or grouped media](https://core.telegram.org/api/files#albums-grouped-media).
* *
* Parameters: * Parameters:
* * `boolean` **silent** - Optional: Whether to send the album silently (no notification triggered) * * `boolean` **silent** - Optional: Whether to send the album silently (no notification triggered)
@ -2676,10 +2676,10 @@ interface messages
* *
* Parameters: * Parameters:
* * `boolean` **silent** - Optional: Pin the message silently, without triggering a notification * * `boolean` **silent** - Optional: Pin the message silently, without triggering a notification
* * `boolean` **unpin** - Optional: * * `boolean` **unpin** - Optional: Whether the message should unpinned or pinned
* * `boolean` **pm_oneside** - Optional: * * `boolean` **pm_oneside** - Optional: Whether the message should only be pinned on the local side of a one-to-one chat
* * `InputPeer` **peer** - The peer where to pin the message * * `InputPeer` **peer** - The peer where to pin the message
* * `int` **id** - The message to pin, can be 0 to unpin any currently pinned messages * * `int` **id** - The message to pin or unpin
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -3006,18 +3006,18 @@ interface messages
public function getOldFeaturedStickers($params); public function getOldFeaturedStickers($params);
/** /**
* * Get messages in a reply thread.
* *
* Parameters: * Parameters:
* * `InputPeer` **peer** - * * `InputPeer` **peer** - Peer
* * `int` **msg_id** - * * `int` **msg_id** - Message ID
* * `int` **offset_id** - * * `int` **offset_id** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets)
* * `int` **offset_date** - * * `int` **offset_date** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets)
* * `int` **add_offset** - * * `int` **add_offset** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets)
* * `int` **limit** - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets)
* * `int` **max_id** - * * `int` **max_id** - If a positive value was transferred, the method will return only messages with ID smaller than max\_id
* * `int` **min_id** - * * `int` **min_id** - If a positive value was transferred, the method will return only messages with ID bigger than min\_id
* * `[int]` **hash** - Optional:. * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -3026,11 +3026,11 @@ interface messages
public function getReplies($params); public function getReplies($params);
/** /**
* * Get [discussion message](https://core.telegram.org/api/threads) from the [associated discussion group](https://core.telegram.org/api/discussion) of a channel to show it on top of the comment section, without actually joining the group.
* *
* Parameters: * Parameters:
* * `InputPeer` **peer** - * * `InputPeer` **peer** - [Channel ID](https://core.telegram.org/api/channel)
* * `int` **msg_id** -. * * `int` **msg_id** - Message ID
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -3039,12 +3039,12 @@ interface messages
public function getDiscussionMessage($params); public function getDiscussionMessage($params);
/** /**
* * Mark a [thread](https://core.telegram.org/api/threads) as read.
* *
* Parameters: * Parameters:
* * `InputPeer` **peer** - * * `InputPeer` **peer** - Group ID
* * `int` **msg_id** - * * `int` **msg_id** - ID of message that started the thread
* * `int` **read_max_id** -. * * `int` **read_max_id** - ID up to which thread messages were read
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -3053,10 +3053,10 @@ interface messages
public function readDiscussion($params); public function readDiscussion($params);
/** /**
* * [Unpin](https://core.telegram.org/api/pin) all pinned messages.
* *
* Parameters: * Parameters:
* * `InputPeer` **peer** -. * * `InputPeer` **peer** - Chat where to unpin
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -3125,8 +3125,8 @@ interface photos
* *
* Parameters: * Parameters:
* * `InputFile` **file** - Optional: File saved in parts by means of [upload.saveFilePart](https://docs.madelineproto.xyz/API_docs/methods/upload.saveFilePart.html) method * * `InputFile` **file** - Optional: File saved in parts by means of [upload.saveFilePart](https://docs.madelineproto.xyz/API_docs/methods/upload.saveFilePart.html) method
* * `InputFile` **video** - Optional: * * `InputFile` **video** - Optional: [Animated profile picture](https://core.telegram.org/api/files#animated-profile-pictures) video
* * `double` **video_start_ts** - Optional: * * `double` **video_start_ts** - Optional: Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview.
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -3479,10 +3479,10 @@ interface help
public function hidePromoData($params); public function hidePromoData($params);
/** /**
* * Dismiss a suggestion.
* *
* Parameters: * Parameters:
* * `string` **suggestion** -. * * `string` **suggestion** - Suggestion
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -3491,11 +3491,11 @@ interface help
public function dismissSuggestion($params); public function dismissSuggestion($params);
/** /**
* * Get name, ISO code, localized name and phone codes/patterns of all available countries.
* *
* Parameters: * Parameters:
* * `string` **lang_code** - * * `string` **lang_code** - Language code of the current user
* * `[int]` **hash** - Optional:. * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -3762,8 +3762,8 @@ interface channels
* Get link and embed info of a message in a [channel/supergroup](https://core.telegram.org/api/channel). * Get link and embed info of a message in a [channel/supergroup](https://core.telegram.org/api/channel).
* *
* Parameters: * Parameters:
* * `boolean` **grouped** - Optional: * * `boolean` **grouped** - Optional: Whether to include other grouped media (for albums)
* * `boolean` **thread** - Optional: * * `boolean` **thread** - Optional: Whether to also include a thread ID, if available, inside of the link
* * `InputChannel` **channel** - Channel * * `InputChannel` **channel** - Channel
* * `int` **id** - Message ID * * `int` **id** - Message ID
* *
@ -3896,18 +3896,21 @@ interface channels
public function getLeftChannels($params); public function getLeftChannels($params);
/** /**
* Get all groups that can be used as [discussion groups](https://telegram.org/blog/privacy-discussions-web-bots). * Get all groups that can be used as [discussion groups](https://core.telegram.org/api/discussion).
*
* Returned [legacy group chats](https://core.telegram.org/api/channel) must be first upgraded to [supergroups](https://core.telegram.org/api/channel) before they can be set as a discussion group.
* To set a returned supergroup as a discussion group, access to its old messages must be enabled using [channels.togglePreHistoryHidden](https://docs.madelineproto.xyz/API_docs/methods/channels.togglePreHistoryHidden.html), first.
* *
* @return messages.Chats * @return messages.Chats
*/ */
public function getGroupsForDiscussion(); public function getGroupsForDiscussion();
/** /**
* Associate a group to a channel as [discussion group](https://telegram.org/blog/privacy-discussions-web-bots) for that channel. * Associate a group to a channel as [discussion group](https://core.telegram.org/api/discussion) for that channel.
* *
* Parameters: * Parameters:
* * `InputChannel` **broadcast** - Channel * * `InputChannel` **broadcast** - Channel
* * `InputChannel` **group** - Discussion group to associate to the channel * * `InputChannel` **group** - [Discussion group](https://core.telegram.org/api/discussion) to associate to the channel
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -4275,11 +4278,11 @@ interface phone
public function saveCallDebug($params); public function saveCallDebug($params);
/** /**
* * Send VoIP signaling data.
* *
* Parameters: * Parameters:
* * `InputPhoneCall` **peer** - * * `InputPhoneCall` **peer** - Phone call
* * `bytes` **data** -. * * `bytes` **data** - Signaling payload
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -4413,11 +4416,11 @@ interface stats
public function loadAsyncGraph($params); public function loadAsyncGraph($params);
/** /**
* * Get [supergroup statistics](https://core.telegram.org/api/stats).
* *
* Parameters: * Parameters:
* * `boolean` **dark** - Optional: * * `boolean` **dark** - Optional: Whether to enable dark theme for graph colors
* * `InputChannel` **channel** -. * * `InputChannel` **channel** - [Supergroup ID](https://core.telegram.org/api/channel)
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -4426,15 +4429,16 @@ interface stats
public function getMegagroupStats($params); public function getMegagroupStats($params);
/** /**
* * Obtains a list of messages, indicating to which other public channels was a channel message forwarded.
* Will return a list of [messages](https://docs.madelineproto.xyz/API_docs/constructors/message.html) with `peer_id` equal to the public channel to which this message was forwarded.
* *
* Parameters: * Parameters:
* * `InputChannel` **channel** - * * `InputChannel` **channel** - Source channel
* * `int` **msg_id** - * * `int` **msg_id** - Source message ID
* * `int` **offset_rate** - * * `int` **offset_rate** - Initially 0, then set to the `next_rate` parameter of [messages.messagesSlice](https://docs.madelineproto.xyz/API_docs/constructors/messages.messagesSlice.html)
* * `InputPeer` **offset_peer** - * * `InputPeer` **offset_peer** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets)
* * `int` **offset_id** - * * `int` **offset_id** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets)
* * `int` **limit** -. * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets)
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -4443,12 +4447,12 @@ interface stats
public function getMessagePublicForwards($params); public function getMessagePublicForwards($params);
/** /**
* * Get [message statistics](https://core.telegram.org/api/stats).
* *
* Parameters: * Parameters:
* * `boolean` **dark** - Optional: * * `boolean` **dark** - Optional: Whether to enable dark theme for graph colors
* * `InputChannel` **channel** - * * `InputChannel` **channel** - Channel ID
* * `int` **msg_id** -. * * `int` **msg_id** - Message ID
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -4705,9 +4709,9 @@ class InternalDoc extends APIFactory
* *
* @return void * @return void
*/ */
public function closeConnection($message = 'OK!', array $extra = []) public function closeConnection($message = 'OK!')
{ {
return $this->__call(__FUNCTION__, [$message, $extra]); return $this->__call(__FUNCTION__, [$message]);
} }
/** /**
* Complete 2FA login. * Complete 2FA login.
@ -4991,7 +4995,7 @@ class InternalDoc extends APIFactory
* @param ?Promise $token Cancellation token * @param ?Promise $token Cancellation token
* @param ?callable $failureCb Failure callback, called only once if the first locking attempt fails. * @param ?callable $failureCb Failure callback, called only once if the first locking attempt fails.
* *
* @return \Amp\Promise<?callable> * @return \Amp\Promise<$token is null ? callable : ?callable>
*/ */
public function flock(string $file, int $operation, float $polling = 0.1, ?\Amp\Promise $token = null, $failureCb = null) public function flock(string $file, int $operation, float $polling = 0.1, ?\Amp\Promise $token = null, $failureCb = null)
{ {
@ -5598,6 +5602,16 @@ class InternalDoc extends APIFactory
{ {
return $this->__call(__FUNCTION__, []); return $this->__call(__FUNCTION__, []);
} }
/**
* Whether we're an IPC server process (as opposed to an event handler).
*
* @psalm-return bool|\Amp\Promise<bool>
* @return mixed
*/
public function isIpcWorker()
{
return $this->__call(__FUNCTION__, []);
}
/** /**
* Check whether provided bot API ID is a channel. * Check whether provided bot API ID is a channel.
* *

View File

@ -19,10 +19,8 @@
namespace danog\MadelineProto\Loop\Connection; namespace danog\MadelineProto\Loop\Connection;
use Amp\Deferred;
use Amp\Loop; use Amp\Loop;
use danog\Loop\ResumableSignalLoop; use danog\Loop\ResumableSignalLoop;
use danog\MadelineProto\Tools;
/** /**
* Message cleanup loop. * Message cleanup loop.

View File

@ -1365,6 +1365,15 @@ class MTProto extends AsyncConstruct implements TLCallback
{ {
return false; return false;
} }
/**
* Whether we're an IPC server process (as opposed to an event handler).
*
* @return boolean
*/
public function isIpcWorker(): bool
{
return Magic::$isIpcWorker;
}
/** /**
* Parse, update and store settings. * Parse, update and store settings.
* *

View File

@ -106,7 +106,7 @@ class SessionPaths
$l += yield $file->write($object); $l += yield $file->write($object);
yield $file->close(); yield $file->close();
if ($l !== ($need = strlen(Serialization::PHP_HEADER)+1+strlen($object))) { if ($l !== ($need = \strlen(Serialization::PHP_HEADER)+1+\strlen($object))) {
throw new Exception("Did not write all the data (need $need, wrote $l)"); throw new Exception("Did not write all the data (need $need, wrote $l)");
} }
yield renameAsync("$path.temp.php", $path); yield renameAsync("$path.temp.php", $path);

View File

@ -1088,7 +1088,7 @@ class InternalDoc extends APIFactory
* @param ?Promise $token Cancellation token * @param ?Promise $token Cancellation token
* @param ?callable $failureCb Failure callback, called only once if the first locking attempt fails. * @param ?callable $failureCb Failure callback, called only once if the first locking attempt fails.
* *
* @return \Amp\Promise<?callable> * @return \Amp\Promise<$token is null ? callable : ?callable>
*/ */
public function flock(string $file, int $operation, float $polling = 0.1, ?\Amp\Promise $token = null, $failureCb = null) public function flock(string $file, int $operation, float $polling = 0.1, ?\Amp\Promise $token = null, $failureCb = null)
{ {