diff --git a/src/commands/weather.rs b/src/commands/weather.rs index 03c8269..47bd1c3 100644 --- a/src/commands/weather.rs +++ b/src/commands/weather.rs @@ -1,4 +1,4 @@ -use chrono::{Timelike, Utc}; +use chrono::{NaiveDateTime, Timelike}; use poise::serenity_prelude::utils::Colour; use d20::roll_range; use poise::ReplyHandle; @@ -47,7 +47,9 @@ async fn weather(ctx: ManifoldContext<'_>, #[rest] #[description="Location to lo }); } - paginate(ctx, my_message, pages, (Utc::now().hour() + 1) as usize).await?; + let now = NaiveDateTime::parse_from_str(weather_forecast.current.last_updated.as_str(), "%Y-%m-%d %H:%M").unwrap_or(NaiveDateTime::default()); + + paginate(ctx, my_message, pages, (now.hour() + 1) as usize).await?; Ok(()) } diff --git a/src/helpers/mod.rs b/src/helpers/mod.rs index 3818bbd..e6c1c69 100644 --- a/src/helpers/mod.rs +++ b/src/helpers/mod.rs @@ -26,7 +26,7 @@ pub async fn paginate(ctx: ManifoldContext<'_>, message: ReplyHandle<'_>, pages: // button was pressed .filter(move |press| press.data.custom_id.starts_with(&ctx_id.to_string())) // Timeout when no navigation button has been pressed for 24 hours - .timeout(std::time::Duration::from_secs(3600 * 24)) + .timeout(std::time::Duration::from_secs(300)) .await { // Depending on which button was pressed, go to next or previous page