mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-26 14:26:06 +00:00
refactor: 独立长消息处理为longtext包
This commit is contained in:
@@ -21,6 +21,7 @@ from ..qqbot import adapter as msadapter
|
||||
from . import resprule
|
||||
from .bansess import bansess
|
||||
from .cntfilter import cntfilter
|
||||
from .longtext import longtext
|
||||
|
||||
from ..boot import app
|
||||
|
||||
@@ -46,6 +47,7 @@ class QQBotManager:
|
||||
|
||||
bansess_mgr: bansess.SessionBanManager = None
|
||||
cntfilter_mgr: cntfilter.ContentFilterManager = None
|
||||
longtext_pcs: longtext.LongTextProcessor = None
|
||||
|
||||
def __init__(self, first_time_init=True, ap: app.Application = None):
|
||||
config = context.get_config_manager().data
|
||||
@@ -53,6 +55,7 @@ class QQBotManager:
|
||||
self.ap = ap
|
||||
self.bansess_mgr = bansess.SessionBanManager(ap)
|
||||
self.cntfilter_mgr = cntfilter.ContentFilterManager(ap)
|
||||
self.longtext_pcs = longtext.LongTextProcessor(ap)
|
||||
|
||||
self.timeout = config['process_message_timeout']
|
||||
self.retry = config['retry_times']
|
||||
@@ -60,6 +63,7 @@ class QQBotManager:
|
||||
async def initialize(self):
|
||||
await self.bansess_mgr.initialize()
|
||||
await self.cntfilter_mgr.initialize()
|
||||
await self.longtext_pcs.initialize()
|
||||
|
||||
config = context.get_config_manager().data
|
||||
|
||||
@@ -149,6 +153,7 @@ class QQBotManager:
|
||||
await self.on_group_message(event)
|
||||
|
||||
asyncio.create_task(group_message_handler(event))
|
||||
|
||||
self.adapter.register_listener(
|
||||
GroupMessage,
|
||||
on_group_message
|
||||
|
||||
Reference in New Issue
Block a user