📍 再再再次修复 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,28 +206,42 @@ 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: try:
await context.client.send_file( reply_to = context.message.reply_to_msg_id
context.chat_id, try:
photo, await context.client.send_file(
caption=caption, context.chat_id,
link_preview=False, photo,
force_document=False, caption=caption,
reply_to=reply_to link_preview=False,
) force_document=False,
if not photo.startswith("http"): reply_to=reply_to
)
if not photo.startswith("http"):
remove(photo)
await context.delete()
remove(photo) remove(photo)
await context.delete() return
remove(photo) except TypeError:
return await context.edit(caption)
except TypeError: except:
await context.edit(caption) 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)