Archived
1
0
Fork 0

Merge pull request #30 from Teahouse-Studios/master

split str if have config url
This commit is contained in:
多羅狼 2024-01-13 00:53:23 +08:00 committed by GitHub
commit d8a6bd2208
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 87 additions and 51 deletions

View file

@ -40,7 +40,7 @@ donate_url = "https://afdian.net/@teahouse"
help_url = "https://bot.teahouse.team"
issue_url = "https://github.com/Teahouse-Studios/bot/issues/new/choose"
wiki_whitelist_url = "https://s.wd-ljt.com/botwhitelist"
rickroll_url = "https://wdf.ink/6OUp"
rickroll_msg = "https://wdf.ink/6OUp"
web_render_local =
qq_account = 2314163511
qq_host = "127.0.0.1:11451"

View file

@ -136,8 +136,9 @@ class ErrorMessage(EMsg):
if locale_str := re.findall(r'\{(.*)}', error_message):
for l in locale_str:
error_message = error_message.replace(f'{{{l}}}', locale.t(l))
self.error_message = locale.t('error.prompt', error_msg=error_message) + \
str(Url(Config('bug_report_url')))
self.error_message = locale.t('error') + error_message
if Config('bug_report_url'):
self.error_message += '\n' + locale.t('error.prompt.address', url=str(Url(Config('bug_report_url'))))
def __str__(self):
return self.error_message

View file

@ -160,7 +160,7 @@ async def check_bool(*text):
def rickroll(msg):
if Config("enable_rickroll") and Config("rickroll_url"):
return Config("rickroll_url")
if Config("enable_rickroll") and Config("rickroll_msg"):
return Config("rickroll_msg")
else:
return msg.locale.t("error.message.chain.unsafe")

View file

@ -357,8 +357,10 @@ async def parser(msg: Bot.MessageSession, require_enable_modules: bool = True, p
except Exception as e:
tb = traceback.format_exc()
Logger.error(tb)
await msg.send_message(msg.locale.t('error.prompt.report', err_msg=str(e)) +
str(Url(Config('bug_report_url'))))
errmsg = msg.locale.t('error.prompt', err_msg=str(e))
if Config('bug_report_url'):
errmsg += '\n' + msg.locale.t('error.prompt.address', url=str(Url(Config('bug_report_url'))))
await msg.send_message(errmsg)
if bug_report_targets:
for target in bug_report_targets:
if f := await Bot.FetchTarget.fetch_target(target):
@ -468,8 +470,10 @@ async def parser(msg: Bot.MessageSession, require_enable_modules: bool = True, p
except Exception as e:
tb = traceback.format_exc()
Logger.error(tb)
await msg.send_message(msg.locale.t('error.prompt.report', err_msg=str(e)) +
str(Url(Config('bug_report_url'))))
errmsg = msg.locale.t('error.prompt', err_msg=str(e))
if Config('bug_report_url'):
errmsg += '\n' + msg.locale.t('error.prompt.address', url=str(Url(Config('bug_report_url'))))
await msg.send_message(errmsg)
if bug_report_targets:
for target in bug_report_targets:
if f := await Bot.FetchTarget.fetch_target(target):

View file

@ -18,7 +18,7 @@ async def warn_target(msg: Bot.MessageSession, reason=None):
'tos.warning.count',
current_warns=current_warns,
warn_counts=WARNING_COUNTS))
if current_warns <= 2:
if current_warns <= 2 and Config('issue_url'):
warn_template.append(msg.locale.t('tos.warning.appeal', issue_url=Config('issue_url')))
if current_warns == WARNING_COUNTS:
warn_template.append(msg.locale.t('tos.warning.last'))

View file

@ -127,8 +127,7 @@ class Locale:
elif 'fallback' in key:
return key['fallback']
else:
return str(key) + self.t("i18n.prompt.fallback.failed", url=Config('bug_report_url'),
fallback=self.locale)
return str(key) + self.t("i18n.prompt.fallback.failed", fallback=self.locale)
localized = self.get_string_with_fallback(key, fallback_failed_prompt)
return Template(localized).safe_substitute(*args, **kwargs)
@ -148,8 +147,7 @@ class Locale:
if node:
return node.value # 2. 如果在 fallback 语言中本地化字符串存在,直接返回
if fallback_failed_prompt:
return f'{{{key}}}' + self.t("i18n.prompt.fallback.failed", url=Config('bug_report_url'),
fallback_failed_prompt=False)
return f'{{{key}}}' + self.t("i18n.prompt.fallback.failed", fallback_failed_prompt=False)
else:
return key
# 3. 如果在 fallback 语言中本地化字符串不存在,返回 key

View file

@ -23,9 +23,9 @@
"error.module.helpdoc.invalid": "\"${module}\" module provided invalid help information. Please contact the developers to solve this issue.",
"error.module.unbound": "\"${module}\" module is unbound with any commands and doesn't have the description. Please contact the developers to solve this issue.",
"error.module.unloaded": "\"${module}\" module failed to load. Please contact the developers to resolve this issue.",
"error.prompt": "An error occurred: ${error_msg}\nReport this issue: ",
"error.prompt.address": "Report this issue: ${url}",
"error.prompt.noreport": "An error occurred while executing the command:\n${err_msg}\nThis error is not caused by the bot (e.g. the API request went wrong) and thus should not be reported to developers.",
"error.prompt.report": "An error occurred while executing the command. Please report the following to developers:\n${err_msg}\nReport this issue: ",
"error.prompt": "An error occurred while executing the command. Please report the following to developers:\n${err_msg}",
"error.range.invalid": "An error occurred: Invalid number range.",
"example": "Hello world!",
"failed": "Failed.",
@ -33,7 +33,7 @@
"game.message.running": "This game is currently in progress.",
"game.message.stop": "Stopped.",
"game.message.stop.none": "This game is not in progress.",
"i18n.prompt.fallback.failed": "(If you're seeing this strange string, it means something we've messed up!\nPlease send the issue back to\n${url}\nso that we can fix it in time.)",
"i18n.prompt.fallback.failed": "(If you're seeing this strange string, it means something we've messed up!\nPlease send the issue back so that we can fix it in time.)",
"language": "English",
"message.brackets": " (${msg})",
"message.collapse": "...show only the first ${amount} items.",

View file

@ -23,9 +23,9 @@
"error.module.helpdoc.invalid": "“${module}”模块的帮助信息有误,请联系开发者处理。",
"error.module.unbound": "“${module}”模块未绑定任何命令且无简介,请联系开发者处理。",
"error.module.unloaded": "“${module}”模块加载失败,请联系开发者解决问题。",
"error.prompt": "发生错误:${error_msg}\n错误汇报地址",
"error.prompt.address": "错误汇报地址:${url}",
"error.prompt.noreport": "执行命令时发生错误:\n${err_msg}\n此问题并非机器人程序错误API 请求出错等),请勿将此消息报告给机器人开发者。",
"error.prompt.report": "执行命令时发生错误,请报告机器人开发者:\n${err_msg}\n错误汇报地址",
"error.prompt": "执行命令时发生错误,请报告机器人开发者:\n${err_msg}",
"error.range.invalid": "发生错误:无效的数字区间。",
"example": "你好世界!",
"failed": "失败。",
@ -33,7 +33,7 @@
"game.message.running": "当前此游戏正在进行中。",
"game.message.stop": "已停止。",
"game.message.stop.none": "当前此游戏未在进行。",
"i18n.prompt.fallback.failed": "(如果你看到了这条奇怪的字符串,说明我们又搞错了什么东西!\n请将问题反馈至\n${url}\n以便我们快速解决此问题。)",
"i18n.prompt.fallback.failed": "(如果你看到了这条奇怪的字符串,说明我们又搞砸了什么!\n请反馈此问题以便快速解决。)",
"language": "简体中文",
"message.brackets": "${msg}",
"message.collapse": "……仅显示前 ${amount} 条内容。",

