2021-04-03 16:43:34 +00:00
|
|
|
import royalnet.engineer as engi
|
|
|
|
import royalnet.scrolls as sc
|
|
|
|
import royalnet_telethon as rt
|
|
|
|
import pathlib
|
|
|
|
import asyncio
|
|
|
|
import logging
|
|
|
|
|
|
|
|
from . import commands
|
2021-04-06 01:58:55 +00:00
|
|
|
from .database import engine, base
|
2021-04-03 16:43:34 +00:00
|
|
|
|
|
|
|
logging.basicConfig(level="DEBUG")
|
|
|
|
|
2021-04-06 01:58:55 +00:00
|
|
|
config = sc.Scroll.from_file(namespace="ROYALPACK", file_path=pathlib.Path("royalpack.cfg.toml"))
|
2021-04-03 16:43:34 +00:00
|
|
|
|
|
|
|
pda = rt.TelethonPDA(
|
|
|
|
tg_api_id=config["tapi.id"],
|
|
|
|
tg_api_hash=config["tapi.hash"],
|
|
|
|
bot_username=config["tapi.username"],
|
|
|
|
)
|
|
|
|
|
|
|
|
pda.register_partial(commands.ahnonlosoio, ["ahnonlosoio"])
|
|
|
|
pda.register_partial(commands.answer, ["answer"])
|
|
|
|
pda.register_partial(commands.cat, ["cat"])
|
|
|
|
pda.register_partial(commands.color, ["color"])
|
|
|
|
pda.register_partial(commands.ping, ["ping"])
|
|
|
|
pda.register_partial(commands.ship, ["ship"])
|
2021-04-06 01:58:55 +00:00
|
|
|
pda.register_partial(commands.rage_show, ["rage"])
|
|
|
|
pda.register_partial(commands.rage_add, ["rage"])
|
|
|
|
|
|
|
|
|
|
|
|
_engine = engine.lazy_engine.evaluate()
|
|
|
|
base.Base.metadata.create_all(_engine)
|
2021-04-03 16:43:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
loop = asyncio.get_event_loop()
|
|
|
|
loop.run_until_complete(
|
|
|
|
pda.run(
|
|
|
|
bot_token=config["tapi.token"],
|
|
|
|
)
|
|
|
|
)
|