diff --git a/awardfiorygi.py b/awardfiorygi.py new file mode 100644 index 00000000..32dd33ae --- /dev/null +++ b/awardfiorygi.py @@ -0,0 +1,31 @@ +import telegram +import configparser +import db +import strings + +config = configparser.ConfigParser() +config.read("config.ini") + + +telegram_bot = telegram.Bot(config["Telegram"]["bot_token"]) +session = db.Session() + + +name = input("Utente Royalnet: ") +user = session.query(db.Royal).filter(db.Royal.username == name).one() +number = int(input("Fiorygi da aggiungere: ")) +user.fiorygi += number +reason = input("Motivazione: ") +fiorygi = f"fioryg{'i' if number != 1 else ''}" +telegram_bot.send_message(config["Telegram"]["main_group"], + strings.safely_format_string(strings.TELEGRAM.FIORYGI_AWARDED, + words={ + "mention": user.telegram[0].mention(), + "number": str(number), + "fiorygi": fiorygi, + "reason": reason + }), + parse_mode="HTML", + disable_web_page_preview=True) +session.commit() +session.close() diff --git a/scripts/chatasthebot.py b/chatasthebot.py similarity index 100% rename from scripts/chatasthebot.py rename to chatasthebot.py diff --git a/scripts/isaacfetcher.py b/isaacfetcher.py similarity index 100% rename from scripts/isaacfetcher.py rename to isaacfetcher.py diff --git a/scripts/__init__.py b/scripts/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/strings.py b/strings.py index ebae06f7..ca522458 100644 --- a/strings.py +++ b/strings.py @@ -23,6 +23,7 @@ def safely_format_string(string: str, words: typing.Dict[str, str] = None, ignor # Generic telegram errors class TELEGRAM: BOT_STARTED = "✅ Hai autorizzato il bot ad inviarti messaggi privati." + FIORYGI_AWARDED = "⭐️ {mention} è stato premiato con {number} {fiorygi} per {reason}!" class ERRORS: CRITICAL_ERROR = "☢ ERRORE CRITICO!\nIl bot ha ignorato il comando.\nUna segnalazione di errore è stata automaticamente mandata a @Steffo.\n\nDettagli dell'errore:\n
{exc_info}"