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

roll: Make qty optional

This commit is contained in:
Steffo 2022-08-21 02:27:27 +02:00
parent c1f03e5bdb
commit 48f01e65c7
Signed by: steffo
GPG key ID: 6965406171929D01
2 changed files with 5 additions and 2 deletions

View file

@ -111,7 +111,7 @@ register_telegram(tg_router, commands.fiorygi_bury, ["bury"],
register_telegram(tg_router, commands.version, ["version"])
register_telegram(tg_router, commands.cv, ["cv", "civù"])
register_telegram(tg_router, commands.rocoinflip, ["rocoinflip"], r'"(?P<teama>[^"]+)"\s+"(?P<teamb>[^"]+)"')
register_telegram(tg_router, commands.roll, ["roll"], r"(?P<qty>[0-9]*)d(?P<die>[0-9]+)(?P<mod>[+-][0-9]+)?")
register_telegram(tg_router, commands.roll, ["roll"], r"(?P<qty>[0-9]*)?d(?P<die>[0-9]+)(?P<mod>[+-][0-9]+)?")
register_telegram(tg_router, commands.diobot, ["diobot", "phrase"])
register_telegram(tg_router, commands.loginprogress, ["loginprogress"])

View file

@ -9,13 +9,16 @@ import royalpack.bolts as rb
@rb.capture_errors
@engi.TeleportingConversation
async def roll(*, _msg: engi.Message, qty: int, die: int, mod: t.Optional[int], **__):
async def roll(*, _msg: engi.Message, qty: t.Optional[int], die: int, mod: t.Optional[int], **__):
"""
Tira un dado nel formato di D&D: `1d20+1`, ad esempio.
Non perfettamente casuale, **non usare per competizioni o altre cose serie**!
"""
if qty is None:
qty = 1
# modificatore supersegreto della fortuna. ooooh! questo è top secret!
# "blame cate for this" --steffo