pokepark / PokemonRaidBot

Telegram bot for organizing Raids in Pokémon Go. Developers & admins are welcome to join https://t.me/PokeParkSupport
https://t.me/PokeParkSupport
GNU Affero General Public License v3.0
48 stars 40 forks source link

Raidpicture: If gym picture is not availible it won't share #268

Closed klablabla closed 1 year ago

klablabla commented 2 years ago

To reproduce: Add gym with portal bot. Delete the picture manuel and eave the img_url in the database. Cou can't share any raid on that gym anymore.

Possible solutions:

  1. Check if gym picture is availible, if not set img_url to NULL and use the default picture.
  2. Function to check and redownload all the missing gyms.
Ninjasoturi commented 2 years ago

In commit e606f52 I improved the raidpicture.php to no longer crash when the gym image fails to load, and it now uses the fallback image instead.

Unfortunately the portal import functionality doesn't save the gym image URLs that we could use to redownload all the images. Adding such functionality would require querying Ingress API with the portal ID somehow, I don't know if that is possible.

Chefkeks commented 2 years ago

But saving the gym image URL shouldn't be an issue in general and pretty easy to solve.

We just need to extend the gyms table with a new column (e.g. web_url or something like that as we a already have img_url) and always save the url then there. Won't update existing gyms of course.

Anyway, we require a new column in gyms table and need to store $portal_image (https://github.com/pokepark/PokemonRaidBot/blob/main/mods/importal.php#L40) independently from $config->RAID_PICTURE_STORE_GYM_IMAGES_LOCALLY in the new column. Anything else can stay as it is.

Once that is done we need the function to redownload all the missing gym images and also save/update the url in the new (web_url) column. That said, I don't know how easy it might is to do that.