Skip to content

Commit

Permalink
fix(lockings): lower listener priority
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMissx committed Apr 14, 2024
1 parent ba09c21 commit 0404330
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions anjani/plugins/lockings.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
)
from pyrogram.types import Chat, ChatPermissions, Message

from anjani import command, filters, plugin, util
from anjani import command, filters, listener, plugin, util


async def anon(_: Client, message: Message) -> bool:
Expand Down Expand Up @@ -133,6 +133,7 @@ async def on_plugin_backup(self, chat_id: int) -> MutableMapping[str, Any]:
async def on_plugin_restore(self, chat_id: int, data: MutableMapping[str, Any]) -> None:
await self.db.update_one({"chat_id": chat_id}, {"$set": data[self.name]}, upsert=True)

@listener.priority(95)
async def on_message(self, message: Message) -> None:
if message.outgoing:
return
Expand Down Expand Up @@ -163,9 +164,9 @@ async def on_message(self, message: Message) -> None:
locked = await self.get_chat_restrictions(chat.id)
for lock_type in locked:
try:
func: Union[str, Callable[[Client, Message], Coroutine[Any, Any, bool]]] = (
LOCK_TYPES[lock_type]
)
func: Union[
str, Callable[[Client, Message], Coroutine[Any, Any, bool]]
] = LOCK_TYPES[lock_type]
if not callable(func):
continue

Expand Down

0 comments on commit 0404330

Please sign in to comment.