From 2c80e899a847e652cd198b426c0e9b12569f1422 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 13 May 2020 20:44:14 +0200 Subject: [PATCH] Permetti agli admin di eliminare i matchmaking inutilizzati --- royalpack/commands/matchmaking.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/royalpack/commands/matchmaking.py b/royalpack/commands/matchmaking.py index 0e10f662..3fb7c6ec 100644 --- a/royalpack/commands/matchmaking.py +++ b/royalpack/commands/matchmaking.py @@ -185,9 +185,9 @@ class MatchmakingCommand(rc.Command): def _gen_mm_telegram_delete(self, client, mmid: int): async def callback(data: rc.CommandData): - author = await data.get_author(error_if_none=True) + author: User = await data.get_author(error_if_none=True) mmevent: MMEvent = await asyncify(data.session.query(self.alchemy.get(MMEvent)).get, mmid) - if author != mmevent.creator: + if author != mmevent.creator and "admin" not in author.roles: raise rc.UserError("Non sei il creatore di questo matchmaking!") await self.queue[mmid].put(Interrupts.MANUAL_DELETE) await data.reply(f"🗑 Evento eliminato!") @@ -197,7 +197,7 @@ class MatchmakingCommand(rc.Command): async def callback(data: rc.CommandData): author = await data.get_author(error_if_none=True) mmevent: MMEvent = await asyncify(data.session.query(self.alchemy.get(MMEvent)).get, mmid) - if author != mmevent.creator: + if author != mmevent.creator and "admin" not in author.roles: raise rc.UserError("Non sei il creatore di questo matchmaking!") await self.queue[mmid].put(Interrupts.MANUAL_START) await data.reply(f"🚩 Evento avviato!")