diff --git a/pyrogram/client.py b/pyrogram/client.py index ca0440aa..56849611 100644 --- a/pyrogram/client.py +++ b/pyrogram/client.py @@ -18,6 +18,7 @@ import asyncio import functools +import inspect import logging import os import re @@ -1025,7 +1026,7 @@ class Client(Methods, Scaffold): offset += limit if progress: - if asyncio.iscoroutinefunction(progress): + if inspect.iscoroutinefunction(progress): await progress( min(offset, file_size) if file_size != 0 else offset, file_size, diff --git a/pyrogram/dispatcher.py b/pyrogram/dispatcher.py index 00c51349..2541214e 100644 --- a/pyrogram/dispatcher.py +++ b/pyrogram/dispatcher.py @@ -17,6 +17,7 @@ # along with Pyrogram. If not, see . import asyncio +import inspect import logging from collections import OrderedDict @@ -203,7 +204,7 @@ class Dispatcher: continue try: - if asyncio.iscoroutinefunction(handler.callback): + if inspect.iscoroutinefunction(handler.callback): await handler.callback(self.client, *args) else: await self.loop.run_in_executor( diff --git a/pyrogram/methods/advanced/save_file.py b/pyrogram/methods/advanced/save_file.py index 4bdaedf5..a9bc5c79 100644 --- a/pyrogram/methods/advanced/save_file.py +++ b/pyrogram/methods/advanced/save_file.py @@ -18,6 +18,7 @@ import asyncio import functools +import inspect import io import logging import math @@ -182,7 +183,7 @@ class SaveFile(Scaffold): file_part += 1 if progress: - if asyncio.iscoroutinefunction(progress): + if inspect.iscoroutinefunction(progress): await progress(min(file_part * part_size, file_size), file_size, *progress_args) else: func = functools.partial(