neteasedown rape 修复错误

This commit is contained in:
xtaodada 2021-12-12 13:24:40 +08:00
parent fd0ea183c2
commit 5c04749c37
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
3 changed files with 7 additions and 4 deletions

View File

@ -272,7 +272,7 @@
}, },
{ {
"name": "neteasedown", "name": "neteasedown",
"version": "1.222", "version": "1.223",
"section": "daily", "section": "daily",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "11.4 kb", "size": "11.4 kb",
@ -472,7 +472,7 @@
}, },
{ {
"name": "rape", "name": "rape",
"version": "1.031", "version": "1.032",
"section": "chat", "section": "chat",
"maintainer": "Pentacene", "maintainer": "Pentacene",
"size": "4.0 kb", "size": "4.0 kb",

View File

@ -213,13 +213,13 @@ async def ned(context):
# 搜索歌曲 # 搜索歌曲
# 判断是否使用最高比特率解析 # 判断是否使用最高比特率解析
flac_mode = True if context.arguments.find("-f") != -1 else False flac_mode = True if context.arguments.find("-f") != -1 else False
song_id = context.arguments.replace("-f", "").strip() song_id = context.arguments.replace("-f", "").replace("\u200b", "").strip()
# id # id
if song_id.isdigit(): if song_id.isdigit():
song_id = int(song_id) song_id = int(song_id)
else: else:
search_data = apis.cloudsearch.GetSearchResult(song_id, CloudSearchType(1), 1) search_data = apis.cloudsearch.GetSearchResult(song_id, CloudSearchType(1), 1)
if len(search_data["result"]["songs"]) == 1: if search_data["result"]["songCount"] >= 1:
song_id = search_data["result"]["songs"][0]["id"] song_id = search_data["result"]["songs"][0]["id"]
else: else:
await context.edit(f"**没有找到歌曲**,请检查歌曲名称是否正确。") await context.edit(f"**没有找到歌曲**,请检查歌曲名称是否正确。")

View File

@ -39,6 +39,9 @@ async def rape(context):
except ChatAdminRequiredError: except ChatAdminRequiredError:
await context.edit('无管理员权限。') await context.edit('无管理员权限。')
return return
except:
await context.edit('无法踢出。')
return
await context.client.send_message( await context.client.send_message(
context.chat_id, context.chat_id,
f'[{reply.sender.first_name} {reply_last_name}](tg://user?id={reply.sender.id}) 已被移出群聊', f'[{reply.sender.first_name} {reply_last_name}](tg://user?id={reply.sender.id}) 已被移出群聊',