mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-20 11:26:07 +00:00
refactor: 不再向QQBotManager中传递config中可读的参数
This commit is contained in:
@@ -193,9 +193,7 @@ def start(first_time_init=False):
|
|||||||
pkg.openai.session.load_sessions()
|
pkg.openai.session.load_sessions()
|
||||||
|
|
||||||
# 初始化qq机器人
|
# 初始化qq机器人
|
||||||
qqbot = pkg.qqbot.manager.QQBotManager(mirai_http_api_config=config.mirai_http_api_config,
|
qqbot = pkg.qqbot.manager.QQBotManager(first_time_init=first_time_init)
|
||||||
timeout=config.process_message_timeout, retry=config.retry_times,
|
|
||||||
first_time_init=first_time_init)
|
|
||||||
|
|
||||||
# 加载插件
|
# 加载插件
|
||||||
import pkg.plugin.host
|
import pkg.plugin.host
|
||||||
|
|||||||
@@ -73,9 +73,12 @@ class QQBotManager:
|
|||||||
ban_person = []
|
ban_person = []
|
||||||
ban_group = []
|
ban_group = []
|
||||||
|
|
||||||
def __init__(self, mirai_http_api_config: dict, timeout: int = 60, retry: int = 3, first_time_init=True):
|
def __init__(self, first_time_init=True):
|
||||||
self.timeout = timeout
|
import config
|
||||||
self.retry = retry
|
|
||||||
|
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"):
|
if os.path.exists("banlist.py"):
|
||||||
@@ -195,9 +198,6 @@ class QQBotManager:
|
|||||||
|
|
||||||
self.unsubscribe_all = unsubscribe_all
|
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):
|
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":
|
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 asyncio
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
|
|
||||||
class YiriMiraiAdapter(MessageSourceAdapter):
|
class YiriMiraiAdapter(MessageSourceAdapter):
|
||||||
"""YiriMirai适配器"""
|
"""YiriMirai适配器"""
|
||||||
bot: mirai.Mirai
|
bot: mirai.Mirai
|
||||||
|
|||||||
Reference in New Issue
Block a user