silly goober bot
1use reqwest::Client;
2use std::{convert::AsRef, env};
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}
10
11impl Data {
12 pub fn new() -> Self {
13 Self {
14 client: Client::builder()
15 .user_agent("isabelroses/blahaj")
16 .build()
17 .unwrap(),
18 github_token: env::var("GITHUB_TOKEN").expect("GITHUB_TOKEN not set"),
19 }
20 }
21}
22
23pub type Context<'a> = poise::Context<'a, Data, color_eyre::eyre::Report>;
24
25// wrapper for reqwest::Client
26pub struct W<T>(pub T);
27
28impl AsRef<Client> for W<Client> {
29 fn as_ref(&self) -> &reqwest::Client {
30 &self.0
31 }
32}