fix messed up merge

This commit is contained in:
Marc Koch 2024-06-29 01:42:39 +02:00
parent 32149194ea
commit 3ee2290ca6
1 changed files with 8 additions and 9 deletions

View File

@ -101,15 +101,14 @@ class NtfyBot(Plugin):
task = self.tasks.get(topic_id) task = self.tasks.get(topic_id)
if task and not task.done(): if task and not task.done():
self.log.debug("Cancelling subscription task for topic %d", self.log.debug("Cancelling subscription task for topic %d",
async def can_use_command(self, evt: MessageEvent) -> bool: topic_id)
if evt.sender in self.config["admins"]: task.cancel()
return True try:
levels = await self.client.get_state_event(evt.room_id, EventType.ROOM_POWER_LEVELS) await task
user_level = levels.get_user_level(evt.sender) except asyncio.CancelledError:
if user_level < 50: pass
await evt.reply("You don't have the permission to manage ntfy subscriptions in this room.") except Exception as exc:
return False self.log.exception("Subscription task errored", exc_info=exc)
return True
@command.new(name=lambda self: self.config["command_prefix"], @command.new(name=lambda self: self.config["command_prefix"],
help="Manage ntfy subscriptions.", require_subcommand=True) help="Manage ntfy subscriptions.", require_subcommand=True)