2021-04-03 16:43:34 +00:00
|
|
|
import royalnet.engineer as engi
|
|
|
|
import royalnet.scrolls as sc
|
2021-04-13 22:43:19 +00:00
|
|
|
import royalnet_console as rc
|
2021-04-14 02:12:54 +00:00
|
|
|
import royalnet_telethon as rt
|
2021-04-03 16:43:34 +00:00
|
|
|
import pathlib
|
2021-04-14 02:12:54 +00:00
|
|
|
import coloredlogs
|
2021-04-03 16:43:34 +00:00
|
|
|
|
|
|
|
from . import commands
|
2021-04-06 01:58:55 +00:00
|
|
|
from .database import engine, base
|
2021-04-03 16:43:34 +00:00
|
|
|
|
2021-04-14 02:12:54 +00:00
|
|
|
coloredlogs.install(level="DEBUG", isatty=True)
|
2021-04-03 16:43:34 +00:00
|
|
|
|
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
|
|
|
|
2021-04-13 22:43:19 +00:00
|
|
|
engine_ = engine.lazy_engine.evaluate()
|
|
|
|
base.Base.metadata.create_all(engine_)
|
2021-04-03 16:43:34 +00:00
|
|
|
|
2021-04-13 22:43:19 +00:00
|
|
|
pda = engi.PDA(implementations=[
|
2021-04-14 02:12:54 +00:00
|
|
|
# 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"],
|
|
|
|
)
|
2021-04-13 22:43:19 +00:00
|
|
|
])
|
2021-04-06 01:58:55 +00:00
|
|
|
|
2021-04-14 02:12:54 +00:00
|
|
|
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"])
|
2021-04-15 00:40:51 +00:00
|
|
|
pda.implementations["telethon.1"].register_partialcommand(commands.ciaoruozi, ["ciaoruozi"])
|
2021-04-14 02:12:54 +00:00
|
|
|
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"])
|
2021-04-15 00:40:51 +00:00
|
|
|
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"])
|
2021-04-06 01:58:55 +00:00
|
|
|
|
2021-04-03 16:43:34 +00:00
|
|
|
|
2021-04-13 22:43:19 +00:00
|
|
|
pda.run()
|