MCPcopy Create free account
hub / github.com/GCWing/BitFun / restore_saved_bots

Function restore_saved_bots

src/apps/desktop/src/api/remote_connect_api.rs:72–100  ·  view source on GitHub ↗

Restore any bot connections that were previously saved to disk.

()

Source from the content-addressed store, hash-verified

70
71/// Restore any bot connections that were previously saved to disk.
72async fn restore_saved_bots() {
73 use bitfun_core::service::remote_connect::bot;
74
75 let data = bot::load_bot_persistence();
76 if data.connections.is_empty() {
77 return;
78 }
79
80 let holder = get_service_holder();
81 let guard = holder.read().await;
82 let Some(service) = guard.as_ref() else {
83 return;
84 };
85
86 for conn in &data.connections {
87 if !conn.chat_state.paired {
88 continue;
89 }
90 log::info!(
91 "Restoring {} bot connection for chat_id={}",
92 conn.bot_type,
93 conn.chat_id
94 );
95 let result = service.restore_bot(conn).await;
96 if let Err(e) = result {
97 log::warn!("Failed to restore {} bot: {e}", conn.bot_type);
98 }
99 }
100}
101
102/// Auto-detect the mobile-web build output directory.
103fn detect_mobile_web_dir() -> Option<String> {

Callers 1

ensure_serviceFunction · 0.85

Calls 5

load_bot_persistenceFunction · 0.85
get_service_holderFunction · 0.85
restore_botMethod · 0.80
is_emptyMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected