fix unsended images
This commit is contained in:
parent
4b9580100a
commit
ea565b8633
@ -95,7 +95,12 @@ pub async fn check_image(msg: Message, bot: Bot) -> anyhow::Result<()> {
|
|||||||
bot.delete_message(msg.chat.id, msg.id).await?;
|
bot.delete_message(msg.chat.id, msg.id).await?;
|
||||||
let response = match id {
|
let response = match id {
|
||||||
Some(i) => bot.send_photo(msg.chat.id, teloxide::types::InputFile::file_id(i.0)).has_spoiler(true),
|
Some(i) => bot.send_photo(msg.chat.id, teloxide::types::InputFile::file_id(i.0)).has_spoiler(true),
|
||||||
None => return Ok(()),
|
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?;
|
append_text(response, msg).await?;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user