UNICT-DMI / Telegram-DMI-Bot

A telegram bot for the DMI students 🎓 (@DMI_Bot)
https://t.me/DMI_Bot
GNU General Public License v3.0
41 stars 30 forks source link

Improve /prof command #154

Closed Helias closed 1 year ago

Helias commented 3 years ago

send photo of the professor next to the info the photo is available in the website, exapmle: http://web.dmi.unict.it/docenti/gallo.giovanni

TendTo commented 3 years ago

There is a small issue in this idea: it would make sense to send a photo per professor (if available). But while right now all the search result are condensed in one message (or more, if it gets too long), sending one photo per professor could cause a FloodMessageError, and you can't really insert the photo in a text message

Helias commented 3 years ago

we could send the photo and in a second message the text

TendTo commented 3 years ago

The issue still stands. The problem is that a user could request all the professors. This means that the bot would need to send n photo/messages, and both would count toward the flood limit. You could send all the photos together with all the text, but it would defeat the purpose

Helias commented 3 years ago

oh right, we could send the photo only if the result is one

LightDestory commented 3 years ago

We could edit the database's structure to help us retriving the correct image. If we are able to perform http requests we can just add a column like "photo_id" and puts the related ids (example: Barbanera => 2 => http://web.dmi.unict.it/foto_docenti/2.jpg). Otherwise we can just compress and save base64 images inside the database as a "photo" column.

Regarding the FloodError I think we can only implement something like @Helias suggested, providing photo only if the query returns one row.