2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-09-10 11:15:27 +00:00

Make plugin callback functions return the function itself when decorated

This commit is contained in:
Dan
2019-06-23 01:33:46 +02:00
parent b4f0f411bd
commit 31f39a00ab
9 changed files with 79 additions and 108 deletions

View File

@@ -1106,7 +1106,7 @@ class Client(Methods, BaseClient):
for name in vars(module).keys():
# noinspection PyBroadException
try:
handler, group = getattr(module, name)
handler, group = getattr(module, name).pyrogram_plugin
if isinstance(handler, Handler) and isinstance(group, int):
self.add_handler(handler, group)
@@ -1141,7 +1141,7 @@ class Client(Methods, BaseClient):
for name in handlers:
# noinspection PyBroadException
try:
handler, group = getattr(module, name)
handler, group = getattr(module, name).pyrogram_plugin
if isinstance(handler, Handler) and isinstance(group, int):
self.add_handler(handler, group)
@@ -1179,7 +1179,7 @@ class Client(Methods, BaseClient):
for name in handlers:
# noinspection PyBroadException
try:
handler, group = getattr(module, name)
handler, group = getattr(module, name).pyrogram_plugin
if isinstance(handler, Handler) and isinstance(group, int):
self.remove_handler(handler, group)