mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 00:35:36 +00:00
netease rape vip yvlu 修复错误
This commit is contained in:
parent
ac6cf7b671
commit
dbf85f32b4
@ -272,7 +272,7 @@
|
||||
},
|
||||
{
|
||||
"name": "neteasedown",
|
||||
"version": "1.223",
|
||||
"version": "1.224",
|
||||
"section": "daily",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "11.4 kb",
|
||||
@ -472,7 +472,7 @@
|
||||
},
|
||||
{
|
||||
"name": "rape",
|
||||
"version": "1.032",
|
||||
"version": "1.033",
|
||||
"section": "chat",
|
||||
"maintainer": "Pentacene",
|
||||
"size": "4.0 kb",
|
||||
@ -682,7 +682,7 @@
|
||||
},
|
||||
{
|
||||
"name": "yvlu",
|
||||
"version": "1.21",
|
||||
"version": "1.211",
|
||||
"section": "chat",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "10.4 kb",
|
||||
|
@ -219,12 +219,12 @@ async def ned(context):
|
||||
song_id = int(song_id)
|
||||
else:
|
||||
search_data = apis.cloudsearch.GetSearchResult(song_id, CloudSearchType(1), 1)
|
||||
if search_data["result"]["songCount"] >= 1:
|
||||
if search_data.get("result", {}).get("songCount", 0) >= 1:
|
||||
song_id = search_data["result"]["songs"][0]["id"]
|
||||
else:
|
||||
await context.edit(f"**没有找到歌曲**,请检查歌曲名称是否正确。")
|
||||
return
|
||||
# 获取歌曲信息小于等于 320k HQ
|
||||
# 获取歌曲质量是否大于 320k HQ
|
||||
track_info = apis.track.GetTrackAudio([song_id], bitrate=3200 * 1000 if flac_mode else 320000)
|
||||
# 获取歌曲详情
|
||||
song_info = apis.track.GetTrackDetail([song_id])
|
||||
|
30
rape.py
30
rape.py
@ -20,10 +20,17 @@ async def rape(context):
|
||||
reply = await context.get_reply_message()
|
||||
if context.is_group:
|
||||
if reply:
|
||||
if reply.sender.last_name is None:
|
||||
reply_last_name = ''
|
||||
else:
|
||||
reply_last_name = reply.sender.last_name
|
||||
try:
|
||||
if reply.sender.last_name is None:
|
||||
reply_last_name = ''
|
||||
else:
|
||||
reply_last_name = reply.sender.last_name
|
||||
except AttributeError:
|
||||
try:
|
||||
await context.edit('无法获取所回复的用户。')
|
||||
except:
|
||||
pass
|
||||
return
|
||||
if context.sender.last_name is None:
|
||||
context_last_name = ''
|
||||
else:
|
||||
@ -68,10 +75,17 @@ async def rape(context):
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
if context.sender.last_name is None:
|
||||
context_last_name = ''
|
||||
else:
|
||||
context_last_name = context.sender.last_name
|
||||
try:
|
||||
if context.sender.last_name is None:
|
||||
context_last_name = ''
|
||||
else:
|
||||
context_last_name = context.sender.last_name
|
||||
except AttributeError:
|
||||
try:
|
||||
await context.edit('无法获取所回复的用户。')
|
||||
except:
|
||||
pass
|
||||
return
|
||||
if context.arguments == '':
|
||||
return
|
||||
else:
|
||||
|
6
vip.py
6
vip.py
@ -3,6 +3,7 @@ from redis.exceptions import ConnectionError
|
||||
from requests import get
|
||||
from os import remove
|
||||
from telethon.tl.types import MessageMediaPhoto
|
||||
from asyncio.exceptions import TimeoutError
|
||||
from pagermaid import bot, redis, redis_status
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import obtain_message, alias_command
|
||||
@ -314,7 +315,10 @@ async def az_tts(context, mode):
|
||||
return
|
||||
async with bot.conversation('PagerMaid_Modify_bot') as conversation:
|
||||
await conversation.send_message('/tts ' + message + mode)
|
||||
chat_response = await conversation.get_response()
|
||||
try:
|
||||
chat_response = await conversation.get_response()
|
||||
except TimeoutError:
|
||||
return await context.edit("未收到服务器回应。")
|
||||
await bot.send_read_acknowledge(conversation.chat_id)
|
||||
if reply:
|
||||
await context.respond(chat_response, reply_to=reply)
|
||||
|
6
yvlu.py
6
yvlu.py
@ -8,6 +8,7 @@ from telethon.errors import YouBlockedUserError, ForbiddenError, FloodWaitError,
|
||||
from telethon.tl.functions.contacts import UnblockRequest
|
||||
from telethon.tl.functions.users import GetFullUserRequest
|
||||
from telethon.tl.types import MessageMediaPhoto, MessageMediaWebPage
|
||||
from asyncio.exceptions import TimeoutError
|
||||
from pagermaid import bot
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
@ -138,7 +139,10 @@ async def yv_lu(context):
|
||||
return await context.edit("无权限转发消息。")
|
||||
except:
|
||||
return await context.edit("未知错误。")
|
||||
chat_response = await conversation.get_response(message=send_for.id)
|
||||
try:
|
||||
chat_response = await conversation.get_response(message=send_for.id)
|
||||
except TimeoutError:
|
||||
return await context.edit("未收到服务器回应。")
|
||||
await bot.send_read_acknowledge(conversation.chat_id)
|
||||
await bot.send_message(context.chat_id, chat_response, reply_to=context.message.reply_to_msg_id)
|
||||
await context.delete()
|
||||
|
Loading…
Reference in New Issue
Block a user