Archived
1
0
Fork 0
This commit is contained in:
多羅狼 2023-08-20 03:11:08 +08:00 committed by GitHub
parent 12baa78911
commit 55b30f6fa7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 17 deletions

View file

@ -31,7 +31,7 @@ async def _(msg: Bot.MessageSession):
else:
query_id = CytoidBindInfoManager(msg).get_bind_username()
if query_id is None:
await msg.finish(msg.locale.t('cytoid.message.user.unbound', prefix=msg.prefixes[0]))
await msg.finish(msg.locale.t('cytoid.message.user_unbound', prefix=msg.prefixes[0]))
if query:
if msg.target.targetFrom == 'TEST|Console':
c = 0

View file

@ -6,8 +6,7 @@
"cytoid.message.b30.cooldown": "距离上次执行已过去 ${time} 秒,本命令的冷却时间为 150 秒。(据官方人员所述,此 API 的调用十分昂贵,故手动做出此限制,请谅解。)",
"cytoid.message.bind.failed": "绑定失败,请检查输入。",
"cytoid.message.bind.success": "绑定成功:",
"cytoid.message.error.user_not_found": "发生错误:此用户不存在。",
"cytoid.message.unbind.success": "解绑成功。",
"cytoid.message.user.not_found": "用户不存在。",
"cytoid.message.user.unbound": "未绑定用户,请使用“${prefix}cytoid bind”绑定一个用户。"
"cytoid.message.user_not_found": "用户不存在。",
"cytoid.message.user_unbound": "未绑定用户,请使用“${prefix}cytoid bind”绑定一个用户。"
}

View file

@ -6,8 +6,7 @@
"cytoid.message.b30.cooldown": "距离上次执行已过去 ${time} 秒,本命令的冷却时间为 150 秒。(据官方人员所述,此 API 的调用十分昂贵,故手动做出此限制,请谅解。)",
"cytoid.message.bind.failed": "绑定失败,请检查输入。",
"cytoid.message.bind.success": "绑定成功:",
"cytoid.message.error.user_not_found": "发生错误:此用户不存在。",
"cytoid.message.unbind.success": "解绑成功。",
"cytoid.message.user.not_found": "用户不存在。",
"cytoid.message.user.unbound": "未绑定用户,请使用“${prefix}cytoid bind”绑定一个用户。"
"cytoid.message.user_not_found": "用户不存在。",
"cytoid.message.user_unbound": "未绑定用户,请使用“${prefix}cytoid bind”绑定一个用户。"
}

View file

@ -6,8 +6,7 @@
"cytoid.message.b30.cooldown": "距上次執行已過去 ${time} 秒,此指令的冷卻時間為 150 秒。(據官方人員所述,此 API 的呼叫十分昂貴,故手動做出此限制,請諒解。)",
"cytoid.message.bind.failed": "綁定失敗,請校對輸入。",
"cytoid.message.bind.success": "綁定成功:",
"cytoid.message.error.user_not_found": "發生錯誤:此使用者不存在。",
"cytoid.message.unbind.success": "解除綁定成功。",
"cytoid.message.user.not_found": "使用者不存在。",
"cytoid.message.user.unbound": "未綁定使用者,請使用「${prefix}cytoid bind」綁定一個使用者。"
"cytoid.message.user_not_found": "使用者不存在。",
"cytoid.message.user_unbound": "未綁定使用者,請使用「${prefix}cytoid bind」綁定一個使用者。"
}

View file

@ -13,13 +13,13 @@ async def cytoid_profile(msg: Bot.MessageSession):
else:
query_id = CytoidBindInfoManager(msg).get_bind_username()
if query_id is None:
await msg.finish(msg.locale.t('cytoid.message.user.unbound', prefix=msg.prefixes[0]))
await msg.finish(msg.locale.t('cytoid.message.user_unbound', prefix=msg.prefixes[0]))
profile_url = 'http://services.cytoid.io/profile/' + query_id
try:
profile = json.loads(await get_url(profile_url, status_code=200))
except ValueError as e:
if str(e).startswith('404'):
await msg.finish(msg.locale.t('cytoid.message.user.not_found'))
await msg.finish(msg.locale.t('cytoid.message.user_not_found'))
raise e
uid = profile['user']['uid']
nick = profile['user']['name']

View file

@ -29,7 +29,7 @@ async def get_rating(uid, query_type, msg: Bot.MessageSession):
Profile_json = json.loads(await get_url(Profile_url, 200))
if 'statusCode' in Profile_json:
if Profile_json['statusCode'] == 404:
return {'status': False, 'text': msg.locale.t('cytoid.message.error.user_not_found')}
return {'status': False, 'text': msg.locale.t('cytoid.message.user_not_found')}
ProfileId = Profile_json['user']['id']
ProfileRating = Profile_json['rating']
ProfileLevel = Profile_json['exp']['currentLevel']
@ -210,7 +210,7 @@ async def get_rating(uid, query_type, msg: Bot.MessageSession):
return {'status': True, 'path': savefilename}
except Exception as e:
traceback.print_exc()
return {'status': False, 'text': '发生错误:' + str(e)}
return {'status': False, 'text': msg.locale.t("error") + str(e)}
async def download_cover_thumb(uid):

View file

@ -401,7 +401,7 @@ async def generate(msg, payload) -> Tuple[Optional[Image.Image], bool]:
headers={'Content-Type': 'application/json', 'accept': '*/*'}, fmt='json')
except ValueError as e:
if str(e).startswith('400'):
if "qq" in payload and msg.target.targetFrom in ['QQ', 'QQ|Group', 'QQ|Guild']:
if "qq" in payload:
await msg.finish(msg.locale.t("maimai.message.user_unbound"))
else:
await msg.finish(msg.locale.t("maimai.message.user_not_found"))

View file

@ -60,7 +60,7 @@ async def get_record(msg, payload):
headers={'Content-Type': 'application/json', 'accept': '*/*'}, fmt='json')
except ValueError as e:
if str(e).startswith('400'):
if "qq" in payload and msg.target.targetFrom in ['QQ', 'QQ|Group', 'QQ|Guild']:
if "qq" in payload:
await msg.finish(msg.locale.t("maimai.message.user_unbound"))
else:
await msg.finish(msg.locale.t("maimai.message.user_not_found"))
@ -89,7 +89,7 @@ def get_cover(sid):
cover_url = f"https://www.diving-fish.com/covers/{get_cover_len5_id(sid)}.png"
cover_dir = f"./assets/maimai/static/mai/cover/"
cover_path = cover_dir + f'{get_cover_len5_id(sid)}.png'
if sid == '11364': #8-EM 的封面需要改动
if sid == '11364': #8-EM 的封面需要本地调用
return os.path.abspath(cover_path)
else:
return cover_url