mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 03:24:20 +00:00
✨ Add /rocoinflip command
This commit is contained in:
parent
fc7877b529
commit
57f832b320
3 changed files with 31 additions and 0 deletions
|
@ -108,6 +108,7 @@ register_telegram(tg_router, commands.fiorygi_dig, ["dig"], r"(?P<slug>[a-z0-9-]
|
|||
register_telegram(tg_router, commands.fiorygi_bury, ["bury"], r"(?P<slug>[a-z0-9-]+)\s+(?P<value>[0-9]+)(?:\s+(?P<message>.+))?")
|
||||
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>[^"]+)"')
|
||||
|
||||
ds_router = engi.Router()
|
||||
|
||||
|
@ -138,6 +139,7 @@ register_discord(ds_router, commands.fiorygi_transactions_other, ["transactions"
|
|||
register_discord(ds_router, commands.fiorygi_dig, ["dig"], r"(?P<slug>[a-z0-9-]+)")
|
||||
register_discord(ds_router, commands.fiorygi_bury, ["bury"], r"(?P<slug>[a-z0-9-]+)\s+(?P<value>[0-9]+)(?:\s+(?P<message>.+))?")
|
||||
register_discord(ds_router, commands.version, ["version"])
|
||||
register_discord(ds_router, commands.rocoinflip, ["rocoinflip"], r'"(?P<teama>[^"]+)"\s+"(?P<teamb>[^"]+)"')
|
||||
|
||||
pda.implementations["telethon.1"].register_conversation(tg_router)
|
||||
pda.implementations["discordpy.2"].register_conversation(ds_router)
|
||||
|
|
|
@ -17,3 +17,4 @@ from .whoami import *
|
|||
from .fiorygi import *
|
||||
from .version import *
|
||||
from .cv import *
|
||||
from .rocoinflip import *
|
||||
|
|
28
royalpack/commands/rocoinflip.py
Normal file
28
royalpack/commands/rocoinflip.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
import random
|
||||
import royalnet.engineer as engi
|
||||
|
||||
|
||||
@engi.TeleportingConversation
|
||||
async def rocoinflip(*, _sentry: engi.Sentry, _msg: engi.Message, teama: str, teamb: str, **__):
|
||||
"""
|
||||
Scegli quale delle due squadre inizierà per prima.
|
||||
"""
|
||||
flip = random.randrange(0, 2)
|
||||
if flip == 0:
|
||||
first = teama
|
||||
second = teamb
|
||||
else:
|
||||
first = teamb
|
||||
second = teama
|
||||
|
||||
text = [
|
||||
f"❔ Risultati del coin flip:",
|
||||
f"",
|
||||
f"🔹 {first}",
|
||||
f"🔸 {second}",
|
||||
]
|
||||
|
||||
await _msg.reply(text="\n".join(text))
|
||||
|
||||
|
||||
__all__ = ("rocoinflip",)
|
Loading…
Reference in a new issue