socket-bot/main.py

37 lines
940 B
Python
Raw Normal View History

2024-01-07 18:48:44 +08:00
import asyncio
import argparse
2024-01-25 22:08:02 +08:00
2024-01-07 18:48:44 +08:00
# from lib_not_dr.types import Options
from lib_not_dr.loggers import config
2024-02-07 12:52:33 +08:00
from data_struct import get_config, BotConfig, BotStatus
2024-01-07 18:48:44 +08:00
_version_ = "0.3.2"
2024-01-07 18:48:44 +08:00
2024-02-02 21:44:15 +08:00
logger = config.get_logger("bot")
2024-01-07 18:48:44 +08:00
BOTCONFIG: BotConfig = get_config()
2024-02-02 21:47:43 +08:00
BotStatus = BotStatus()
2024-01-07 18:48:44 +08:00
2024-02-02 22:23:51 +08:00
2024-01-25 22:08:02 +08:00
if __name__ == "__main__":
2024-01-07 18:48:44 +08:00
# --debug
# --config=config.toml
# -n --no-notice
2024-02-07 12:52:33 +08:00
parser = argparse.ArgumentParser(description=f"icalingua bot v{_version_}")
2024-01-25 22:08:02 +08:00
parser.add_argument("-d", "--debug", action="store_true")
parser.add_argument("-n", "--no-notice", action="store_true")
parser.add_argument("-c", "--config", type=str)
2024-01-07 18:48:44 +08:00
args = parser.parse_args()
if args.debug:
logger.global_level = 0
if args.config:
# global BOTCONFIG
BOTCONFIG: BotConfig = get_config(args.config)
if args.no_notice:
2024-02-02 21:47:43 +08:00
BOTCONFIG.notice_start = False
2024-02-02 22:23:51 +08:00
from connect import main
asyncio.run(main())
2024-02-02 21:47:43 +08:00