From 1832ee94ef814d63f6dc80c48e01d527dbb28ff8 Mon Sep 17 00:00:00 2001 From: Xyon Date: Thu, 24 Aug 2023 09:59:08 +0100 Subject: [PATCH] Consume injected caller version through and blend into own --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 5a09db5..61fdb6f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -64,12 +64,13 @@ pub struct ManifoldDataInner { database: Db, responses: Responses, user_info: Mutex, + version_string: String, } pub type ManifoldContext<'a> = poise::Context<'a, ManifoldData, ManifoldError>; pub type ManifoldCommand = poise::Command; -pub async fn prepare_client(arguments: ArgMatches, intents: GatewayIntents, injected_commands: Vec) -> ManifoldResult> { +pub async fn prepare_client(arguments: ArgMatches, intents: GatewayIntents, injected_commands: Vec, caller_version_string: String) -> ManifoldResult> { let bot_environment = arguments.get_one("environment").unwrap(); let config_file = format!("config/{}", arguments.get_one::("config-file").unwrap()); @@ -119,11 +120,13 @@ pub async fn prepare_client(arguments: ArgMatches, intents: GatewayIntents, inje let db = Db { pool }; apply_migrations(&mut db.get()?); let user_info = UserInfo::load(&db).expect("Could not load user info, rejecting"); + let git_info: String = built_info::GIT_VERSION.unwrap_or("unknown").to_string(); Ok(ManifoldData(Arc::new(ManifoldDataInner { bot_config: config, database: db, responses, user_info: Mutex::new(user_info), + version_string: format!("{caller} (Manifold framework version {mfold_ver} built at {mfold_time} from revision {mfold_rev})", caller=caller_version_string, mfold_ver=built_info::PKG_VERSION, mfold_time=built_info::BUILT_TIME_UTC, mfold_rev=git_info), }))) }) });