Zachdehooge / NadoBot

A Discord.py bot that pulls nadocast data
3 stars 2 forks source link

(Update): Logs, Fallback, User Info for Fallback #9

Closed Arch881010 closed 2 months ago

Arch881010 commented 2 months ago

This should fix #8. How? Created a fallback to the previous time (18z -> 12z, 12z -> 0z, etc) and used those images instead. Also created some logs to help track this info.

Example log:

2024-07-11 15:22:22.755464 - Fetching images for 18z (from http://data.nadocast.com/202407/20240711/t18z/) 
2024-07-11 15:22:22.845909 - Previous URL was 404, had to fallback, fetching images for 12z (from http://data.nadocast.com/202407/20240711/t12z/) 
2024-07-11 15:22:22.846909 - Images for 12z have already been downloaded, returning them instead of downloading new ones. 
2024-07-11 15:22:24.170061 - Fetching images for 18z (from http://data.nadocast.com/202407/20240711/t18z/) 
2024-07-11 15:22:24.254512 - Previous URL was 404, had to fallback, fetching images for 12z (from http://data.nadocast.com/202407/20240711/t12z/) 
2024-07-11 15:22:24.257607 - Images for 12z have already been downloaded, returning them instead of downloading new ones. 
2024-07-11 15:22:26.022429 - Fetching images for 18z (from http://data.nadocast.com/202407/20240711/t18z/) 
2024-07-11 15:22:26.107704 - Previous URL was 404, had to fallback, fetching images for 12z (from http://data.nadocast.com/202407/20240711/t12z/) 
2024-07-11 15:22:26.108714 - Images for 12z have already been downloaded, returning them instead of downloading new ones. 

User also gets notified if we had to rollback a time range. Stating that f"Sorry! It appears Nadocast hasn't uploaded the images for {timeNow}z, here are {hour}z's instead!" Where {timeNow} is the inital request, {hour} is what is sent back.

Arch881010 commented 2 months ago

Forgot to ignore logs, 1 sec