View file

@ -23,9 +23,9 @@
"error.module.helpdoc.invalid": "「${module}」模組的說明資訊有誤,請聯絡開發人員處理。",
"error.module.unbound": "「${module}」模組未綁定任何指令且無簡介,請聯絡開發人員處理。",
"error.module.unloaded": "「${module}」模組載入失敗,請聯絡開發人員解決問題。",
"error.prompt": "發生錯誤:${error_msg}\n錯誤回報網址",
"error.prompt.address": "錯誤回報網址:${url}",
"error.prompt.noreport": "執行指令時發生錯誤:\n${err_msg}\n此問題並非機器人程式錯誤API 請求錯誤等),請勿將此訊息回報給機器人開發人員。",
"error.prompt.report": "執行指令時發生錯誤,請回報機器人開發人員:\n${err_msg}\n錯誤回報網址",
"error.prompt": "執行指令時發生錯誤,請回報機器人開發人員:\n${err_msg}",
"error.range.invalid": "發生錯誤:無效的數字區間。",
"example": "你好世界!",
"failed": "失敗。",
@ -33,7 +33,7 @@
"game.message.running": "目前此遊戲正在進行。",
"game.message.stop": "已停止。",
"game.message.stop.none": "目前此遊戲沒有在進行。",
"i18n.prompt.fallback.failed": "(如果你看到了這條奇怪的字串,說明我們又搞錯了什麼!\n請將問題回報至\n${url}\n以便我們快速解決此問題。)",
"i18n.prompt.fallback.failed": "(如果你看到了這條奇怪的字串,說明我們又搞砸了什麼!\n請回報此問題以便快速解決。)",
"language": "繁體中文",
"message.brackets": "${msg}",
"message.collapse": "……僅顯示前 ${amount} 條內容。",

View file

@ -57,7 +57,7 @@ if Config('openai_api_key'):
if not Config('openai_api_key'):
raise ConfigValueError(msg.locale.t('error.config.secret.not_found'))
if not is_superuser and msg.data.petal <= 0: # refuse
await msg.finish(msg.locale.t('core.message.petal.no_petals') + Config('issue_url'))
await msg.finish(msg.locale.t('core.message.petal.no_petals'))
qc = CoolDown('call_openai', msg)
c = qc.check(60)

View file

@ -31,7 +31,7 @@ if Config('enable_langsmith'):
if not Config('openai_api_key'):
raise ConfigValueError(msg.locale.t('error.config.secret.not_found'))
if not is_superuser and msg.data.petal <= 0: # refuse
await msg.finish(msg.locale.t('core.message.petal.no_petals') + Config('issue_url'))
await msg.finish(msg.locale.t('core.message.petal.no_petals'))
qc = CoolDown('call_openai', msg)
c = qc.check(60)

View file

