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

Continue fixing mmtask

This commit is contained in:
Steffo 2020-08-24 00:16:44 +02:00
parent 61fd3f4c25
commit 5c065d501e

View file

@ -158,11 +158,11 @@ class MMTask:
def get_answer_callback(self, choice: MMChoice):
async def callback(data: rc.CommandData):
async with data.session_acm() as session:
# Find the user who clicked on the button
user = await data.get_author(error_if_none=True)
user = await data.find_author(session=session, required=True)
# Get the related MMEvent
async with data.session_acm() as session:
mmevent: MMEvent = await ru.asyncify(session.query(self._EventT).get, self.mmid)
# Check if the user had already responded
@ -178,7 +178,7 @@ class MMTask:
# Drop fiorygi
if random.randrange(100) < self.command.config["Matchmaking"]["fiorygi_award_chance"]:
await FiorygiTransaction.spawn_fiorygi(data, user, 1, "aver risposto a un matchmaking")
await FiorygiTransaction.spawn_fiorygi(user, 1, "aver risposto a un matchmaking", data=data, session=session)
else:
# Change their response
mmresponse.choice = choice
@ -194,11 +194,11 @@ class MMTask:
def get_delete_callback(self):
async def callback(data: rc.CommandData):
async with data.session_acm() as session:
# Find the user who clicked on the button
user = await data.get_author(error_if_none=True)
user = await data.find_author(session=session, required=True)
# Get the related MMEvent
async with data.session_acm() as session:
mmevent: MMEvent = await ru.asyncify(session.query(self._EventT).get, self.mmid)
# Ensure the user has the required roles to start the matchmaking
@ -213,11 +213,11 @@ class MMTask:
def get_start_callback(self):
async def callback(data: rc.CommandData):
async with data.session_acm() as session:
# Find the user who clicked on the button
user = await data.get_author(error_if_none=True)
user = await data.find_author(session=session, required=True)
# Get the related MMEvent
async with data.session_acm() as session:
mmevent: MMEvent = await ru.asyncify(session.query(self._EventT).get, self.mmid)
# Ensure the user has the required roles to start the matchmaking