1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00
royalnet/royalgames.py

34 lines
1.5 KiB
Python
Raw Normal View History

2019-04-01 10:33:20 +00:00
import os
import asyncio
import logging
from royalnet.bots import TelegramBot, DiscordBot
2019-04-09 09:15:27 +00:00
from royalnet.commands import *
2019-04-01 10:33:20 +00:00
from royalnet.commands.debug_create import DebugCreateCommand
2019-04-04 15:39:38 +00:00
from royalnet.commands.error_handler import ErrorHandlerCommand
2019-04-01 10:33:20 +00:00
from royalnet.network import RoyalnetServer
2019-04-18 14:09:02 +00:00
from royalnet.database import DatabaseConfig
from royalnet.database.tables import Royal, Telegram, Discord
2019-04-01 10:33:20 +00:00
loop = asyncio.get_event_loop()
log = logging.root
log.addHandler(logging.StreamHandler())
2019-04-17 16:53:53 +00:00
logging.getLogger("royalnet.audio.royalaudiofile").setLevel(logging.DEBUG)
logging.getLogger("royalnet.bots.discord").setLevel(logging.DEBUG)
2019-04-03 17:31:20 +00:00
commands = [PingCommand, ShipCommand, SmecdsCommand, ColorCommand, CiaoruoziCommand, DebugCreateCommand, SyncCommand,
2019-04-09 15:00:14 +00:00
AuthorCommand, DiarioCommand, RageCommand, DateparserCommand, ReminderCommand, KvactiveCommand, KvCommand,
2019-04-16 12:38:45 +00:00
KvrollCommand, VideoinfoCommand, SummonCommand, PlayCommand]
2019-04-01 10:33:20 +00:00
2019-04-18 22:01:28 +00:00
master = RoyalnetServer("localhost", 2468, "sas")
2019-04-18 14:09:02 +00:00
tg_db_cfg = DatabaseConfig(os.environ["DB_PATH"], Royal, Telegram, "tg_id")
2019-04-18 22:01:28 +00:00
tg_bot = TelegramBot(os.environ["TG_AK"], "ws://localhost:2468", "sas", commands, NullCommand, ErrorHandlerCommand, tg_db_cfg)
2019-04-18 14:09:02 +00:00
ds_db_cfg = DatabaseConfig(os.environ["DB_PATH"], Royal, Discord, "discord_id")
2019-04-18 22:01:28 +00:00
ds_bot = DiscordBot(os.environ["DS_AK"], "ws://localhost:2468", "sas", commands, NullCommand, ErrorHandlerCommand, ds_db_cfg)
loop.run_until_complete(master.run())
# Dirty hack, remove me asap
2019-04-18 14:09:02 +00:00
loop.create_task(tg_bot.run())
2019-04-11 22:55:35 +00:00
loop.create_task(ds_bot.run())
2019-04-01 10:33:20 +00:00
print("Starting loop...")
loop.run_forever()