@ -74,11 +74,13 @@
"core.message.forward_msg.enable": "Forward message enabled.",
"core.message.help.author.type1": "Module author: ",
"core.message.help.author.type2": "Module Author",
"core.message.help.helpdoc.address": "Online module document: ${help_url}",
"core.message.help.helpdoc.address": "Online module document: ${url}",
"core.message.help.legacy.availables": "Currently available module(s):",
"core.message.help.legacy.base": "Base Command: ",
"core.message.help.legacy.external": "Extension Command: ",
"core.message.help.legacy.more_information": "Use \"${prefix}help <module name>\" to view details.\nUse \"${prefix}module list\" to view all available modules.\nYou can also consult the web documentation for help:\n${help_url}",
"core.message.help.more_information.address": "You can also consult the web documentation for help:\n${url}",
"core.message.help.more_information.donate": "If you have sufficient funds, welcome to sponsor us: \n${url}",
"core.message.help.legacy.more_information": "Use \"${prefix}help <module name>\" to view details.\nUse \"${prefix}module list\" to view all available modules.}",
"core.message.help.more_information": "This framework is powered by akari-bot. This self-built version is only for authorized group chats. The content generated by Bot has nothing to do with the developer of this bot or the owner of the server, and does not represent the position of the developer or the self-built version operation and maintenance party.\n This fork project is in: https://github.com/TopRealm/akari-bot, we appreciate your contributions.",
"core.message.help.not_found": "This module may not exist. Please check your input.",
"core.message.help.regex.detail": "(${msg})",
@ -127,7 +129,7 @@
"core.message.petal": "${petal} petal(s) remain in the group ${group}.",
"core.message.petal.modify": " Successfully modified ${add_petal} petals for target group ${group}, now ${group} has ${petal} petals.",
"core.message.petal.modify.self": " Successfully modified ${add_petal} petals for this group, now this group has ${petal} petals.",
"core.message.petal.no_petals": "There are not enough petals in the group. If you need to add petals, please go here to send your application:",
"core.message.petal.no_petals": "There are not enough petals in the group. ",
"core.message.petal.self": "${petal} petal(s) remain in this group.",
"core.message.ping.detail": "System startup time: ${system_boot_time}\nBot is running: ${bot_running_time}\nPython version: ${python_version}\nProcessor model: ${cpu_brand}\nCurrent processor usage: ${cpu_usage}%\nPhysical memory: ${ram}M Utilized: ${ram_percent}%\nSwap memory: ${swap}M Utilized: ${swap_percent}%\nDisk capacity: ${disk_space}G/${disk_space_total}G",
"core.message.ping.failed": "Failed to fetch.",

View file

@ -74,11 +74,13 @@
"core.message.forward_msg.enable": "已开启转发消息。",
"core.message.help.author.type1": "模块作者:",
"core.message.help.author.type2": "模块作者",
"core.message.help.helpdoc.address": "在线模块文档:${help_url}",
"core.message.help.helpdoc.address": "在线模块文档:${url}",
"core.message.help.legacy.availables": "当前可用的模块有:",
"core.message.help.legacy.base": "基础命令:",
"core.message.help.legacy.external": "模块扩展命令:",
"core.message.help.legacy.more_information": "使用“${prefix}help <对应模块名>”查看详细信息。\n使用“${prefix}module list”查看所有的可用模块。\n您也可以通过查阅在线文档获取帮助\n${help_url}",
"core.message.help.legacy.more_information": "使用“${prefix}help <对应模块名>”查看详细信息。\n使用“${prefix}module list”查看所有的可用模块。",
"core.message.help.more_information.address": "您也可以通过查阅在线文档获取帮助:\n${url}",
"core.message.help.more_information.donate": "若您有经济实力,欢迎给孩子们在爱发电上打钱:\n${url}",
"core.message.help.more_information": "本框架由akari-bot驱动。本自搭建版本仅供已授权的群聊使用Bot生成内容与本bot开发者、服务器所有人无关亦不代表开发者或自搭建版本运维方立场。\n本分支项目维护代码地址https://github.com/TopRealm/akari-bot欢迎贡献模块。",
"core.message.help.not_found": "此模块可能不存在,请检查输入。",
"core.message.help.regex.detail": "${msg}",
@ -127,7 +129,7 @@
"core.message.petal": "当前群组 ${group} 的花瓣数为:${petal}。",
"core.message.petal.modify": "已为群组 ${group} 修改了 ${add_petal} 花瓣,当前花瓣数为:${petal}。",
"core.message.petal.modify.self": "已为本群组修改了 ${add_petal} 花瓣,当前花瓣数为:${petal}。",
"core.message.petal.no_petals": "群组内的花瓣不足,若需要添加花瓣,请前往此处申请:",
"core.message.petal.no_petals": "群组内的花瓣不足",
"core.message.petal.self": "当前本群组的花瓣数为:${petal}。",
"core.message.ping.detail": "系统启动时间:${system_boot_time}\n机器人已运行${bot_running_time}\nPython 版本:${python_version}\n处理器型号${cpu_brand}\n当前处理器使用率${cpu_usage}%\n物理内存${ram}M 使用率:${ram_percent}%\nSwap 内存:${swap}M 使用率:${swap_percent}%\n磁盘容量${disk_space}G/${disk_space_total}G",
"core.message.ping.failed": "获取失败。",

