mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 03:32:33 +08:00
refactor: 不再向QQBotManager中传递config中可读的参数
This commit is contained in:
parent
91746448a3
commit
016391c976
4
main.py
4
main.py
|
@ -193,9 +193,7 @@ def start(first_time_init=False):
|
|||
pkg.openai.session.load_sessions()
|
||||
|
||||
# 初始化qq机器人
|
||||
qqbot = pkg.qqbot.manager.QQBotManager(mirai_http_api_config=config.mirai_http_api_config,
|
||||
timeout=config.process_message_timeout, retry=config.retry_times,
|
||||
first_time_init=first_time_init)
|
||||
qqbot = pkg.qqbot.manager.QQBotManager(first_time_init=first_time_init)
|
||||
|
||||
# 加载插件
|
||||
import pkg.plugin.host
|
||||
|
|
|
@ -73,9 +73,12 @@ class QQBotManager:
|
|||
ban_person = []
|
||||
ban_group = []
|
||||
|
||||
def __init__(self, mirai_http_api_config: dict, timeout: int = 60, retry: int = 3, first_time_init=True):
|
||||
self.timeout = timeout
|
||||
self.retry = retry
|
||||
def __init__(self, first_time_init=True):
|
||||
import config
|
||||
|
||||
mirai_http_api_config = config.mirai_http_api_config
|
||||
self.timeout = config.process_message_timeout
|
||||
self.retry = config.retry_times
|
||||
|
||||
# 加载禁用列表
|
||||
if os.path.exists("banlist.py"):
|
||||
|
@ -195,9 +198,6 @@ class QQBotManager:
|
|||
|
||||
self.unsubscribe_all = unsubscribe_all
|
||||
|
||||
def go(self, func, *args, **kwargs):
|
||||
self.pool.submit(func, *args, **kwargs)
|
||||
|
||||
def first_time_init(self, mirai_http_api_config: dict):
|
||||
"""热重载后不再运行此函数"""
|
||||
if 'adapter' not in mirai_http_api_config or mirai_http_api_config['adapter'] == "WebSocketAdapter":
|
||||
|
|
|
@ -5,6 +5,7 @@ import mirai.models.bus
|
|||
import asyncio
|
||||
import typing
|
||||
|
||||
|
||||
class YiriMiraiAdapter(MessageSourceAdapter):
|
||||
"""YiriMirai适配器"""
|
||||
bot: mirai.Mirai
|
||||
|
|
Loading…
Reference in New Issue
Block a user