silly goober bot
1use reqwest::Client;
2use std::convert::AsRef;
3
4#[derive(Debug)]
5// User data, which is stored and accessible in all command invocations
6pub struct Data {
7 pub client: Client,
8 pub github_token: String,
9 pub kagi_cookie: Option<String>,
10}
11
12impl Data {
13 pub fn new() -> Self {
14 Self {
15 client: Client::builder()
16 .user_agent("isabelroses/blahaj")
17 .build()
18 .unwrap(),
19 github_token: crate::config::get().github_token.clone(),
20 kagi_cookie: crate::config::get().kagi_cookie.clone(),
21 }
22 }
23}
24
25pub type Context<'a> = poise::Context<'a, Data, color_eyre::eyre::Report>;
26
27// wrapper for reqwest::Client
28pub struct W<T>(pub T);
29
30impl AsRef<Client> for W<Client> {
31 fn as_ref(&self) -> &reqwest::Client {
32 &self.0
33 }
34}