24 lines
605 B
Rust
24 lines
605 B
Rust
|
|
use crate::models::fueltank::Tip;
|
||
|
|
use crate::error::{ManifoldError, ManifoldResult};
|
||
|
|
use crate::{ManifoldContext, ManifoldData};
|
||
|
|
|
||
|
|
#[poise::command(slash_command, prefix_command, aliases("ft"))]
|
||
|
|
async fn frogtip(ctx: ManifoldContext<'_>) -> ManifoldResult<()> {
|
||
|
|
|
||
|
|
debug!("Processing tip");
|
||
|
|
|
||
|
|
let tank = ctx.data().frogtip_fueltank.lock().await;
|
||
|
|
|
||
|
|
let tip: &Tip = &tank.next_or_fill().await?;
|
||
|
|
|
||
|
|
debug!("Tip: {:?}", tip);
|
||
|
|
|
||
|
|
ctx.send(|f| f.content(format!("{}", tip)).reply(true)).await?;
|
||
|
|
|
||
|
|
Ok(())
|
||
|
|
}
|
||
|
|
|
||
|
|
pub fn commands() -> [poise::Command<ManifoldData, ManifoldError>; 1] {
|
||
|
|
[frogtip()]
|
||
|
|
}
|