1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Permetti agli admin di eliminare i matchmaking inutilizzati

This commit is contained in:
Steffo 2020-05-13 20:44:14 +02:00
parent fe815aaa2f
commit 2c80e899a8
Signed by: steffo
GPG key ID: 896A80F55F7C97F0

View file

@ -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!")