print(ans.fwd_messages)
print(ans.reply_message)
if ans.reply_message is not None or ans.fwd_messages is not None:
if ans.reply_message is not None:
txt = ans.reply_message
from_id = ans.reply_message
else:
txt = ans.fwd_messages[0].text
from_id = ans.fwd_messages[0].from_id
if '-' not in f"{from_id}" and from_id > 0:
user = await bot.api.request("users.get", {"user_ids": from_id, "fields": "photo_max_orig"})
full_name = f"{user[0]['first_name']} {user[0]['last_name']}"
else:
if '-' not in f"{from_id}":
user = await bot.api.request("groups.getById", {"group_ids": from_id, "fields": "photo_max_orig"})
full_name = user[0]["name"]
else:
user = await bot.api.request("groups.getById", {"group_ids": str(from_id).replace("-", "club"), "fields": "photo_max_orig"})
full_name = user[0]["name"]
#Остальная часть команды цитата
#from_id - это id человека на чьё сообщение ответили или переслали
else:
await ans('Используй данную команду отвечая на сообщение')
if '-' not in ans.reply_message.from_id:
user = await bot.api.request("groups.getById", {"group_ids": ans.reply_message.from_id, "fields": "photo_max_orig"})
full_name = user[0]["name"]
else:
user = await bot.api.request("groups.getById", {"group_ids": str(ans.reply_message.from_id).replace("-", "club"), "fields": "photo_max_orig"})
full_name = user[0]["name"]
if ans.reply_message.text is not None:
#весь остальной код команды цитата
if ans.reply_message.from_id > 0:
user = await bot.api.request("users.get", {"user_ids": ans.reply_message.from_id, "fields": "photo_max_orig"})
full_name = f"{user[0]['first_name']} {user[0]['last_name']}"
else:
user = await bot.api.request("groups.getById", {"group_ids": ans.reply_message.from_id, "fields":
"photo_max_orig"})
full_name = user[0]["name"]
a = quote(txt, f"{full_name} (с)")
txt = ans.reply_message.text
if ans.reply_message.from_id > 0:
user = await bot.api.request("users.get", {"user_ids": ans.reply_message.from_id, "fields": "photo_max_orig"})
else:
user = await bot.api.request("groups.getById", {"group_ids": ans.reply_message.from_id, "fields": "photo_max_orig"})
p = requests.get(user[0]['photo_max_orig'])
out = open(r'rus.jpg', "wb")
out.write(p.content)
out.close()
if len(txt) >= 239:
txt = txt[:239]
a = quote(txt, f"{user[0]['first_name']} {user[0]['last_name']} (с)")
a.get('rus.jpg')
photo = await photo_uploader.upload_message_photo('qresult.jpg')
await ans(attachment=photo)