mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 20:59:29 +00:00
Allow on_deleted_messages to be used as a static decorator
This commit is contained in:
parent
54296a6fda
commit
6fdb90e4a4
@ -17,6 +17,7 @@
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pyrogram
|
||||
from pyrogram.client.filters.filter import Filter
|
||||
from ...ext import BaseClient
|
||||
|
||||
|
||||
@ -36,7 +37,14 @@ class OnDeletedMessages(BaseClient):
|
||||
"""
|
||||
|
||||
def decorator(func):
|
||||
self.add_handler(pyrogram.DeletedMessagesHandler(func, filters), group)
|
||||
return func
|
||||
handler = pyrogram.DeletedMessagesHandler(func, filters)
|
||||
|
||||
if isinstance(self, Filter):
|
||||
return pyrogram.DeletedMessagesHandler(func, self), group if filters is None else filters
|
||||
|
||||
if self is not None:
|
||||
self.add_handler(handler, group)
|
||||
|
||||
return handler, group
|
||||
|
||||
return decorator
|
||||
|
Loading…
Reference in New Issue
Block a user