mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
33 lines
1.5 KiB
Python
33 lines
1.5 KiB
Python
import os
|
|
import asyncio
|
|
import logging
|
|
from royalnet.bots import TelegramBot, DiscordBot
|
|
from royalnet.commands import *
|
|
from royalnet.commands.debug_create import DebugCreateCommand
|
|
from royalnet.commands.error_handler import ErrorHandlerCommand
|
|
from royalnet.network import RoyalnetServer
|
|
from royalnet.database import DatabaseConfig
|
|
from royalnet.database.tables import Royal, Telegram, Discord
|
|
|
|
loop = asyncio.get_event_loop()
|
|
|
|
log = logging.root
|
|
log.addHandler(logging.StreamHandler())
|
|
logging.getLogger("royalnet.audio.royalaudiofile").setLevel(logging.DEBUG)
|
|
logging.getLogger("royalnet.bots.discord").setLevel(logging.DEBUG)
|
|
|
|
commands = [PingCommand, ShipCommand, SmecdsCommand, ColorCommand, CiaoruoziCommand, DebugCreateCommand, SyncCommand,
|
|
AuthorCommand, DiarioCommand, RageCommand, DateparserCommand, ReminderCommand, KvactiveCommand, KvCommand,
|
|
KvrollCommand, VideoinfoCommand, SummonCommand, PlayCommand]
|
|
|
|
master = RoyalnetServer("localhost", 2468, "sas")
|
|
tg_db_cfg = DatabaseConfig(os.environ["DB_PATH"], Royal, Telegram, "tg_id")
|
|
tg_bot = TelegramBot(os.environ["TG_AK"], "ws://localhost:2468", "sas", commands, NullCommand, ErrorHandlerCommand, tg_db_cfg)
|
|
ds_db_cfg = DatabaseConfig(os.environ["DB_PATH"], Royal, Discord, "discord_id")
|
|
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
|
|
loop.create_task(tg_bot.run())
|
|
loop.create_task(ds_bot.run())
|
|
print("Starting loop...")
|
|
loop.run_forever()
|