Merge develop -> asyncio-dev
This commit is contained in:
commit
d8dfac7e89
@ -335,6 +335,7 @@ updateMessagePollVote#42f88f2c poll_id:long user_id:int options:Vector<bytes> =
|
|||||||
updateDialogFilter#26ffde7d flags:# id:int filter:flags.0?DialogFilter = Update;
|
updateDialogFilter#26ffde7d flags:# id:int filter:flags.0?DialogFilter = Update;
|
||||||
updateDialogFilterOrder#a5d72105 order:Vector<int> = Update;
|
updateDialogFilterOrder#a5d72105 order:Vector<int> = Update;
|
||||||
updateDialogFilters#3504914f = Update;
|
updateDialogFilters#3504914f = Update;
|
||||||
|
updatePhoneCallSignalingData#2661bf09 phone_call_id:long data:bytes = Update;
|
||||||
|
|
||||||
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
|
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
|
||||||
|
|
||||||
@ -399,7 +400,7 @@ inputDocumentEmpty#72f0eaae = InputDocument;
|
|||||||
inputDocument#1abfb575 id:long access_hash:long file_reference:bytes = InputDocument;
|
inputDocument#1abfb575 id:long access_hash:long file_reference:bytes = InputDocument;
|
||||||
|
|
||||||
documentEmpty#36f8c871 id:long = Document;
|
documentEmpty#36f8c871 id:long = Document;
|
||||||
document#9ba29cc1 flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumbs:flags.0?Vector<PhotoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document;
|
document#1e87342b flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumbs:flags.0?Vector<PhotoSize> video_thumbs:flags.1?Vector<VideoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document;
|
||||||
|
|
||||||
help.support#17c6b5f6 phone_number:string user:User = help.Support;
|
help.support#17c6b5f6 phone_number:string user:User = help.Support;
|
||||||
|
|
||||||
@ -629,7 +630,7 @@ messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_off
|
|||||||
|
|
||||||
exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink;
|
exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink;
|
||||||
|
|
||||||
messageFwdHeader#ec338270 flags:# from_id:flags.0?int from_name:flags.5?string date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int = MessageFwdHeader;
|
messageFwdHeader#353a686b flags:# from_id:flags.0?int from_name:flags.5?string date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int psa_type:flags.6?string = MessageFwdHeader;
|
||||||
|
|
||||||
auth.codeTypeSms#72a3158c = auth.CodeType;
|
auth.codeTypeSms#72a3158c = auth.CodeType;
|
||||||
auth.codeTypeCall#741cd3e3 = auth.CodeType;
|
auth.codeTypeCall#741cd3e3 = auth.CodeType;
|
||||||
@ -890,9 +891,6 @@ fileHash#6242c773 offset:int limit:int hash:bytes = FileHash;
|
|||||||
|
|
||||||
inputClientProxy#75588b3f address:string port:int = InputClientProxy;
|
inputClientProxy#75588b3f address:string port:int = InputClientProxy;
|
||||||
|
|
||||||
help.proxyDataEmpty#e09e1fb8 expires:int = help.ProxyData;
|
|
||||||
help.proxyDataPromo#2bf7ee23 expires:int peer:Peer chats:Vector<Chat> users:Vector<User> = help.ProxyData;
|
|
||||||
|
|
||||||
help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate;
|
help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate;
|
||||||
help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate;
|
help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate;
|
||||||
|
|
||||||
@ -1118,6 +1116,11 @@ messageInteractionCounters#ad4fc9bd msg_id:int views:int forwards:int = MessageI
|
|||||||
|
|
||||||
stats.broadcastStats#bdf78394 period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph recent_message_interactions:Vector<MessageInteractionCounters> = stats.BroadcastStats;
|
stats.broadcastStats#bdf78394 period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph recent_message_interactions:Vector<MessageInteractionCounters> = stats.BroadcastStats;
|
||||||
|
|
||||||
|
help.promoDataEmpty#98f6ac75 expires:int = help.PromoData;
|
||||||
|
help.promoData#8c39793f flags:# proxy:flags.0?true expires:int peer:Peer chats:Vector<Chat> users:Vector<User> psa_type:flags.1?string psa_message:flags.2?string = help.PromoData;
|
||||||
|
|
||||||
|
videoSize#435bb987 type:string location:FileLocation w:int h:int size:int = VideoSize;
|
||||||
|
|
||||||
---functions---
|
---functions---
|
||||||
|
|
||||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||||
@ -1389,7 +1392,6 @@ help.getAppChangelog#9010ef6f prev_app_version:string = Updates;
|
|||||||
help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool;
|
help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool;
|
||||||
help.getCdnConfig#52029342 = CdnConfig;
|
help.getCdnConfig#52029342 = CdnConfig;
|
||||||
help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls;
|
help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls;
|
||||||
help.getProxyData#3d7758e1 = help.ProxyData;
|
|
||||||
help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate;
|
help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate;
|
||||||
help.acceptTermsOfService#ee72f79a id:DataJSON = Bool;
|
help.acceptTermsOfService#ee72f79a id:DataJSON = Bool;
|
||||||
help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo;
|
help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo;
|
||||||
@ -1399,6 +1401,8 @@ help.getPassportConfig#c661ad08 hash:int = help.PassportConfig;
|
|||||||
help.getSupportName#d360e72c = help.SupportName;
|
help.getSupportName#d360e72c = help.SupportName;
|
||||||
help.getUserInfo#38a08d3 user_id:InputUser = help.UserInfo;
|
help.getUserInfo#38a08d3 user_id:InputUser = help.UserInfo;
|
||||||
help.editUserInfo#66b91b70 user_id:InputUser message:string entities:Vector<MessageEntity> = help.UserInfo;
|
help.editUserInfo#66b91b70 user_id:InputUser message:string entities:Vector<MessageEntity> = help.UserInfo;
|
||||||
|
help.getPromoData#c0977421 = help.PromoData;
|
||||||
|
help.hidePromoData#1e251c95 peer:InputPeer = Bool;
|
||||||
|
|
||||||
channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;
|
channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;
|
||||||
channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;
|
channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;
|
||||||
@ -1462,6 +1466,7 @@ phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool;
|
|||||||
phone.discardCall#b2cbc1c0 flags:# video:flags.0?true peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates;
|
phone.discardCall#b2cbc1c0 flags:# video:flags.0?true peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates;
|
||||||
phone.setCallRating#59ead627 flags:# user_initiative:flags.0?true peer:InputPhoneCall rating:int comment:string = Updates;
|
phone.setCallRating#59ead627 flags:# user_initiative:flags.0?true peer:InputPhoneCall rating:int comment:string = Updates;
|
||||||
phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool;
|
phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool;
|
||||||
|
phone.sendSignalingData#ff7a9383 peer:InputPhoneCall data:bytes = Bool;
|
||||||
|
|
||||||
langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference;
|
langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference;
|
||||||
langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector<string> = Vector<LangPackString>;
|
langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector<string> = Vector<LangPackString>;
|
||||||
@ -1472,7 +1477,7 @@ langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLangua
|
|||||||
folders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates;
|
folders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates;
|
||||||
folders.deleteFolder#1c295881 folder_id:int = Updates;
|
folders.deleteFolder#1c295881 folder_id:int = Updates;
|
||||||
|
|
||||||
stats.getBroadcastStats#e6300dba flags:# dark:flags.0?true channel:InputChannel tz_offset:int = stats.BroadcastStats;
|
stats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats;
|
||||||
stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph;
|
stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph;
|
||||||
|
|
||||||
// LAYER 112
|
// LAYER 114
|
@ -38,7 +38,7 @@ from pyrogram.client.methods.password.utils import compute_check
|
|||||||
from pyrogram.crypto import AES
|
from pyrogram.crypto import AES
|
||||||
from pyrogram.errors import (
|
from pyrogram.errors import (
|
||||||
PhoneMigrate, NetworkMigrate, SessionPasswordNeeded,
|
PhoneMigrate, NetworkMigrate, SessionPasswordNeeded,
|
||||||
FloodWait, PeerIdInvalid, VolumeLocNotFound, UserMigrate, ChannelPrivate, AuthBytesInvalid,
|
PeerIdInvalid, VolumeLocNotFound, UserMigrate, ChannelPrivate, AuthBytesInvalid,
|
||||||
BadRequest)
|
BadRequest)
|
||||||
from pyrogram.session import Auth, Session
|
from pyrogram.session import Auth, Session
|
||||||
from .ext import utils, Syncer, BaseClient, Dispatcher
|
from .ext import utils, Syncer, BaseClient, Dispatcher
|
||||||
@ -320,7 +320,7 @@ class Client(Methods, BaseClient):
|
|||||||
for _ in range(Client.UPDATES_WORKERS):
|
for _ in range(Client.UPDATES_WORKERS):
|
||||||
self.updates_worker_tasks.append(
|
self.updates_worker_tasks.append(
|
||||||
asyncio.ensure_future(self.updates_worker())
|
asyncio.ensure_future(self.updates_worker())
|
||||||
)
|
)
|
||||||
|
|
||||||
logging.info("Started {} UpdatesWorkerTasks".format(Client.UPDATES_WORKERS))
|
logging.info("Started {} UpdatesWorkerTasks".format(Client.UPDATES_WORKERS))
|
||||||
|
|
||||||
@ -689,9 +689,6 @@ class Client(Methods, BaseClient):
|
|||||||
print(e.MESSAGE)
|
print(e.MESSAGE)
|
||||||
self.phone_number = None
|
self.phone_number = None
|
||||||
self.bot_token = None
|
self.bot_token = None
|
||||||
except FloodWait as e:
|
|
||||||
print(e.MESSAGE.format(x=e.x))
|
|
||||||
time.sleep(e.x)
|
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -740,9 +737,6 @@ class Client(Methods, BaseClient):
|
|||||||
return await self.recover_password(recovery_code)
|
return await self.recover_password(recovery_code)
|
||||||
except BadRequest as e:
|
except BadRequest as e:
|
||||||
print(e.MESSAGE)
|
print(e.MESSAGE)
|
||||||
except FloodWait as e:
|
|
||||||
print(e.MESSAGE.format(x=e.x))
|
|
||||||
time.sleep(e.x)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error(e, exc_info=True)
|
log.error(e, exc_info=True)
|
||||||
raise
|
raise
|
||||||
@ -753,12 +747,6 @@ class Client(Methods, BaseClient):
|
|||||||
except BadRequest as e:
|
except BadRequest as e:
|
||||||
print(e.MESSAGE)
|
print(e.MESSAGE)
|
||||||
self.password = None
|
self.password = None
|
||||||
except FloodWait as e:
|
|
||||||
print(e.MESSAGE.format(x=e.x))
|
|
||||||
time.sleep(e.x)
|
|
||||||
except FloodWait as e:
|
|
||||||
print(e.MESSAGE.format(x=e.x))
|
|
||||||
time.sleep(e.x)
|
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -778,9 +766,6 @@ class Client(Methods, BaseClient):
|
|||||||
)
|
)
|
||||||
except BadRequest as e:
|
except BadRequest as e:
|
||||||
print(e.MESSAGE)
|
print(e.MESSAGE)
|
||||||
except FloodWait as e:
|
|
||||||
print(e.MESSAGE.format(x=e.x))
|
|
||||||
time.sleep(e.x)
|
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -884,6 +869,7 @@ class Client(Methods, BaseClient):
|
|||||||
|
|
||||||
app.stop()
|
app.stop()
|
||||||
"""
|
"""
|
||||||
|
|
||||||
async def do_it():
|
async def do_it():
|
||||||
await self.terminate()
|
await self.terminate()
|
||||||
await self.disconnect()
|
await self.disconnect()
|
||||||
@ -930,6 +916,7 @@ class Client(Methods, BaseClient):
|
|||||||
|
|
||||||
app.stop()
|
app.stop()
|
||||||
"""
|
"""
|
||||||
|
|
||||||
async def do_it():
|
async def do_it():
|
||||||
await self.stop()
|
await self.stop()
|
||||||
await self.start()
|
await self.start()
|
||||||
@ -1637,38 +1624,6 @@ class Client(Methods, BaseClient):
|
|||||||
log.warning('[{}] No plugin loaded from "{}"'.format(
|
log.warning('[{}] No plugin loaded from "{}"'.format(
|
||||||
self.session_name, root))
|
self.session_name, root))
|
||||||
|
|
||||||
# def get_initial_dialogs_chunk(self, offset_date: int = 0):
|
|
||||||
# while True:
|
|
||||||
# try:
|
|
||||||
# r = self.send(
|
|
||||||
# functions.messages.GetDialogs(
|
|
||||||
# offset_date=offset_date,
|
|
||||||
# offset_id=0,
|
|
||||||
# offset_peer=types.InputPeerEmpty(),
|
|
||||||
# limit=self.DIALOGS_AT_ONCE,
|
|
||||||
# hash=0,
|
|
||||||
# exclude_pinned=True
|
|
||||||
# )
|
|
||||||
# )
|
|
||||||
# except FloodWait as e:
|
|
||||||
# log.warning("get_dialogs flood: waiting {} seconds".format(e.x))
|
|
||||||
# time.sleep(e.x)
|
|
||||||
# else:
|
|
||||||
# log.info("Total peers: {}".format(self.storage.peers_count))
|
|
||||||
# return r
|
|
||||||
#
|
|
||||||
# def get_initial_dialogs(self):
|
|
||||||
# self.send(functions.messages.GetPinnedDialogs(folder_id=0))
|
|
||||||
#
|
|
||||||
# dialogs = self.get_initial_dialogs_chunk()
|
|
||||||
# offset_date = utils.get_offset_date(dialogs)
|
|
||||||
#
|
|
||||||
# while len(dialogs.dialogs) == self.DIALOGS_AT_ONCE:
|
|
||||||
# dialogs = self.get_initial_dialogs_chunk(offset_date)
|
|
||||||
# offset_date = utils.get_offset_date(dialogs)
|
|
||||||
#
|
|
||||||
# self.get_initial_dialogs_chunk()
|
|
||||||
|
|
||||||
async def resolve_peer(self, peer_id: Union[int, str]):
|
async def resolve_peer(self, peer_id: Union[int, str]):
|
||||||
"""Get the InputPeer of a known peer id.
|
"""Get the InputPeer of a known peer id.
|
||||||
Useful whenever an InputPeer type is required.
|
Useful whenever an InputPeer type is required.
|
||||||
|
@ -22,7 +22,6 @@ from typing import List
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import functions
|
from pyrogram.api import functions
|
||||||
from pyrogram.errors import FloodWait
|
|
||||||
from ...ext import BaseClient
|
from ...ext import BaseClient
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -41,11 +40,5 @@ class GetContacts(BaseClient):
|
|||||||
contacts = app.get_contacts()
|
contacts = app.get_contacts()
|
||||||
print(contacts)
|
print(contacts)
|
||||||
"""
|
"""
|
||||||
while True:
|
contacts = await self.send(functions.contacts.GetContacts(hash=0))
|
||||||
try:
|
return pyrogram.List(pyrogram.User._parse(self, user) for user in contacts.users)
|
||||||
contacts = await self.send(functions.contacts.GetContacts(hash=0))
|
|
||||||
except FloodWait as e:
|
|
||||||
log.warning("get_contacts flood: waiting {} seconds".format(e.x))
|
|
||||||
await asyncio.sleep(e.x)
|
|
||||||
else:
|
|
||||||
return pyrogram.List(pyrogram.User._parse(self, user) for user in contacts.users)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user