mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
weeeeeee
This commit is contained in:
parent
0ab22f3340
commit
3bbd2ed88f
2 changed files with 11 additions and 9 deletions
5
bots.py
5
bots.py
|
@ -26,8 +26,11 @@ if __name__ == "__main__":
|
||||||
telegram.start()
|
telegram.start()
|
||||||
logger.info("Starting Reddit Bot process...")
|
logger.info("Starting Reddit Bot process...")
|
||||||
reddit.start()
|
reddit.start()
|
||||||
|
if not __debug__:
|
||||||
logger.info("Starting StatsUpdate process...")
|
logger.info("Starting StatsUpdate process...")
|
||||||
stats.start()
|
stats.start()
|
||||||
|
else:
|
||||||
|
logger.warning("StatsUpdate process disabled in debug mode.")
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
if discord.exitcode is not None:
|
if discord.exitcode is not None:
|
||||||
|
@ -48,7 +51,7 @@ if __name__ == "__main__":
|
||||||
reddit = multiprocessing.Process(target=redditbot.process)
|
reddit = multiprocessing.Process(target=redditbot.process)
|
||||||
logger.info("Restarting Reddit Bot process...")
|
logger.info("Restarting Reddit Bot process...")
|
||||||
reddit.start()
|
reddit.start()
|
||||||
if stats.exitcode is not None:
|
if not __debug__ and stats.exitcode is not None:
|
||||||
logger.warning(f"StatsUpdater exited with {stats.exitcode}")
|
logger.warning(f"StatsUpdater exited with {stats.exitcode}")
|
||||||
del stats
|
del stats
|
||||||
stats = multiprocessing.Process(target=statsupdate.process)
|
stats = multiprocessing.Process(target=statsupdate.process)
|
||||||
|
|
|
@ -62,17 +62,17 @@ def new_lol_rank(item, change: typing.Tuple[Dirty]):
|
||||||
try:
|
try:
|
||||||
if solo:
|
if solo:
|
||||||
telegram_bot.send_message(config["Telegram"]["main_group"],
|
telegram_bot.send_message(config["Telegram"]["main_group"],
|
||||||
f"✳️ {item.royal.username} ha cambiato rank su League of Legends!\n"
|
f"✳️ {item.royal.username} ha un nuovo rank in **SOLO/DUO** su League of Legends!\n"
|
||||||
f"{solo.initial_value[0]} {solo.initial_value[1]} -> **{solo.value[0]} {solo.value[1]}**",
|
f"{solo.initial_value[0]} {solo.initial_value[1]} -> **{solo.value[0]} {solo.value[1]}**",
|
||||||
parse_mode="Markdown")
|
parse_mode="Markdown")
|
||||||
if flex:
|
if flex:
|
||||||
telegram_bot.send_message(config["Telegram"]["main_group"],
|
telegram_bot.send_message(config["Telegram"]["main_group"],
|
||||||
f"✳️ {item.royal.username} ha cambiato rank su League of Legends!\n"
|
f"✳️ {item.royal.username} ha un nuovo rank in **FLEX** su League of Legends!\n"
|
||||||
f"{flex.initial_value[0]} {flex.initial_value[1]} -> **{flex.value[0]} {flex.value[1]}**",
|
f"{flex.initial_value[0]} {flex.initial_value[1]} -> **{flex.value[0]} {flex.value[1]}**",
|
||||||
parse_mode="Markdown")
|
parse_mode="Markdown")
|
||||||
if twtr:
|
if twtr:
|
||||||
telegram_bot.send_message(config["Telegram"]["main_group"],
|
telegram_bot.send_message(config["Telegram"]["main_group"],
|
||||||
f"✳️ {item.royal.username} ha cambiato rank su League of Legends!\n"
|
f"✳️ {item.royal.username} ha un nuovo rank in **3V3** su League of Legends!\n"
|
||||||
f"{twtr.initial_value[0]} {twtr.initial_value[1]} -> **{twtr.value[0]} {twtr.value[1]}**",
|
f"{twtr.initial_value[0]} {twtr.initial_value[1]} -> **{twtr.value[0]} {twtr.value[1]}**",
|
||||||
parse_mode="Markdown")
|
parse_mode="Markdown")
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -81,9 +81,6 @@ def new_lol_rank(item, change: typing.Tuple[Dirty]):
|
||||||
|
|
||||||
def process():
|
def process():
|
||||||
while True:
|
while True:
|
||||||
if not __debug__:
|
|
||||||
logger.info("Pausing for 30 minutes.")
|
|
||||||
time.sleep(1800)
|
|
||||||
session = db.Session()
|
session = db.Session()
|
||||||
logger.info("Now updating Steam data.")
|
logger.info("Now updating Steam data.")
|
||||||
update_block(session, session.query(db.Steam).all())
|
update_block(session, session.query(db.Steam).all())
|
||||||
|
@ -100,6 +97,8 @@ def process():
|
||||||
logger.info("Now updating Overwatch data.")
|
logger.info("Now updating Overwatch data.")
|
||||||
update_block(session, session.query(db.Overwatch).all(), delay=5)
|
update_block(session, session.query(db.Overwatch).all(), delay=5)
|
||||||
session.commit()
|
session.commit()
|
||||||
|
logger.info("Pausing for 30 minutes.")
|
||||||
|
time.sleep(1800)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue