📍 再再再次修复 profile 报错

This commit is contained in:
xtaodada 2020-04-01 22:11:13 +08:00
parent e8e94f3c95
commit 21d9ad9733
No known key found for this signature in database
GPG Key ID: 39EFACA711DF5D8C

View File

@ -206,15 +206,13 @@ async def profile(context):
f"受限制: {target_user.user.restricted} \n" \ f"受限制: {target_user.user.restricted} \n" \
f"类型: {user_type} \n" \ f"类型: {user_type} \n" \
f"[{first_name}](tg://user?id={target_user.user.id})" f"[{first_name}](tg://user?id={target_user.user.id})"
try:
reply_to = context.message.reply_to_msg_id
except:
reply_to is None
photo = await context.client.download_profile_photo( photo = await context.client.download_profile_photo(
target_user.user.id, target_user.user.id,
"./" + str(target_user.user.id) + ".jpg", "./" + str(target_user.user.id) + ".jpg",
download_big=True download_big=True
) )
try:
reply_to = context.message.reply_to_msg_id
try: try:
await context.client.send_file( await context.client.send_file(
context.chat_id, context.chat_id,
@ -231,3 +229,19 @@ async def profile(context):
return return
except TypeError: except TypeError:
await context.edit(caption) await context.edit(caption)
except:
try:
await context.client.send_file(
context.chat_id,
photo,
caption=caption,
link_preview=False,
force_document=False
)
if not photo.startswith("http"):
remove(photo)
await context.delete()
remove(photo)
return
except TypeError:
await context.edit(caption)