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:
parent
61fd3f4c25
commit
5c065d501e
1 changed files with 21 additions and 21 deletions
|
@ -158,11 +158,11 @@ class MMTask:
|
||||||
|
|
||||||
def get_answer_callback(self, choice: MMChoice):
|
def get_answer_callback(self, choice: MMChoice):
|
||||||
async def callback(data: rc.CommandData):
|
async def callback(data: rc.CommandData):
|
||||||
|
async with data.session_acm() as session:
|
||||||
# Find the user who clicked on the button
|
# 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
|
# Get the related MMEvent
|
||||||
async with data.session_acm() as session:
|
|
||||||
mmevent: MMEvent = await ru.asyncify(session.query(self._EventT).get, self.mmid)
|
mmevent: MMEvent = await ru.asyncify(session.query(self._EventT).get, self.mmid)
|
||||||
|
|
||||||
# Check if the user had already responded
|
# Check if the user had already responded
|
||||||
|
@ -178,7 +178,7 @@ class MMTask:
|
||||||
|
|
||||||
# Drop fiorygi
|
# Drop fiorygi
|
||||||
if random.randrange(100) < self.command.config["Matchmaking"]["fiorygi_award_chance"]:
|
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:
|
else:
|
||||||
# Change their response
|
# Change their response
|
||||||
mmresponse.choice = choice
|
mmresponse.choice = choice
|
||||||
|
@ -194,11 +194,11 @@ class MMTask:
|
||||||
|
|
||||||
def get_delete_callback(self):
|
def get_delete_callback(self):
|
||||||
async def callback(data: rc.CommandData):
|
async def callback(data: rc.CommandData):
|
||||||
|
async with data.session_acm() as session:
|
||||||
# Find the user who clicked on the button
|
# 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
|
# Get the related MMEvent
|
||||||
async with data.session_acm() as session:
|
|
||||||
mmevent: MMEvent = await ru.asyncify(session.query(self._EventT).get, self.mmid)
|
mmevent: MMEvent = await ru.asyncify(session.query(self._EventT).get, self.mmid)
|
||||||
|
|
||||||
# Ensure the user has the required roles to start the matchmaking
|
# Ensure the user has the required roles to start the matchmaking
|
||||||
|
@ -213,11 +213,11 @@ class MMTask:
|
||||||
|
|
||||||
def get_start_callback(self):
|
def get_start_callback(self):
|
||||||
async def callback(data: rc.CommandData):
|
async def callback(data: rc.CommandData):
|
||||||
|
async with data.session_acm() as session:
|
||||||
# Find the user who clicked on the button
|
# 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
|
# Get the related MMEvent
|
||||||
async with data.session_acm() as session:
|
|
||||||
mmevent: MMEvent = await ru.asyncify(session.query(self._EventT).get, self.mmid)
|
mmevent: MMEvent = await ru.asyncify(session.query(self._EventT).get, self.mmid)
|
||||||
|
|
||||||
# Ensure the user has the required roles to start the matchmaking
|
# Ensure the user has the required roles to start the matchmaking
|
||||||
|
|
Loading…
Reference in a new issue