2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 21:07:59 +00:00

Type hint on_message decorator

This commit is contained in:
Dan 2018-12-24 14:50:04 +01:00
parent 7881320a88
commit 6e964b51b1

View File

@ -16,8 +16,11 @@
# 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/>.
from typing import Tuple
import pyrogram import pyrogram
from pyrogram.client.filters.filter import Filter from pyrogram.client.filters.filter import Filter
from pyrogram.client.handlers.handler import Handler
from ...ext import BaseClient from ...ext import BaseClient
@ -45,7 +48,7 @@ class OnMessage(BaseClient):
The group identifier, defaults to 0. The group identifier, defaults to 0.
""" """
def decorator(func): def decorator(func: callable) -> Tuple[Handler, int]:
if isinstance(func, tuple): if isinstance(func, tuple):
func = func[0].callback func = func[0].callback