Archived
1
0
Fork 0
This commit is contained in:
多羅狼 2023-07-23 16:22:30 +08:00 committed by GitHub
parent e36855f7ab
commit c88762ef4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 14 deletions

View file

@ -117,7 +117,7 @@ async def _(event: Event):
async def _(event: Event):
if BotDBUtil.SenderInfo('QQ|' + str(event.user_id)).query.isSuperUser:
return {'approve': True}
if Config('invite_join_group_notice'):
if Config('qq_invite_join_group_notice'):
await bot.send_private_msg(user_id=event.user_id,
message='你好!本机器人暂时不主动同意入群请求。\n'
'请至https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=New&template=add_new_group.yaml&title=%5BNEW%5D%3A+申请入群。')

View file

@ -5,6 +5,7 @@
[secret]
db_path = "mysql+pymysql://"
proxy =
check_accessKeyId =
check_accessKeySecret =
web_render =
@ -17,6 +18,7 @@ openai_api_key =
nl2c_model =
curseforge_api_key =
exchange_rate_api_key =
wolfram_alpha_appid =
[cfg]
base_superuser = "QQ|2596322644"
@ -25,6 +27,7 @@ cache_path = "./cache/"
command_prefix = ["~", ""]
confirm_command = ["是", "对", "對", "yes", "Yes", "YES", "y", "Y"]
bug_report_url = "https://s.wd-ljt.com/botreportbug"
bug_report_targets =
donate_url = "https://afdian.net/@teahouse"
help_url = "https://bot.teahouse.team"
issue_url = "https://github.com/Teahouse-Studios/bot/issues/new/choose"
@ -33,6 +36,7 @@ rickroll_url = "https://wdf.ink/6OUp"
web_render_local =
qq_account = 2314163511
qq_host = "127.0.0.1:11451"
qq_invite_join_group_notice = true
qq_disable_temp_session = false
qq_enable_listening_self_message = false
allow_request_private_ip = false
@ -54,4 +58,3 @@ dice_output_cnt = 50
dice_output_len = 200
dice_detail_cnt = 5
dice_count_limit = 10
unloaded_modules =

View file

@ -357,7 +357,7 @@ async def parser(msg: Bot.MessageSession, require_enable_modules: bool = True, p
if bug_report_targets:
for target in bug_report_targets:
if f := await Bot.FetchTarget.fetch_target(target):
await f.sendDirectMessage(f'执行{msg.trigger_msg}时发生了以下错误,请及时处理:\n' + tb)
await f.sendDirectMessage(msg.locale.t('error.message.report', module=msg.trigger_msg) + tb)
if command_first_word in current_unloaded_modules and msg.checkSuperUser():
await msg.sendMessage(msg.locale.t('parser.module.unloaded', module=command_first_word, prefix=msg.prefixes[0]))
elif command_first_word in err_modules:
@ -464,8 +464,7 @@ async def parser(msg: Bot.MessageSession, require_enable_modules: bool = True, p
if bug_report_targets:
for target in bug_report_targets:
if f := await Bot.FetchTarget.fetch_target(target):
await f.sendDirectMessage(
f'执行{msg.trigger_msg}时发生了以下错误,请及时处理:\n' + tb)
await f.sendDirectMessage(msg.locale.t('error.message.report', module=msg.trigger_msg) + tb)
finally:
ExecutionLockList.remove(msg)

View file

@ -13,6 +13,7 @@
"error.message.chain.invalid": "机器人尝试发送非法消息链,请联系机器人开发者解决问题。",
"error.message.chain.plain.empty": "机器人尝试发送空文本消息,请联系机器人开发者解决问题。",
"error.message.chain.unsafe": "消息中含有不安全的内容,已被拦截。请向开发者反馈问题。",
"error.message.report": "执行“${module}”时发生了以下错误,请及时处理:\n",
"error.message.limited": "消息发送失败,可能被风控,请稍后再试。",
"error.message.paused": "群消息发送被服务器拦截,已暂停群消息发送,使用“${prefix}resume”恢复推送。",
"error.module.helpdoc.invalid": "“${module}”模块的帮助信息有误,请联系开发者处理。",

View file

@ -426,7 +426,6 @@ async def _(msg: Bot.MessageSession):
Plain(msg.locale.t("core.message.module.help.more_information",
prefix=msg.prefixes[0], help_url=Config('help_url'), donate_url=Config('donate_url')))])
except Exception:
await msg.sendMessage(msg.locale.t("core.message.module.help.error.render_failed"))
traceback.print_exc()
if legacy_help:
help_msg = [msg.locale.t("core.message.module.help.legacy.base")]
@ -446,7 +445,11 @@ async def _(msg: Bot.MessageSession):
"core.message.module.help.legacy.more_information",
prefix=msg.prefixes[0],
help_url=Config('help_url')))
await msg.finish('\n'.join(help_msg))
if msg.Feature.delete:
help_msg.append(msg.locale.t("core.message.module.help.revoke.legacy"))
send = await msg.sendMessage('\n'.join(help_msg))
await msg.sleep(60)
await send.delete()
async def modules_help(msg: Bot.MessageSession):
@ -531,4 +534,8 @@ async def modules_help(msg: Bot.MessageSession):
"core.message.module.help.legacy.more_information",
prefix=msg.prefixes[0],
help_url=Config('help_url')))
await msg.finish('\n'.join(help_msg))
if msg.Feature.delete:
help_msg.append(msg.locale.t("core.message.module.help.revoke.legacy"))
send = await msg.sendMessage('\n'.join(help_msg))
await msg.sleep(60)
await send.delete()

View file

@ -12,12 +12,14 @@ async def update_alias():
input_data = await get_url(url, 200, fmt='json')
output_data = {}
for key, value in input_data.items():
for v in value:
if v in output_data:
output_data[v].append(key)
else:
output_data[v] = [key]
for key, values in input_data.items():
for value in values:
if value == "未找到":
continue
if value not in output_data:
output_data[value] = []
output_data[value].append(key)
output_data = {k: output_data[k] for k in sorted(output_data)}
file_path = os.path.join(assets_path, "mai_alias.json")
with open(file_path, 'w') as file: