mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 13:27:47 +00:00
Use a better name for the special plugin attribute when decorating funcs
This commit is contained in:
parent
5fe8fba3df
commit
e1197e066e
@ -1108,7 +1108,7 @@ class Client(Methods, BaseClient):
|
|||||||
for name in vars(module).keys():
|
for name in vars(module).keys():
|
||||||
# noinspection PyBroadException
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
handler, group = getattr(module, name).pyrogram_plugin
|
handler, group = getattr(module, name).handler
|
||||||
|
|
||||||
if isinstance(handler, Handler) and isinstance(group, int):
|
if isinstance(handler, Handler) and isinstance(group, int):
|
||||||
self.add_handler(handler, group)
|
self.add_handler(handler, group)
|
||||||
@ -1143,7 +1143,7 @@ class Client(Methods, BaseClient):
|
|||||||
for name in handlers:
|
for name in handlers:
|
||||||
# noinspection PyBroadException
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
handler, group = getattr(module, name).pyrogram_plugin
|
handler, group = getattr(module, name).handler
|
||||||
|
|
||||||
if isinstance(handler, Handler) and isinstance(group, int):
|
if isinstance(handler, Handler) and isinstance(group, int):
|
||||||
self.add_handler(handler, group)
|
self.add_handler(handler, group)
|
||||||
@ -1181,7 +1181,7 @@ class Client(Methods, BaseClient):
|
|||||||
for name in handlers:
|
for name in handlers:
|
||||||
# noinspection PyBroadException
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
handler, group = getattr(module, name).pyrogram_plugin
|
handler, group = getattr(module, name).handler
|
||||||
|
|
||||||
if isinstance(handler, Handler) and isinstance(group, int):
|
if isinstance(handler, Handler) and isinstance(group, int):
|
||||||
self.remove_handler(handler, group)
|
self.remove_handler(handler, group)
|
||||||
|
@ -47,7 +47,7 @@ class OnCallbackQuery(BaseClient):
|
|||||||
if isinstance(self, pyrogram.Client):
|
if isinstance(self, pyrogram.Client):
|
||||||
self.add_handler(pyrogram.CallbackQueryHandler(func, filters), group)
|
self.add_handler(pyrogram.CallbackQueryHandler(func, filters), group)
|
||||||
elif isinstance(self, Filter) or self is None:
|
elif isinstance(self, Filter) or self is None:
|
||||||
func.pyrogram_plugin = (
|
func.handler = (
|
||||||
pyrogram.CallbackQueryHandler(func, self),
|
pyrogram.CallbackQueryHandler(func, self),
|
||||||
group if filters is None else filters
|
group if filters is None else filters
|
||||||
)
|
)
|
||||||
|
@ -47,7 +47,7 @@ class OnDeletedMessages(BaseClient):
|
|||||||
if isinstance(self, pyrogram.Client):
|
if isinstance(self, pyrogram.Client):
|
||||||
self.add_handler(pyrogram.DeletedMessagesHandler(func, filters), group)
|
self.add_handler(pyrogram.DeletedMessagesHandler(func, filters), group)
|
||||||
elif isinstance(self, Filter) or self is None:
|
elif isinstance(self, Filter) or self is None:
|
||||||
func.pyrogram_plugin = (
|
func.handler = (
|
||||||
pyrogram.DeletedMessagesHandler(func, self),
|
pyrogram.DeletedMessagesHandler(func, self),
|
||||||
group if filters is None else filters
|
group if filters is None else filters
|
||||||
)
|
)
|
||||||
|
@ -46,7 +46,7 @@ class OnInlineQuery(BaseClient):
|
|||||||
if isinstance(self, pyrogram.Client):
|
if isinstance(self, pyrogram.Client):
|
||||||
self.add_handler(pyrogram.InlineQueryHandler(func, filters), group)
|
self.add_handler(pyrogram.InlineQueryHandler(func, filters), group)
|
||||||
elif isinstance(self, Filter) or self is None:
|
elif isinstance(self, Filter) or self is None:
|
||||||
func.pyrogram_plugin = (
|
func.handler = (
|
||||||
pyrogram.InlineQueryHandler(func, self),
|
pyrogram.InlineQueryHandler(func, self),
|
||||||
group if filters is None else filters
|
group if filters is None else filters
|
||||||
)
|
)
|
||||||
|
@ -46,7 +46,7 @@ class OnMessage(BaseClient):
|
|||||||
if isinstance(self, pyrogram.Client):
|
if isinstance(self, pyrogram.Client):
|
||||||
self.add_handler(pyrogram.MessageHandler(func, filters), group)
|
self.add_handler(pyrogram.MessageHandler(func, filters), group)
|
||||||
elif isinstance(self, Filter) or self is None:
|
elif isinstance(self, Filter) or self is None:
|
||||||
func.pyrogram_plugin = (
|
func.handler = (
|
||||||
pyrogram.MessageHandler(func, self),
|
pyrogram.MessageHandler(func, self),
|
||||||
group if filters is None else filters
|
group if filters is None else filters
|
||||||
)
|
)
|
||||||
|
@ -46,7 +46,7 @@ class OnPoll(BaseClient):
|
|||||||
if isinstance(self, pyrogram.Client):
|
if isinstance(self, pyrogram.Client):
|
||||||
self.add_handler(pyrogram.PollHandler(func, filters), group)
|
self.add_handler(pyrogram.PollHandler(func, filters), group)
|
||||||
elif isinstance(self, Filter) or self is None:
|
elif isinstance(self, Filter) or self is None:
|
||||||
func.pyrogram_plugin = (
|
func.handler = (
|
||||||
pyrogram.PollHandler(func, self),
|
pyrogram.PollHandler(func, self),
|
||||||
group if filters is None else filters
|
group if filters is None else filters
|
||||||
)
|
)
|
||||||
|
@ -40,7 +40,7 @@ class OnRawUpdate(BaseClient):
|
|||||||
if isinstance(self, pyrogram.Client):
|
if isinstance(self, pyrogram.Client):
|
||||||
self.add_handler(pyrogram.RawUpdateHandler(func), group)
|
self.add_handler(pyrogram.RawUpdateHandler(func), group)
|
||||||
else:
|
else:
|
||||||
func.pyrogram_plugin = (
|
func.handler = (
|
||||||
pyrogram.RawUpdateHandler(func),
|
pyrogram.RawUpdateHandler(func),
|
||||||
group if self is None else group
|
group if self is None else group
|
||||||
)
|
)
|
||||||
|
@ -44,7 +44,7 @@ class OnUserStatus(BaseClient):
|
|||||||
if isinstance(self, pyrogram.Client):
|
if isinstance(self, pyrogram.Client):
|
||||||
self.add_handler(pyrogram.UserStatusHandler(func, filters), group)
|
self.add_handler(pyrogram.UserStatusHandler(func, filters), group)
|
||||||
elif isinstance(self, Filter) or self is None:
|
elif isinstance(self, Filter) or self is None:
|
||||||
func.pyrogram_plugin = (
|
func.handler = (
|
||||||
pyrogram.UserStatusHandler(func, self),
|
pyrogram.UserStatusHandler(func, self),
|
||||||
group if filters is None else filters
|
group if filters is None else filters
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user