use reqwest::Client; use std::convert::AsRef; #[derive(Debug)] // User data, which is stored and accessible in all command invocations pub struct Data { pub client: Client, pub github_token: String, pub kagi_cookie: Option, } impl Data { pub fn new() -> Self { Self { client: Client::builder() .user_agent("isabelroses/blahaj") .build() .unwrap(), github_token: crate::config::get().github_token.clone(), kagi_cookie: crate::config::get().kagi_cookie.clone(), } } } pub type Context<'a> = poise::Context<'a, Data, color_eyre::eyre::Report>; // wrapper for reqwest::Client pub struct W(pub T); impl AsRef for W { fn as_ref(&self) -> &reqwest::Client { &self.0 } }