diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/api/mod.rs | 10 | ||||
| -rw-r--r-- | src/commands/version.rs | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/api/mod.rs b/src/api/mod.rs index 2ce664e..d9eaef2 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -3,13 +3,15 @@ use once_cell::sync::Lazy; pub mod guzzle; pub mod shiggy; -pub const USER_AGENT: &str = "teawieBot/"; - -pub static REQWEST_CLIENT: Lazy<reqwest::Client> = Lazy::new(|| { +pub static USER_AGENT: Lazy<String> = Lazy::new(|| { let version = option_env!("CARGO_PKG_VERSION").unwrap_or("development"); + format!("teawieBot/{version}") +}); + +pub static REQWEST_CLIENT: Lazy<reqwest::Client> = Lazy::new(|| { reqwest::Client::builder() - .user_agent(format!("{USER_AGENT}/{version}")) + .user_agent(format!("{:#?}", USER_AGENT)) .build() .unwrap_or_default() }); diff --git a/src/commands/version.rs b/src/commands/version.rs index c5e97f9..8d9a1f3 100644 --- a/src/commands/version.rs +++ b/src/commands/version.rs @@ -22,7 +22,7 @@ pub async fn version(ctx: Context<'_>) -> Result<()> { false, ), ("Revision:", &revision_url, false), - ("User Agent:", crate::api::USER_AGENT, false), + ("User Agent:", &crate::api::USER_AGENT, false), ]; ctx.send(|c| { |
