1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 03:24:20 +00:00
royalnet/royalpack/__main__.py

41 lines
1 KiB
Python
Raw Normal View History

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
from .database import engine, base
2021-04-03 16:43:34 +00:00
logging.basicConfig(level="DEBUG")
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"])
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"],
)
)