mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-20 02:55:08 +08:00
perf: 升级插件协议簇
This commit is contained in:
@@ -10,7 +10,7 @@ import util.plugin_util as putil
|
||||
import shutil
|
||||
import importlib
|
||||
from util import general_utils as gu
|
||||
|
||||
from model.platform.qq import QQ
|
||||
|
||||
PLATFORM_QQCHAN = 'qqchan'
|
||||
PLATFORM_GOCQ = 'gocq'
|
||||
@@ -34,12 +34,12 @@ class Command:
|
||||
except BaseException as e:
|
||||
raise e
|
||||
|
||||
def check_command(self, message, role, platform, message_obj, cached_plugins: dict):
|
||||
def check_command(self, message, role, platform, message_obj, cached_plugins: dict, qq_platform: QQ):
|
||||
# 插件
|
||||
|
||||
for k, v in cached_plugins.items():
|
||||
try:
|
||||
hit, res = v["clsobj"].run(message, role, platform, message_obj)
|
||||
hit, res = v["clsobj"].run(message, role, platform, message_obj, qq_platform)
|
||||
if hit:
|
||||
return True, res
|
||||
except BaseException as e:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from model.command.command import Command
|
||||
from model.provider.provider_openai_official import ProviderOpenAIOfficial
|
||||
from cores.qqbot.personality import personalities
|
||||
from model.platform.qq import QQ
|
||||
|
||||
class CommandOpenAIOfficial(Command):
|
||||
def __init__(self, provider: ProviderOpenAIOfficial):
|
||||
@@ -14,8 +15,9 @@ class CommandOpenAIOfficial(Command):
|
||||
role: str,
|
||||
platform: str,
|
||||
message_obj,
|
||||
cached_plugins: dict):
|
||||
hit, res = super().check_command(message, role, platform, message_obj=message_obj, cached_plugins=cached_plugins)
|
||||
cached_plugins: dict,
|
||||
qq_platform: QQ):
|
||||
hit, res = super().check_command(message, role, platform, message_obj=message_obj, cached_plugins=cached_plugins, qq_platform=qq_platform)
|
||||
if hit:
|
||||
return True, res
|
||||
if self.command_start_with(message, "reset", "重置"):
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from model.command.command import Command
|
||||
from model.provider.provider_rev_chatgpt import ProviderRevChatGPT
|
||||
from model.platform.qq import QQ
|
||||
|
||||
class CommandRevChatGPT(Command):
|
||||
def __init__(self, provider: ProviderRevChatGPT):
|
||||
@@ -11,8 +12,9 @@ class CommandRevChatGPT(Command):
|
||||
role: str,
|
||||
platform: str,
|
||||
message_obj,
|
||||
cached_plugins: dict):
|
||||
hit, res = super().check_command(message, role, platform, message_obj=message_obj, cached_plugins=cached_plugins)
|
||||
cached_plugins: dict,
|
||||
qq_platform: QQ):
|
||||
hit, res = super().check_command(message, role, platform, message_obj=message_obj, cached_plugins=cached_plugins, qq_platform=qq_platform)
|
||||
if hit:
|
||||
return True, res
|
||||
if self.command_start_with(message, "help", "帮助"):
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from model.command.command import Command
|
||||
from model.provider.provider_rev_edgegpt import ProviderRevEdgeGPT
|
||||
import asyncio
|
||||
from model.platform.qq import QQ
|
||||
|
||||
class CommandRevEdgeGPT(Command):
|
||||
def __init__(self, provider: ProviderRevEdgeGPT):
|
||||
self.provider = provider
|
||||
@@ -13,8 +15,9 @@ class CommandRevEdgeGPT(Command):
|
||||
role: str,
|
||||
platform: str,
|
||||
message_obj,
|
||||
cached_plugins: dict):
|
||||
hit, res = super().check_command(message, role, platform, message_obj=message_obj, cached_plugins=cached_plugins)
|
||||
cached_plugins: dict,
|
||||
qq_platform: QQ):
|
||||
hit, res = super().check_command(message, role, platform, message_obj=message_obj, cached_plugins=cached_plugins, qq_platform=qq_platform)
|
||||
if hit:
|
||||
return True, res
|
||||
if self.command_start_with(message, "reset"):
|
||||
|
||||
Reference in New Issue
Block a user