diff --git a/swordfish/build.rs b/swordfish/build.rs index d8a252f..16f6894 100644 --- a/swordfish/build.rs +++ b/swordfish/build.rs @@ -1,5 +1,15 @@ +use std::process::Command; + + // Example custom build script. fn main() { + // Get the git commit hash (short) + let output = Command::new("git") + .args(&["rev-parse", "--short", "HEAD"]) + .output() + .expect("Failed to execute git command"); + let git_hash = String::from_utf8(output.stdout).unwrap(); + println!("cargo:rustc-env=GIT_HASH={}", git_hash); println!( "cargo:rustc-env=BUILD_PROFILE={}", std::env::var("PROFILE").unwrap() diff --git a/swordfish/src/main.rs b/swordfish/src/main.rs index 049c759..7f332c7 100644 --- a/swordfish/src/main.rs +++ b/swordfish/src/main.rs @@ -368,11 +368,12 @@ async fn debug(ctx: &Context, msg: &Message) -> CommandResult { #[command] async fn info(ctx: &Context, msg: &Message) -> CommandResult { let reply_str = format!( - "Swordfish v{} - {}\n\ + "Swordfish v{} ({}) - {}\n\ Log level: `{}`\n\ Build type: `{}`\n\n\ Like my work? Consider supporting me at my [Ko-fi](https://ko-fi.com/tretrauit) or [Patreon](https://patreon.com/tretrauit)!", env!("CARGO_PKG_VERSION"), + env!("GIT_HASH"), GITHUB_URL, CONFIG.get().unwrap().log.level.clone().as_str(), env!("BUILD_PROFILE"),