forked from Imasaab/royalnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
awardfiorygi.py
31 lines (26 loc) · 1.18 KB
/
awardfiorygi.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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()