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

55 lines
2.3 KiB
Python

import royalnet.engineer as engi
import royalnet.scrolls as sc
import royalnet_console as rc
import royalnet_telethon as rt
import pathlib
import coloredlogs
from . import commands
from .database import engine, base
coloredlogs.install(level="DEBUG", isatty=True)
config = sc.Scroll.from_file(namespace="ROYALPACK", file_path=pathlib.Path("royalpack.cfg.toml"))
engine_ = engine.lazy_engine.evaluate()
base.Base.metadata.create_all(engine_)
pda = engi.PDA(implementations=[
# rc.ConsolePDAImplementation(
# name="1",
# extensions=[
# engi.SQLAlchemyExtension(engine=engine_),
# ]
# ),
rt.TelethonPDAImplementation(
name="1",
extensions=[
engi.SQLAlchemyExtension(engine=engine_),
],
tg_api_id=config["telegram.api.id"],
tg_api_hash=config["telegram.api.hash"],
bot_username=config["telegram.bot.username"],
bot_token=config["telegram.bot.token"],
)
])
pda.implementations["telethon.1"].register_partialcommand(commands.ahnonlosoio, ["ahnonlosoio"])
pda.implementations["telethon.1"].register_partialcommand(commands.answer, ["answer"])
pda.implementations["telethon.1"].register_partialcommand(commands.cat, ["cat"])
pda.implementations["telethon.1"].register_partialcommand(commands.ciaoruozi, ["ciaoruozi"])
pda.implementations["telethon.1"].register_partialcommand(commands.color, ["color"])
pda.implementations["telethon.1"].register_partialcommand(commands.ping, ["ping"])
pda.implementations["telethon.1"].register_partialcommand(commands.ship, ["ship"])
pda.implementations["telethon.1"].register_partialcommand(commands.rage_show, ["rage"])
pda.implementations["telethon.1"].register_partialcommand(commands.rage_add, ["rage"])
pda.implementations["telethon.1"].register_partialcommand(commands.debug, ["debug"])
pda.implementations["telethon.1"].register_partialcommand(commands.debug_impls, ["debug"])
pda.implementations["telethon.1"].register_partialcommand(commands.debug_exts, ["debug"])
pda.implementations["telethon.1"].register_partialcommand(commands.debug_convs, ["debug"])
pda.implementations["telethon.1"].register_partialcommand(commands.ciao, ["ciao"])
pda.implementations["telethon.1"].register_partialcommand(commands.help_cmd, ["help"])
pda.implementations["telethon.1"].register_partialcommand(commands.help_single, ["help"])
pda.run()