mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
3
This commit is contained in:
parent
1a20ad296a
commit
7c8f135b79
3 changed files with 13 additions and 3 deletions
2
bots.py
2
bots.py
|
@ -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)
|
|
@ -34,6 +34,7 @@ table.dota th {
|
|||
.dota-rank-medal-stars {
|
||||
position: relative;
|
||||
left: -32px;
|
||||
margin-right: -32px;
|
||||
}
|
||||
|
||||
.rl-rank-hidden {
|
||||
|
|
|
@ -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)
|
Loading…
Reference in a new issue