mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Fiorygi may drop when answering mmevents
This commit is contained in:
parent
8c2c49af71
commit
887411df6d
2 changed files with 7 additions and 4 deletions
|
@ -2,7 +2,7 @@ import datetime
|
||||||
import re
|
import re
|
||||||
import dateparser
|
import dateparser
|
||||||
import typing
|
import typing
|
||||||
import asyncio
|
import random
|
||||||
from telegram import Bot as PTBBot
|
from telegram import Bot as PTBBot
|
||||||
from telegram import Message as PTBMessage
|
from telegram import Message as PTBMessage
|
||||||
from telegram import InlineKeyboardMarkup as InKM
|
from telegram import InlineKeyboardMarkup as InKM
|
||||||
|
@ -13,7 +13,7 @@ from royalnet.serf.telegram import TelegramSerf as TelegramBot
|
||||||
from royalnet.serf.telegram import escape as telegram_escape
|
from royalnet.serf.telegram import escape as telegram_escape
|
||||||
from royalnet.utils import asyncify, sleep_until, sentry_async_wrap
|
from royalnet.utils import asyncify, sleep_until, sentry_async_wrap
|
||||||
from royalnet.backpack.tables import User
|
from royalnet.backpack.tables import User
|
||||||
from ..tables import MMEvent, MMResponse
|
from ..tables import MMEvent, MMResponse, FiorygiTransaction
|
||||||
from ..types import MMChoice, MMInterfaceDataTelegram
|
from ..types import MMChoice, MMInterfaceDataTelegram
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ class MatchmakingCommand(Command):
|
||||||
parse_mode="HTML",
|
parse_mode="HTML",
|
||||||
disable_web_page_preview=True,
|
disable_web_page_preview=True,
|
||||||
reply_markup=self._gen_telegram_keyboard(mmevent))
|
reply_markup=self._gen_telegram_keyboard(mmevent))
|
||||||
except BadRequest:
|
except TelegramError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _gen_mm_telegram_callback(self, client: PTBBot, mmid: int, choice: MMChoice):
|
def _gen_mm_telegram_callback(self, client: PTBBot, mmid: int, choice: MMChoice):
|
||||||
|
@ -140,6 +140,8 @@ class MatchmakingCommand(Command):
|
||||||
if mmresponse is None:
|
if mmresponse is None:
|
||||||
mmresponse = self.alchemy.get(MMResponse)(user=author, mmevent=mmevent, choice=choice)
|
mmresponse = self.alchemy.get(MMResponse)(user=author, mmevent=mmevent, choice=choice)
|
||||||
data.session.add(mmresponse)
|
data.session.add(mmresponse)
|
||||||
|
if random.randrange(14) == 0:
|
||||||
|
await FiorygiTransaction.spawn_fiorygi(data, author, 1, "aver risposto a un matchmaking")
|
||||||
else:
|
else:
|
||||||
mmresponse.choice = choice
|
mmresponse.choice = choice
|
||||||
await data.session_commit()
|
await data.session_commit()
|
||||||
|
|
|
@ -68,7 +68,8 @@ class FiorygiTransaction:
|
||||||
if qty > 0:
|
if qty > 0:
|
||||||
msg = f"💰 [b]{user_str}[/b] ha ottenuto [b]{qty}[/b] fioryg{'i' if qty != 1 else ''} per [i]{reason}[/i]!"
|
msg = f"💰 [b]{user_str}[/b] ha ottenuto [b]{qty}[/b] fioryg{'i' if qty != 1 else ''} per [i]{reason}[/i]!"
|
||||||
elif qty == 0:
|
elif qty == 0:
|
||||||
msg = f"❓ [b]{user_str}[/b] ha ottenuto [b]{qty}[/b] fioryg{'i' if qty != 1 else ''}...? Per [i]{reason}[/i]...? Cosa?"
|
msg = f"❓ [b]{user_str}[/b] ha ottenuto [b]{qty}[/b] fioryg{'i' if qty != 1 else ''}...? " \
|
||||||
|
f"Per [i]{reason}[/i]...? Cosa?"
|
||||||
else:
|
else:
|
||||||
msg = f"💸 [b]{user_str}[/b] ha perso [b]{-qty}[/b] fioryg{'i' if qty != -1 else ''} per [i]{reason}[/i]."
|
msg = f"💸 [b]{user_str}[/b] ha perso [b]{-qty}[/b] fioryg{'i' if qty != -1 else ''} per [i]{reason}[/i]."
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue