mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-16 23:40:59 +00:00
修改自定义提示语
This commit is contained in:
@@ -9,6 +9,9 @@ import json
|
|||||||
|
|
||||||
|
|
||||||
__command_list__ = {}
|
__command_list__ = {}
|
||||||
|
|
||||||
|
import tips_custom
|
||||||
|
|
||||||
"""命令树
|
"""命令树
|
||||||
|
|
||||||
结构:
|
结构:
|
||||||
@@ -262,7 +265,7 @@ def execute(context: Context) -> list:
|
|||||||
|
|
||||||
# 检查权限
|
# 检查权限
|
||||||
if ctx.privilege < node['privilege']:
|
if ctx.privilege < node['privilege']:
|
||||||
raise CommandPrivilegeError('权限不足: {}'.format(path))
|
raise CommandPrivilegeError(tips_custom.command_admin_message)
|
||||||
|
|
||||||
# 执行
|
# 执行
|
||||||
execed, reply = node['cls'].process(ctx)
|
execed, reply = node['cls'].process(ctx)
|
||||||
@@ -275,7 +278,7 @@ def execute(context: Context) -> list:
|
|||||||
path = path + '.' + ctx.crt_command
|
path = path + '.' + ctx.crt_command
|
||||||
except KeyError:
|
except KeyError:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
raise CommandPrivilegeError('找不到指令: {}'.format(path))
|
raise CommandPrivilegeError(tips_custom.command_err_message)
|
||||||
|
|
||||||
|
|
||||||
def register_all():
|
def register_all():
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ def process_command(session_name: str, text_message: str, mgr, config,
|
|||||||
try:
|
try:
|
||||||
reply = cmdmgr.execute(context)
|
reply = cmdmgr.execute(context)
|
||||||
except cmdmgr.CommandPrivilegeError as e:
|
except cmdmgr.CommandPrivilegeError as e:
|
||||||
reply = ["[bot]err:{}".format(e)]
|
reply = [format(e)]
|
||||||
|
|
||||||
return reply
|
return reply
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import pkg.utils.context
|
|||||||
|
|
||||||
import pkg.plugin.host as plugin_host
|
import pkg.plugin.host as plugin_host
|
||||||
import pkg.plugin.models as plugin_models
|
import pkg.plugin.models as plugin_models
|
||||||
|
import tips_custom
|
||||||
|
|
||||||
|
|
||||||
# 检查消息是否符合泛响应匹配机制
|
# 检查消息是否符合泛响应匹配机制
|
||||||
@@ -268,7 +269,7 @@ class QQBotManager:
|
|||||||
if failed == self.retry:
|
if failed == self.retry:
|
||||||
pkg.openai.session.get_session('person_{}'.format(event.sender.id)).release_response_lock()
|
pkg.openai.session.get_session('person_{}'.format(event.sender.id)).release_response_lock()
|
||||||
self.notify_admin("{} 请求超时".format("person_{}".format(event.sender.id)))
|
self.notify_admin("{} 请求超时".format("person_{}".format(event.sender.id)))
|
||||||
reply = ["[bot]err:请求超时"]
|
reply = tips_custom.reply_message
|
||||||
|
|
||||||
if reply:
|
if reply:
|
||||||
return self.send(event, reply, check_quote=False)
|
return self.send(event, reply, check_quote=False)
|
||||||
@@ -308,7 +309,7 @@ class QQBotManager:
|
|||||||
if failed == self.retry:
|
if failed == self.retry:
|
||||||
pkg.openai.session.get_session('group_{}'.format(event.group.id)).release_response_lock()
|
pkg.openai.session.get_session('group_{}'.format(event.group.id)).release_response_lock()
|
||||||
self.notify_admin("{} 请求超时".format("group_{}".format(event.group.id)))
|
self.notify_admin("{} 请求超时".format("group_{}".format(event.group.id)))
|
||||||
replys = ["[bot]err:请求超时"]
|
replys = tips_custom.replys_message
|
||||||
|
|
||||||
return replys
|
return replys
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import pkg.openai.session
|
|||||||
import pkg.plugin.host as plugin_host
|
import pkg.plugin.host as plugin_host
|
||||||
import pkg.plugin.models as plugin_models
|
import pkg.plugin.models as plugin_models
|
||||||
import pkg.qqbot.blob as blob
|
import pkg.qqbot.blob as blob
|
||||||
|
import tips_custom
|
||||||
|
|
||||||
|
|
||||||
def handle_exception(notify_admin: str = "", set_reply: str = "") -> list:
|
def handle_exception(notify_admin: str = "", set_reply: str = "") -> list:
|
||||||
@@ -15,7 +16,7 @@ def handle_exception(notify_admin: str = "", set_reply: str = "") -> list:
|
|||||||
pkg.utils.context.get_qqbot_manager().notify_admin(notify_admin)
|
pkg.utils.context.get_qqbot_manager().notify_admin(notify_admin)
|
||||||
if hasattr(config, 'hide_exce_info_to_user') and config.hide_exce_info_to_user:
|
if hasattr(config, 'hide_exce_info_to_user') and config.hide_exce_info_to_user:
|
||||||
if hasattr(config, 'alter_tip_message'):
|
if hasattr(config, 'alter_tip_message'):
|
||||||
return [config.alter_tip_message] if config.alter_tip_message else []
|
return [tips_custom.alter_tip_message] if tips_custom.alter_tip_message else []
|
||||||
else:
|
else:
|
||||||
return ["[bot]出错了,请重试或联系管理员"]
|
return ["[bot]出错了,请重试或联系管理员"]
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import pkg.plugin.models as plugin_models
|
|||||||
import pkg.qqbot.ignore as ignore
|
import pkg.qqbot.ignore as ignore
|
||||||
import pkg.qqbot.banlist as banlist
|
import pkg.qqbot.banlist as banlist
|
||||||
import pkg.qqbot.blob as blob
|
import pkg.qqbot.blob as blob
|
||||||
|
import tips_custom
|
||||||
|
|
||||||
processing = []
|
processing = []
|
||||||
|
|
||||||
@@ -118,7 +119,7 @@ def process_message(launcher_type: str, launcher_id: int, text_message: str, mes
|
|||||||
if hasattr(config, "rate_limitation") and config.rate_limit_strategy == "drop":
|
if hasattr(config, "rate_limitation") and config.rate_limit_strategy == "drop":
|
||||||
if ratelimit.is_reach_limit(session_name):
|
if ratelimit.is_reach_limit(session_name):
|
||||||
logging.info("根据限速策略丢弃[{}]消息: {}".format(session_name, text_message))
|
logging.info("根据限速策略丢弃[{}]消息: {}".format(session_name, text_message))
|
||||||
return MessageChain(["[bot]"+config.rate_limit_drop_tip]) if hasattr(config, "rate_limit_drop_tip") and config.rate_limit_drop_tip != "" else []
|
return MessageChain(["[bot]"+tips_custom.rate_limit_drop_tip]) if hasattr(tips_custom, "rate_limit_drop_tip") and tips_custom.rate_limit_drop_tip != "" else []
|
||||||
|
|
||||||
before = time.time()
|
before = time.time()
|
||||||
# 触发插件事件
|
# 触发插件事件
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import config
|
||||||
|
|
||||||
|
# ---------------------------------------------花里胡哨参数---------------------------------------------
|
||||||
|
# ---原config.py开始--
|
||||||
|
|
||||||
|
# 消息处理出错时向用户发送的提示信息,仅当hide_exce_info_to_user为True时生效
|
||||||
|
# 设置为空字符串时,不发送提示信息
|
||||||
|
# config.py,line:232
|
||||||
|
# pkg/qqbot/message.py,line:19
|
||||||
|
alter_tip_message = '天空一声巨响,魔法少女闪亮登场,唉呀脚滑了,疼~等会再来~(这是一条全世界最人见人爱花见花开玉树临风英俊潇洒美丽且可爱的出错提醒哦~)'
|
||||||
|
|
||||||
|
# drop策略时,超过限速均值时,丢弃的对话的提示信息,仅当rate_limitation_strategy为"drop"时生效
|
||||||
|
# 若设置为空字符串,则不发送提示信息
|
||||||
|
# config.py,line:265
|
||||||
|
# pkg/qqbot/process.py,line:122
|
||||||
|
rate_limit_drop_tip = "欧尼酱慢点我跟不上"
|
||||||
|
|
||||||
|
# 指令!help帮助消息
|
||||||
|
# config.py,line:279
|
||||||
|
# pkg/qqbot/process.py,line:122
|
||||||
|
help_message = """
|
||||||
|
这是一个很正经的帮助文档
|
||||||
|
此处省略10086字...
|
||||||
|
biu~biu~biu~""".format(config.session_expire_time // 60)
|
||||||
|
|
||||||
|
# ---原config.py结束--
|
||||||
|
|
||||||
|
# QChatGPT/pkg/qqbot/manager.py
|
||||||
|
# 私聊消息超时提示,line:271
|
||||||
|
reply_message = "天空一声巨响,魔法少女闪亮登场,哎呀脚滑了,疼~(这是一条全世界最人见人爱花见花开玉树临风英俊潇洒美丽且可爱的超时提醒哦。)"
|
||||||
|
# 群聊消息超时提示,line:310
|
||||||
|
replys_message = "天空一声巨响,魔法少女闪亮登场,哎呀脚滑了,疼~(这是一条全世界最人见人爱花见花开玉树临风英俊潇洒美丽且可爱的超时提醒哦。)"
|
||||||
|
|
||||||
|
# 指令权限不足/无效提示
|
||||||
|
# QChatGPT/pkg/qqbot/command.py,line:57
|
||||||
|
# 更改代码
|
||||||
|
# reply = [format(e)]
|
||||||
|
# QChatGPT/pkg/qqbot/cmds/mgr.py
|
||||||
|
# line:266,279
|
||||||
|
command_admin_message = "你居然想偷看我裙底?坏蛋,大坏蛋,超级大坏蛋,无敌超级大坏蛋,宇宙无敌超级大坏蛋。哼! "
|
||||||
|
command_err_message = "你又再想涩涩的事了?"
|
||||||
Reference in New Issue
Block a user