qq_bot/bots/
secret_key.rs

1use super::*;
2
3impl QQSecret {
4    pub fn channel_id(&self) -> u64 {
5        if cfg!(debug_assertions) { self.test.channel_id } else { self.deploy.channel_id }
6    }
7    pub fn guild_id(&self) -> u64 {
8        if cfg!(debug_assertions) { self.test.guild_id } else { self.deploy.guild_id }
9    }
10    pub fn as_request(&self, method: Method, url: Url) -> RequestBuilder {
11        Client::default()
12            .request(method, url)
13            .header(USER_AGENT, "BotNodeSDK/v2.9.4")
14            .header(AUTHORIZATION, self.bot_token())
15            // .header(CONTENT_TYPE, "application/json")
16            // .bearer_auth(&self.bot_secret)
17            .timeout(Duration::from_secs(3))
18    }
19    pub fn bot_token(&self) -> String {
20        format!("Bot {}.{}", self.bot_app_id, self.bot_token)
21    }
22
23    pub fn bot_bearer(&self) -> String {
24        self.bot_secret.to_string()
25    }
26}