fix unsended images

This commit is contained in:
Guillermo Roche 2023-11-11 19:28:30 +01:00
parent 4b9580100a
commit ea565b8633
Signed by: groche97
GPG Key ID: 041FB85BEEA4B9B0

View File

@ -95,7 +95,12 @@ pub async fn check_image(msg: Message, bot: Bot) -> anyhow::Result<()> {
bot.delete_message(msg.chat.id, msg.id).await?;
let response = match id {
Some(i) => bot.send_photo(msg.chat.id, teloxide::types::InputFile::file_id(i.0)).has_spoiler(true),
None => {
match msg.photo().unwrap().iter().max_by_key(|p| p.width) {
Some(f) => bot.send_photo(msg.chat.id, teloxide::types::InputFile::file_id(f.file.id.clone())).has_spoiler(true),
None => return Ok(()),
}
},
};
append_text(response, msg).await?;
}