1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00
This commit is contained in:
Steffo 2018-01-20 15:28:04 +01:00
parent 1a20ad296a
commit 7c8f135b79
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: C27544372FBB445D
3 changed files with 13 additions and 3 deletions

View file

@ -1,6 +1,7 @@
import multiprocessing
import telegrambot
import discordbot
import time
discord_telegram_pipe = multiprocessing.Pipe()
discord = multiprocessing.Process(target=discordbot.process, args=(discord_telegram_pipe[0],), daemon=True)
@ -14,3 +15,4 @@ if __name__ == "__main__":
print("Restarting Discord Bot...")
discord = multiprocessing.Process(target=discordbot.process, args=(discord_telegram_pipe[0],), daemon=True)
discord.start()
time.sleep(60)

View file

@ -34,6 +34,7 @@ table.dota th {
.dota-rank-medal-stars {
position: relative;
left: -32px;
margin-right: -32px;
}
.rl-rank-hidden {

View file

@ -49,6 +49,9 @@ def cmd_register(bot: Bot, update: Update):
def cmd_discord(bot: Bot, update: Update):
if discord_connection is None:
bot.send_message(update.message.chat.id, "⚠ Il bot non è sincronizzato con Discord al momento.")
return
discord_connection.send("/cv")
server_members = discord_connection.recv()
channels = {0:None}
@ -108,7 +111,7 @@ def cmd_discord(bot: Bot, update: Update):
message += f" | 📡 [{member.game.name}]({member.game.url})"
message += "\n"
message += "\n"
bot.send_message(update.message.chat.id, message, disable_web_page_preview=True, parse_mode="Markdown")
bot.send_message(update.message.chat.id, message, disable_web_page_preview=True)
def cmd_cast(bot: Bot, update: Update):
@ -141,6 +144,7 @@ def cmd_cast(bot: Bot, update: Update):
def process(arg_discord_connection):
print("Telegrambot starting...")
if arg_discord_connection is not None:
global discord_connection
discord_connection = arg_discord_connection
u = Updater(config["Telegram"]["bot_token"])
@ -148,3 +152,6 @@ def process(arg_discord_connection):
u.dispatcher.add_handler(CommandHandler("discord", cmd_discord))
u.dispatcher.add_handler(CommandHandler("cast", cmd_cast))
u.start_polling()
if __name__ == "__main__":
process(None)