mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-17 21:22:40 +00:00
Merge branch 'develop' into asyncio
# Conflicts: # pyrogram/client/methods/chats/get_chat_members.py
This commit is contained in:
commit
b94f6d4e99
@ -16,12 +16,17 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
import logging
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
|
from pyrogram.errors import FloodWait
|
||||||
from ...ext import BaseClient
|
from ...ext import BaseClient
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Filters:
|
class Filters:
|
||||||
ALL = "all"
|
ALL = "all"
|
||||||
@ -116,6 +121,8 @@ class GetChatMembers(BaseClient):
|
|||||||
else:
|
else:
|
||||||
raise ValueError("Invalid filter \"{}\"".format(filter))
|
raise ValueError("Invalid filter \"{}\"".format(filter))
|
||||||
|
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
return pyrogram.ChatMembers._parse(
|
return pyrogram.ChatMembers._parse(
|
||||||
self,
|
self,
|
||||||
await self.send(
|
await self.send(
|
||||||
@ -128,5 +135,8 @@ class GetChatMembers(BaseClient):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
except FloodWait as e:
|
||||||
|
log.warning("Sleeping for {}s".format(e.x))
|
||||||
|
await asyncio.sleep(e.x)
|
||||||
else:
|
else:
|
||||||
raise ValueError("The chat_id \"{}\" belongs to a user".format(chat_id))
|
raise ValueError("The chat_id \"{}\" belongs to a user".format(chat_id))
|
||||||
|
Loading…
Reference in New Issue
Block a user