View file

@ -74,11 +74,13 @@
"core.message.forward_msg.enable": "已啟用轉發訊息。",
"core.message.help.author.type1": "模組作者:",
"core.message.help.author.type2": "模組作者",
"core.message.help.helpdoc.address": "線上模組說明文件:${help_url}",
"core.message.help.helpdoc.address": "線上模組說明文件:${url}",
"core.message.help.legacy.availables": "目前可用的模組有:",
"core.message.help.legacy.base": "基礎指令:",
"core.message.help.legacy.external": "模組擴充指令:",
"core.message.help.legacy.more_information": "使用「${prefix}help <對應模組名>」檢視詳細資訊。\n使用「${prefix}module list」檢視所有的可用模組。\n您也可以透過查閱線上文件取得說明\n${help_url}",
"core.message.help.more_information.address": "您也可以透過查閱線上文件取得說明:\n${url}",
"core.message.help.more_information.donate": "若您有經濟實力,歡迎在愛發電提供贊助:\n${url}",
"core.message.help.legacy.more_information": "使用「${prefix}help <對應模組名>」檢視詳細資訊。\n使用「${prefix}module list」檢視所有的可用模組。",
"core.message.help.more_information": "本框架由akari-bot驅動。本自搭建版本僅供已授權的群聊使用Bot生成內容與本bot開發者、伺服器所有人無關亦不代表開發者或自搭建版本運維方立場。\n本分支專案維護程式碼地址https://github.com/TopRealm/akari-bot歡迎貢獻模組。",
"core.message.help.not_found": "此模組可能不存在,請校對輸入。",
"core.message.help.regex.detail": "${msg}",
@ -127,7 +129,7 @@
"core.message.petal": "目前群組 ${group} 的花瓣數為:${petal}。",
"core.message.petal.modify": "已為群組 ${group} 修改了 ${add_petal} 花瓣,目前花瓣數為:${petal}。",
"core.message.petal.modify.self": "已為本群組修改了 ${add_petal} 花瓣,目前花瓣數為:${petal}。",
"core.message.petal.no_petals": "群組內的花瓣不足,若需要增加花瓣,請前往此處申請:",
"core.message.petal.no_petals": "群組內的花瓣不足,",
"core.message.petal.self": "目前本群組的花瓣數為:${petal}。",
"core.message.ping.detail": "系統啟動時間:${system_boot_time}\n機器人已運行${bot_running_time}\nPython 版本:${python_version}\n處理器型號${cpu_brand}\n目前處理器使用率${cpu_usage}%\n物理記憶體${ram}M 使用率:${ram_percent}%\nSwap 記憶體:${swap}M 使用率:${swap_percent}%\n磁碟容量${disk_space}G/${disk_space_total}G",
"core.message.ping.failed": "取得失敗。",

View file

@ -338,8 +338,11 @@ async def bot_help(msg: Bot.MessageSession):
devs_msg = '\n' + msg.locale.t("core.message.help.author.type1") + devs
else:
devs_msg = ''
wiki_msg = '\n' + msg.locale.t("core.message.help.helpdoc.address",
help_url=Config('help_url')) + '/' + help_name
if Config('help_url'):
wiki_msg = '\n' + msg.locale.t("core.message.help.helpdoc.address",
url=Config('help_url')) + '/' + help_name
else:
wiki_msg = ''
if len(doc) > 500 and msg.Feature.image:
try:
tables = [ImageTable([[doc, '\n'.join(malias), devs]],
@ -354,7 +357,11 @@ async def bot_help(msg: Bot.MessageSession):
traceback.print_exc()
if malias:
doc += f'\n{msg.locale.t("core.help.alias")}\n' + '\n'.join(malias)
await msg.finish((doc + devs_msg + wiki_msg).lstrip())
doc_msg = (doc + devs_msg + wiki_msg).lstrip()
if doc_msg != '':
await msg.finish(doc_msg)
else:
await msg.finish(msg.locale.t("core.help.none"))
else:
await msg.finish(msg.locale.t("core.message.help.not_found"))
@ -426,10 +433,15 @@ async def _(msg: Bot.MessageSession):
render = await image_table_render(tables)
if render:
legacy_help = False
await msg.finish([Image(render),
Plain(msg.locale.t("core.message.help.more_information",
prefix=msg.prefixes[0], help_url=Config('help_url'),
donate_url=Config('donate_url')))])
help_msg_list = [Image(render), Plain(msg.locale.t("core.message.help.more_information",
prefix=msg.prefixes[0]))]
if Config('help_url'):
help_msg_list.append(Plain(msg.locale.t("core.message.help.more_information.address",
url=Config('help_url'))))
if Config('donate_url'):
help_msg_list.append(Plain(msg.locale.t("core.message.help.more_information.donate",
url=Config('donate_url'))))
await msg.finish(msg_list)
except Exception:
traceback.print_exc()
if legacy_help:
@ -450,8 +462,12 @@ async def _(msg: Bot.MessageSession):
help_msg.append(
msg.locale.t(
"core.message.help.legacy.more_information",
prefix=msg.prefixes[0],
help_url=Config('help_url')))
prefix=msg.prefixes[0]))
if Config('help_url'):
help_msg.append(
msg.locale.t(
"core.message.help.more_information.address",
url=Config('help_url')))
await msg.finish('\n'.join(help_msg))
@ -528,6 +544,10 @@ async def modules_help(msg: Bot.MessageSession, legacy):
help_msg.append(
msg.locale.t(
"core.message.help.legacy.more_information",
prefix=msg.prefixes[0],
help_url=Config('help_url')))
prefix=msg.prefixes[0]))
if Config('help_url'):
help_msg.append(
msg.locale.t(
"core.message.help.more_information.address",
url=Config('help_url')))
await msg.finish('\n'.join(help_msg))

View file

@ -26,7 +26,7 @@ async def _(msg: Bot.MessageSession):
if not Config('openai_api_key'):
raise ConfigValueError(msg.locale.t('error.config.secret.not_found'))
if not is_superuser and msg.data.petal <= 0: # refuse
await msg.finish(msg.locale.t('core.message.petal.no_petals') + Config('issue_url'))
await msg.finish(msg.locale.t('core.message.petal.no_petals'))
qc = CoolDown('call_openai', msg)
c = qc.check(60)

View file

@ -112,6 +112,7 @@
"wiki.message.wiki_audit.remove.failed": "Failed, this wiki does not exist in ${list_name}:",
"wiki.message.wiki_audit.remove.failed.other": "Failed, this wiki does not exist in Whitelist, the Whitelist of this wiki may come from other wikis of the same domain:",
"wiki.message.wiki_audit.remove.success": "Successfully removed from ${list_name}:",
"wiki.message.wiki_audit.untrust": "Note: This wiki is not currently in the Whitelist, and the returned content will be restricted when querying this wiki.\nIf you need to remove restrictions, please apply for Whitelist here:",
"wiki.message.wiki_audit.untrust": "Note: This wiki is not currently in the Whitelist, and the returned content will be restricted when querying this wiki.",
"wiki.message.wiki_audit.untrust.address": "If you need to remove restrictions, please apply for Whitelist here: \n${url}",
"wiki.message.wiki_inline.flies": "This page includes the following files: ${file}"
}

