1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use crate::{connectors::Client, token::Token};
use hyper::Uri;

const CLOUD_BOT_API: &str = "https://api.telegram.org/";

#[derive(Debug)]
pub struct InnerBot {
    token: Token,
    client: Client,
    uri: Uri,
}

impl InnerBot {
    pub fn new(token: Token, client: Client) -> Self {
        Self {
            token,
            client,
            uri: Uri::from_static(CLOUD_BOT_API),
        }
    }

    pub fn set_client(&mut self, client: Client) {
        self.client = client;
    }

    pub fn set_uri(&mut self, uri: Uri) {
        self.uri = uri;
    }

    pub fn token(&self) -> &str {
        &self.token.0
    }

    pub const fn client(&self) -> &Client {
        &self.client
    }

    pub fn uri(&self) -> Uri {
        self.uri.clone()
    }
}