Update
This commit is contained in:
parent
9c3134f73a
commit
ca28b068d3
8 changed files with 29 additions and 29 deletions
|
@ -75,8 +75,7 @@ async def parse_shorturl(shorturl):
|
|||
target_url = response.headers.get('Location')
|
||||
|
||||
video = re.search(r'/video/([^/?]+)', target_url)
|
||||
if video:
|
||||
url = f"{api_url}?bvid={video.group(1)}"
|
||||
return url
|
||||
if video:
|
||||
return f"?bvid={video.group(1)}"
|
||||
else:
|
||||
return False
|
||||
|
|
|
@ -11,4 +11,4 @@
|
|||
"bilibili.message.error.invalid": "An error occurred: Invalid video id. Please check your input.",
|
||||
"bilibili.message.error.rejected": "An error occurred: The request was rejected because of the Bilibili security control policy. Please try again later.\nIf the error persists, please contact the developers to resolve the issue.",
|
||||
"bilibili.message.not_found": "No corresponding video is found."
|
||||
}
|
||||
}
|
|
@ -9,6 +9,6 @@
|
|||
"bilibili.message": "标题:${title}\n类型:${tname}\nUP主:${owner}\n日期:${time}",
|
||||
"bilibili.message.detail": "标题:${title}${pages} | 类型:${tname}\nUP主:${owner} | 粉丝:${fans}\n简介:${desc}\n观看:${view} | 弹幕:${danmaku} | 评论:${reply}\n喜欢:${like} | 投币:${coin} | 收藏:${favorite} | 分享:${share}\n日期:${time}",
|
||||
"bilibili.message.error.invalid": "发生错误:视频编号无效,请检查输入。",
|
||||
"bilibili.message.error.rejected": "发生错误:由于触发哔哩哔哩安全风控策略,此次访问请求已被拒绝,请稍后重试。\n若错误持续存在,请联系开发者解决问题。",
|
||||
"bilibili.message.error.rejected": "发生错误:由于触发哔哩哔哩安全风控策略,此次访问请求已被拒绝,请稍后重试。\n如果错误持续存在,请联系开发者解决问题。",
|
||||
"bilibili.message.not_found": "未找到对应的视频。"
|
||||
}
|
||||
}
|
|
@ -9,6 +9,6 @@
|
|||
"bilibili.message": "標題:${title}\n類型:${tname}\nUP主:${owner}\n日期:${time}",
|
||||
"bilibili.message.detail": "標題:${title}${pages} | 類型:${tname}\nUP 主:${owner} | 追隨者:${fans}\n簡介:${desc}\n觀看:${view} | 彈幕:${danmaku} | 留言:${reply}\n喜歡:${like} | 投幣:${coin} | 收藏:${favorite} | 分享:${share}\n日期:${time}",
|
||||
"bilibili.message.error.invalid": "發生錯誤:影片編號無效,請校對輸入。",
|
||||
"bilibili.message.error.rejected": "發生錯誤:由於觸發嗶哩嗶哩安全風控策略,此次訪問請求已被拒絕,請稍後重試。\n若錯誤持續存在,請聯絡開發人員解決問題。",
|
||||
"bilibili.message.error.rejected": "發生錯誤:由於觸發嗶哩嗶哩安全風控策略,此次訪問請求已被拒絕,請稍後重試。\n如果錯誤持續存在,請聯絡開發人員解決問題。",
|
||||
"bilibili.message.not_found": "未找到對應的影片。"
|
||||
}
|
||||
}
|
|
@ -79,9 +79,9 @@
|
|||
"core.message.help.legacy.base": "Base Command: ",
|
||||
"core.message.help.legacy.external": "Module 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.",
|
||||
"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.more_information": "Here are the help documents shown only show the enabled module(s). If you need to view the help documents of all modules, please use \"${prefix}module list\".",
|
||||
"core.message.help.more_information.document": "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.not_found": "This module may not exist. Please check your input.",
|
||||
"core.message.help.regex.detail": "(${msg})",
|
||||
"core.message.help.regex.no_information": "No description",
|
||||
|
@ -109,7 +109,7 @@
|
|||
"core.message.module.load.failed": "Failed to load module.",
|
||||
"core.message.module.load.success": "Successfully loaded module(s): ${module}",
|
||||
"core.message.module.module.help": "Help information for module \"${module}\": ",
|
||||
"core.message.module.recommends": "It is recommended to enable the following module(s) at the same time: \n${msgs}\nProceed?",
|
||||
"core.message.module.recommends": "It is recommended to enable the following module(s) at the same time: \n${modules}\nProceed?",
|
||||
"core.message.module.reload.base": "Failed: \"${module}\" is a base module. To prevent exceptions in the bot, this operation has been blocked.",
|
||||
"core.message.module.reload.confirm": "This operation will reload the following modules at the same time: \n${modules}\nContinue?",
|
||||
"core.message.module.reload.failed": "Failed to reload module.",
|
||||
|
|
|
@ -79,9 +79,9 @@
|
|||
"core.message.help.legacy.base": "基础命令:",
|
||||
"core.message.help.legacy.external": "模块扩展命令:",
|
||||
"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": "此处展示的帮助文档仅展示已开启的模块,若需要查看全部模块的帮助文档,请使用“${prefix}module list”。",
|
||||
"core.message.help.more_information.document": "您也可以通过查阅在线文档获取帮助:\n${url}",
|
||||
"core.message.help.more_information.donate": "若您有经济实力,欢迎给孩子们在爱发电上打钱:\n${url}",
|
||||
"core.message.help.not_found": "此模块可能不存在,请检查输入。",
|
||||
"core.message.help.regex.detail": "(${msg})",
|
||||
"core.message.help.regex.no_information": "无描述",
|
||||
|
@ -109,7 +109,7 @@
|
|||
"core.message.module.load.failed": "加载模块失败。",
|
||||
"core.message.module.load.success": "成功加载模块:${module}",
|
||||
"core.message.module.module.help": "模块“${module}”的帮助信息:",
|
||||
"core.message.module.recommends": "建议同时开启以下模块:\n${msgs}\n是否一并开启?",
|
||||
"core.message.module.recommends": "建议同时开启以下模块:\n${modules}\n是否一并开启?",
|
||||
"core.message.module.reload.base": "失败:“${module}”模块为基础模块,为防止机器人发生异常,此操作已被阻止。",
|
||||
"core.message.module.reload.confirm": "该操作将额外同时重载以下模块:\n${modules}\n是否继续?",
|
||||
"core.message.module.reload.failed": "重载模块失败。",
|
||||
|
|
|
@ -79,9 +79,9 @@
|
|||
"core.message.help.legacy.base": "基礎指令:",
|
||||
"core.message.help.legacy.external": "模組擴充指令:",
|
||||
"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": "此處展示的說明文件僅展示已啟用的模組,若需要檢視全部模組的說明文件,請使用「${prefix}module list」。",
|
||||
"core.message.help.more_information.document": "您也可以透過查閱線上文件取得說明:\n${url}",
|
||||
"core.message.help.more_information.donate": "若您有經濟實力,歡迎在愛發電提供贊助:\n${url}",
|
||||
"core.message.help.not_found": "此模組可能不存在,請校對輸入。",
|
||||
"core.message.help.regex.detail": "(${msg})",
|
||||
"core.message.help.regex.no_information": "無描述",
|
||||
|
@ -109,7 +109,7 @@
|
|||
"core.message.module.load.failed": "載入模組失敗。",
|
||||
"core.message.module.load.success": "成功載入模組:${module}",
|
||||
"core.message.module.module.help": "模組「${module}」的說明資訊:",
|
||||
"core.message.module.recommends": "建議同時啟用以下模組:\n${msgs}\n是否一同啟用?",
|
||||
"core.message.module.recommends": "建議同時啟用以下模組:\n${modules}\n是否一同啟用?",
|
||||
"core.message.module.reload.base": "失败:「${module}」為基礎模組,為防止機器人發生異常,此行為已被阻擋。",
|
||||
"core.message.module.reload.confirm": "此操作將額外同時重新載入以下模組:\n${modules}\n是否繼續?",
|
||||
"core.message.module.reload.failed": "重新載入模組失敗。",
|
||||
|
|
|
@ -7,7 +7,6 @@ from core.component import module
|
|||
from core.exceptions import InvalidHelpDocTypeError
|
||||
from core.loader import ModulesManager, current_unloaded_modules, err_modules
|
||||
from core.parser.command import CommandParser
|
||||
from .utils import reload_locale
|
||||
from core.utils.i18n import load_locale_file
|
||||
from core.utils.image_table import ImageTable, image_table_render
|
||||
from database import BotDBUtil
|
||||
|
@ -173,7 +172,7 @@ async def config_modules(msg: Bot.MessageSession):
|
|||
msglist.append(msg.locale.t("core.message.module.disable.success", module=x))
|
||||
elif msg.parsed_msg.get('reload', False):
|
||||
if msg.check_super_user():
|
||||
def module_reload(module, extra_modules, base_mode=False):
|
||||
def module_reload(module, extra_modules):
|
||||
reload_count = ModulesManager.reload_module(module)
|
||||
if reload_count > 1:
|
||||
return msg.locale.t('core.message.module.reload.success', module=module) + \
|
||||
|
@ -189,7 +188,6 @@ async def config_modules(msg: Bot.MessageSession):
|
|||
return msg.locale.t("core.message.module.reload.failed")
|
||||
|
||||
for module_ in wait_config_list:
|
||||
base_mode = False
|
||||
if '-f' in msg.parsed_msg and msg.parsed_msg['-f']:
|
||||
msglist.append(module_reload(module_, []))
|
||||
elif module_ not in modules_:
|
||||
|
@ -203,13 +201,16 @@ async def config_modules(msg: Bot.MessageSession):
|
|||
confirm = await msg.wait_confirm(msg.locale.t("core.message.module.reload.confirm",
|
||||
modules='\n'.join(extra_reload_modules)), append_instruction=False)
|
||||
if not confirm:
|
||||
await msg.finish()
|
||||
return
|
||||
unloaded_list = CFG.get('unloaded_modules')
|
||||
if unloaded_list and module_ in unloaded_list:
|
||||
unloaded_list.remove(module_)
|
||||
CFG.write('unloaded_modules', unloaded_list)
|
||||
msglist.append(module_reload(module_, extra_reload_modules, base_mode))
|
||||
await reload_locale(msg)
|
||||
msglist.append(module_reload(module_, extra_reload_modules))
|
||||
|
||||
locale_err = load_locale_file()
|
||||
if len(locale_err) != 0:
|
||||
msglist.append(msg.locale.t("core.message.locale.reload.failed", detail='\n'.join(locale_err)))
|
||||
else:
|
||||
msglist.append(msg.locale.t("parser.superuser.permission.denied"))
|
||||
elif msg.parsed_msg.get('load', False):
|
||||
|
@ -262,7 +263,7 @@ async def config_modules(msg: Bot.MessageSession):
|
|||
unloaded_list.append(module_)
|
||||
CFG.write('unloaded_modules', unloaded_list)
|
||||
else:
|
||||
await msg.finish()
|
||||
return
|
||||
|
||||
else:
|
||||
msglist.append(msg.locale.t("parser.superuser.permission.denied"))
|
||||
|
@ -274,7 +275,7 @@ async def config_modules(msg: Bot.MessageSession):
|
|||
await msg.send_message('\n'.join(msglist))
|
||||
if recommend_modules_help_doc_list and ('-g' not in msg.parsed_msg or not msg.parsed_msg['-g']):
|
||||
confirm = await msg.wait_confirm(msg.locale.t("core.message.module.recommends",
|
||||
msgs='\n'.join(recommend_modules_list) + '\n\n' +
|
||||
modules='\n'.join(recommend_modules_list) + '\n\n' +
|
||||
'\n'.join(recommend_modules_help_doc_list)))
|
||||
if confirm:
|
||||
if msg.data.enable(recommend_modules_list):
|
||||
|
@ -283,7 +284,7 @@ async def config_modules(msg: Bot.MessageSession):
|
|||
msglist.append(msg.locale.t("core.message.module.enable.success", module=x))
|
||||
await msg.finish('\n'.join(msglist))
|
||||
else:
|
||||
await msg.finish()
|
||||
return
|
||||
|
||||
|
||||
hlp = module('help', base=True)
|
||||
|
@ -436,7 +437,7 @@ async def _(msg: Bot.MessageSession):
|
|||
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",
|
||||
help_msg_list.append(Plain(msg.locale.t("core.message.help.more_information.document",
|
||||
url=Config('help_url'))))
|
||||
if Config('donate_url'):
|
||||
help_msg_list.append(Plain(msg.locale.t("core.message.help.more_information.donate",
|
||||
|
@ -466,7 +467,7 @@ async def _(msg: Bot.MessageSession):
|
|||
if Config('help_url'):
|
||||
help_msg.append(
|
||||
msg.locale.t(
|
||||
"core.message.help.more_information.address",
|
||||
"core.message.help.more_information.document",
|
||||
url=Config('help_url')))
|
||||
await msg.finish('\n'.join(help_msg))
|
||||
|
||||
|
@ -548,6 +549,6 @@ async def modules_help(msg: Bot.MessageSession, legacy):
|
|||
if Config('help_url'):
|
||||
help_msg.append(
|
||||
msg.locale.t(
|
||||
"core.message.help.more_information.address",
|
||||
"core.message.help.more_information.document",
|
||||
url=Config('help_url')))
|
||||
await msg.finish('\n'.join(help_msg))
|
||||
|
|
Reference in a new issue