View file

@ -112,6 +112,7 @@
"wiki.message.wiki_audit.remove.failed": "失败,此 Wiki 不存在于${list_name}中:",
"wiki.message.wiki_audit.remove.failed.other": "失败,此 Wiki 不存在于白名单中,此 Wiki 的白名单可能来自其他同一域名的 Wiki",
"wiki.message.wiki_audit.remove.success": "成功从${list_name}删除:",
"wiki.message.wiki_audit.untrust": "注意:此 Wiki 当前没有加入机器人的白名单列表中,查询此 Wiki 时将会对返回内容进行限制。\n如需取消限制请在此处申请白名单\n",
"wiki.message.wiki_audit.untrust": "注意:此 Wiki 当前没有加入机器人的白名单列表中,查询此 Wiki 时将会对返回内容进行限制。",
"wiki.message.wiki_audit.untrust.address": "如需取消限制,请在此处申请白名单:\n${url}",
"wiki.message.wiki_inline.flies": "此页面包括以下文件:${file}"
}

View file

@ -112,6 +112,7 @@
"wiki.message.wiki_audit.remove.failed": "失敗,此 Wiki 不存在於${list_name}中:",
"wiki.message.wiki_audit.remove.failed.other": "失敗,此 Wiki 不存在於白名單中,此 Wiki 的白名單可能來自其他同一域名的 Wiki",
"wiki.message.wiki_audit.remove.success": "成功從${list_name}刪除:",
"wiki.message.wiki_audit.untrust": "注意:此 Wiki 目前沒有加入機器人的白名單列表中,查詢此 Wiki 時將會對返回內容進行限制。\n如需取消限制請在此處申請白名單",
"wiki.message.wiki_audit.untrust": "注意:此 Wiki 目前沒有加入機器人的白名單列表中,查詢此 Wiki 時將會對返回內容進行限制。",
"wiki.message.wiki_audit.untrust.address": "如需取消限制,請在此處申請白名單:\n${url}",
"wiki.message.wiki_inline.flies": "此頁面含有以下檔案:${file}"
}

View file

@ -18,7 +18,9 @@ async def set_start_wiki(msg: Bot.MessageSession):
if not check.value.in_blocklist or check.value.in_allowlist:
result = WikiTargetInfo(msg).add_start_wiki(check.value.api)
if result and enable_urlmanager and not check.value.in_allowlist and msg.target.sender_from in ['QQ', 'Kook']:
prompt = '\n' + msg.locale.t("wiki.message.wiki_audit.untrust") + Config("wiki_whitelist_url")
prompt = '\n' + msg.locale.t("wiki.message.wiki_audit.untrust")
if Config("wiki_whitelist_url"):
prompt += '\n' + msg.locale.t("wiki.message.wiki_audit.untrust.address", url=Config("wiki_whitelist_url"))
else:
prompt = ''
await msg.finish(msg.locale.t("wiki.message.set.success", name=check.value.name) + prompt)
@ -40,7 +42,9 @@ async def _(msg: Bot.MessageSession):
if not check.value.in_blocklist or check.value.in_allowlist:
result = target.config_interwikis(iw, check.value.api, let_it=True)
if result and enable_urlmanager and not check.value.in_allowlist and msg.target.sender_from in ['QQ', 'Kook']:
prompt = '\n' + msg.locale.t("wiki.message.wiki_audit.untrust") + Config("wiki_whitelist_url")
prompt = '\n' + msg.locale.t("wiki.message.wiki_audit.untrust")
if Config("wiki_whitelist_url"):
prompt += '\n' + msg.locale.t("wiki.message.wiki_audit.untrust.address", url=Config("wiki_whitelist_url"))
else:
prompt = ''
await msg.finish(msg.locale.t("wiki.message.iw.add.success", iw=iw, name=check.value.name) + prompt)