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

Merge remote-tracking branch 'origin/master'

This commit is contained in:
Steffo 2019-12-03 19:01:19 +01:00
commit 926fd733e2
7 changed files with 196 additions and 2 deletions

26
poetry.lock generated
View file

@ -421,10 +421,18 @@ sentry = ["sentry_sdk (~0.13.2)"]
telegram = ["python_telegram_bot (^12.2.0)"]
[package.source]
reference = "8ff0731aa5bd167a59f342472bfe2d7e74daf1ca"
reference = "d82b824a3447b6aef9e5d6997033852d53089127"
type = "git"
url = "https://github.com/Steffo99/royalnet/"
[[package]]
category = "main"
description = "A package to procedurally generate useless spells!"
name = "royalspells"
optional = false
python-versions = "~=3.6"
version = "3.2"
[[package]]
category = "main"
description = "Python client for Sentry (https://getsentry.com)"
@ -583,7 +591,7 @@ python-versions = "*"
version = "2019.11.28"
[metadata]
content-hash = "869279b7212d24287566f5b073831fa19f68f9e099177d96b78af0897e99489b"
content-hash = "be7ee7b683f3e789a759f25a03730bf98152e6c5f47219d9ee5030f8f66d9d6f"
python-versions = "^3.8"
[metadata.files]
@ -837,6 +845,9 @@ riotwatcher = [
{file = "riotwatcher-2.7.1.tar.gz", hash = "sha256:5349271c7e00637b7619491a6070e66603705db60558ea2a690e7016f6e6d9a4"},
]
royalnet = []
royalspells = [
{file = "royalspells-3.2.tar.gz", hash = "sha256:2bd4a9a66514532e35c02c3907425af48c7cb292364c4843c795719a82b25dfe"},
]
sentry-sdk = [
{file = "sentry-sdk-0.13.4.tar.gz", hash = "sha256:bfc486af718c268cf49ff43d6334ed4db7333ace420240b630acdd8f8a3a8f60"},
{file = "sentry_sdk-0.13.4-py2.py3-none-any.whl", hash = "sha256:a7c2c8d3f53b6b57454830cd6a4b73d272f1ba91952f59e6545b3cf885f3c22f"},
@ -891,13 +902,24 @@ websockets = [
{file = "websockets-8.1-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:3762791ab8b38948f0c4d281c8b2ddfa99b7e510e46bd8dfa942a5fff621068c"},
{file = "websockets-8.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:3db87421956f1b0779a7564915875ba774295cc86e81bc671631379371af1170"},
{file = "websockets-8.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:4f9f7d28ce1d8f1295717c2c25b732c2bc0645db3215cf757551c392177d7cb8"},
{file = "websockets-8.1-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:295359a2cc78736737dd88c343cd0747546b2174b5e1adc223824bcaf3e164cb"},
{file = "websockets-8.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:1d3f1bf059d04a4e0eb4985a887d49195e15ebabc42364f4eb564b1d065793f5"},
{file = "websockets-8.1-cp36-cp36m-win32.whl", hash = "sha256:2db62a9142e88535038a6bcfea70ef9447696ea77891aebb730a333a51ed559a"},
{file = "websockets-8.1-cp36-cp36m-win_amd64.whl", hash = "sha256:0e4fb4de42701340bd2353bb2eee45314651caa6ccee80dbd5f5d5978888fed5"},
{file = "websockets-8.1-cp37-cp37m-macosx_10_6_intel.whl", hash = "sha256:9b248ba3dd8a03b1a10b19efe7d4f7fa41d158fdaa95e2cf65af5a7b95a4f989"},
{file = "websockets-8.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:ce85b06a10fc65e6143518b96d3dca27b081a740bae261c2fb20375801a9d56d"},
{file = "websockets-8.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:965889d9f0e2a75edd81a07592d0ced54daa5b0785f57dc429c378edbcffe779"},
{file = "websockets-8.1-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:751a556205d8245ff94aeef23546a1113b1dd4f6e4d102ded66c39b99c2ce6c8"},
{file = "websockets-8.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:3ef56fcc7b1ff90de46ccd5a687bbd13a3180132268c4254fc0fa44ecf4fc422"},
{file = "websockets-8.1-cp37-cp37m-win32.whl", hash = "sha256:7ff46d441db78241f4c6c27b3868c9ae71473fe03341340d2dfdbe8d79310acc"},
{file = "websockets-8.1-cp37-cp37m-win_amd64.whl", hash = "sha256:20891f0dddade307ffddf593c733a3fdb6b83e6f9eef85908113e628fa5a8308"},
{file = "websockets-8.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:c1ec8db4fac31850286b7cd3b9c0e1b944204668b8eb721674916d4e28744092"},
{file = "websockets-8.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:5c01fd846263a75bc8a2b9542606927cfad57e7282965d96b93c387622487485"},
{file = "websockets-8.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:9bef37ee224e104a413f0780e29adb3e514a5b698aabe0d969a6ba426b8435d1"},
{file = "websockets-8.1-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:d705f8aeecdf3262379644e4b55107a3b55860eb812b673b28d0fbc347a60c55"},
{file = "websockets-8.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:c8a116feafdb1f84607cb3b14aa1418424ae71fee131642fc568d21423b51824"},
{file = "websockets-8.1-cp38-cp38-win32.whl", hash = "sha256:e898a0863421650f0bebac8ba40840fc02258ef4714cb7e1fd76b6a6354bda36"},
{file = "websockets-8.1-cp38-cp38-win_amd64.whl", hash = "sha256:f8a7bff6e8664afc4e6c28b983845c5bc14965030e3fb98789734d416af77c4b"},
{file = "websockets-8.1.tar.gz", hash = "sha256:5c65d2da8c6bce0fca2528f69f44b2f977e06954c8512a952222cea50dad430f"},
]
yarl = [

View file

@ -21,6 +21,7 @@
python = "^3.8"
riotwatcher = "^2.7.1"
royalspells = "^3.2"
[tool.poetry.dependencies.royalnet]
git = "https://github.com/Steffo99/royalnet/"

View file

@ -26,6 +26,10 @@ from .diarioquote import DiarioquoteCommand
from .peertube import PeertubeCommand
from .googlevideo import GooglevideoCommand
from .yahoovideo import YahoovideoCommand
from .userinfo import UserinfoCommand
from .spell import SpellCommand
from .ahnonlosoio import AhnonlosoioCommand
from .eat import EatCommand
# Enter the commands of your Pack here!
available_commands = [
@ -56,6 +60,10 @@ available_commands = [
PeertubeCommand,
GooglevideoCommand,
YahoovideoCommand,
UserinfoCommand,
SpellCommand,
AhnonlosoioCommand,
EatCommand,
]
# Don't change this, it should automatically generate __all__

View file

@ -0,0 +1,10 @@
from royalnet.commands import *
class AhnonlosoioCommand(Command):
name: str = "ahnonlosoio"
description: str = "Ah, non lo so io!"
async def run(self, args: CommandArgs, data: CommandData) -> None:
await data.reply(r"🤷 Ah, non lo so io! ¯\_(ツ)_/¯")

39
royalpack/commands/eat.py Normal file
View file

@ -0,0 +1,39 @@
from royalnet.commands import *
class EatCommand(Command):
name: str = "eat"
description: str = "Mangia qualcosa!"
syntax: str = "{cibo}"
_FOODS = {
"_default": "🍗 Hai mangiato {food}!\n[i]Ma non è successo nulla.[/i]",
"tonnuooooooro": "👻 Il {food} che hai mangiato era posseduto.\n[i]Spooky![/i]",
"uranio": "☢️ L'{food} che hai mangiato era radioattivo.\n[i]Stai brillando di verde![/i]",
"pollo": '🍗 Il {food} che hai appena mangiato proveniva dallo spazio.\n[i]Coccodè?[/i]',
"ragno": "🕸 Hai mangiato un {food}.\n[i]Ewww![/i]",
"curry": "🔥 BRUCIAAAAAAAAAA! Il {food} era piccantissimo!\n[i]Stai sputando fiamme![/i]",
"torta": "⬜️ Non hai mangiato niente.\n[i]La {food} è una menzogna![/i]",
"cake": "⬜️ Non hai mangiato niente.\n[i]The {food} is a lie![/i]",
"biscotto": "🍪 Hai mangiato un {food} di contrabbando.\n[i]L'Inquisizione non lo saprà mai![/i]",
"biscotti": "🍪 Hai mangiato tanti {food} di contrabbando.\n[i]Attento! L'Inquisizione è sulle tue tracce![/i]",
"tango": "🌳 Hai mangiato un {food}, e un albero insieme ad esso.\n[i]Senti le tue ferite curarsi...[/i]",
"giaroun": "🥌 Il {food} che hai mangiato era duro come un {food}.\n[i]Stai soffrendo di indigestione![/i]",
"giarone": "🥌 Il {food} che hai mangiato era duro come un {food}.\n[i]Stai soffrendo di indigestione![/i]",
"sasso": "🥌 Il {food} che hai mangiato era duro come un {food}.\n[i]Stai soffrendo di indigestione![/i]",
"gnocchetti": "🥘 Ullà, sono duri 'sti {food}!\n[i]Fai fatica a digerirli.[/i]",
"tide pod": "☣️ I {food} che hai mangiato erano buonissimi.\n[i]Stai sbiancando![/i]",
"tide pods": "☣️ I {food} che hai mangiato erano buonissimi.\n[i]Stai sbiancando![/i]",
"gelato": "🍨 Mangiando del {food}, hai invocato Steffo.\n[i]Cedigli ora il tuo gelato.[/i]",
"tua mamma": "⚠️ Non sei riuscito a mangiare {food}.\n[i]Era troppo grande e non ci stava nella tua bocca![/i]",
"mango": "🥭 Hai mangiato un {food}.\n[i]Ti sembra di avere più mana, adesso.[/i]",
"mango incantato": "🥭 Hai mangiato un {food}.\n[i]Ti sembra di avere più mana, adesso.[/i]",
"enchanted mango": "🥭 Hai mangiato un {food}.\n[i]Ti sembra di avere più mana, adesso.[/i]",
}
async def run(self, args: CommandArgs, data: CommandData) -> None:
food = args.joined(require_at_least=0)
food_string = self._FOODS.get(food.lower(), self._FOODS["_default"])
await data.reply(food_string.format(food=food.capitalize()))

View file

@ -0,0 +1,51 @@
from typing import *
from royalnet.commands import *
from royalnet.utils import *
from royalnet.backpack.tables import User
from sqlalchemy import func
import royalspells as rs
class SpellCommand(Command):
name: str = "spell"
description: str = "Genera casualmente una spell!"
syntax = "{nome_spell}"
async def run(self, args: CommandArgs, data: CommandData) -> None:
spell_name = args.joined(require_at_least=1)
spell = rs.Spell(spell_name)
rows: List[str] = [f"✨ [b]{spell.name}[/b]"]
if spell.damage_component:
dmg: rs.DamageComponent = spell.damage_component
constant_str: str = f"{dmg.constant:+d}" if dmg.constant != 0 else ""
rows.append(f"Danni: [b]{dmg.dice_number}d{dmg.dice_type}{constant_str}[/b]"
f" {andformat(dmg.damage_types, final=' e ')}")
rows.append(f"Precisione: [b]{dmg.miss_chance}%[/b]")
if dmg.repeat > 1:
rows.append(f"Multiattacco: [b]×{dmg.repeat}[/b]")
rows.append("")
if spell.healing_component:
heal: rs.HealingComponent = spell.healing_component
constant_str: str = f"{heal.constant:+d}" if heal.constant != 0 else ""
rows.append(f"Cura: [b]{heal.dice_number}d{heal.dice_type}{constant_str}[/b] HP")
rows.append("")
if spell.stats_component:
stats: rs.StatsComponent = spell.stats_component
rows.append("Il caster riceve: ")
for stat_name in stats.stat_changes:
rows.append(f"[b]{stats.stat_changes[stat_name]}{stat_name}[/b]")
rows.append("")
if spell.status_effect_component:
se: rs.StatusEffectComponent = spell.status_effect_component
rows.append("Infligge al bersaglio: ")
rows.append(f"[b]{se.effect}[/b] ({se.chance}%)")
rows.append("")
await data.reply("\n".join(rows))

View file

@ -0,0 +1,63 @@
from typing import *
from royalnet.commands import *
from royalnet.utils import *
from royalnet.backpack.tables import User
from sqlalchemy import func
class UserinfoCommand(Command):
name: str = "userinfo"
aliases = ["uinfo", "ui", "useri"]
description: str = "Visualizza informazioni su un utente."
syntax = "[username]"
async def run(self, args: CommandArgs, data: CommandData) -> None:
username = args.optional(0)
if username is None:
user: User = await data.get_author(error_if_none=True)
else:
found: Optional[User] = await asyncify(
data.session
.query(self.alchemy.get(User))
.filter(func.lower(self.alchemy.get(User).username) == func.lower(username))
.one_or_none
)
if not found:
raise InvalidInputError("Utente non trovato.")
else:
user = found
r = [
f" [b]{user.username}[/b] (ID: {user.uid})",
f"{user.role}",
"",
]
# Bios are a bit too long
# if user.bio:
# r.append(f"{user.bio}")
for account in user.telegram:
r.append(f"{account}")
for account in user.discord:
r.append(f"{account}")
for account in user.leagueoflegends:
r.append(f"{account}")
r.append("")
r.append(f"Ha creato [b]{len(user.diario_created)}[/b] righe di diario, e vi compare in"
f" [b]{len(user.diario_quoted)}[/b] righe.")
r.append("")
if user.trivia_score:
r.append(f"Trivia: [b]{user.trivia_score.correct_answers}[/b] risposte corrette / "
f"{user.trivia_score.total_answers}) totali")
await data.reply("\n".join(r))