Skip to content

Commit 96ba8d7

Browse files
Copilotrexlunae
andcommitted
Tighten generic chat-system integration
Agent-Logs-Url: https://github.com/rexlunae/RustyClaw/sessions/50b8d6d4-601a-41eb-aa40-7cc3d19b26fe Co-authored-by: rexlunae <6726134+rexlunae@users.noreply.github.com>
1 parent 7233ab7 commit 96ba8d7

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

crates/rustyclaw-core/src/gateway/messenger_handler.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -269,27 +269,27 @@ fn generic_messenger_config(
269269
},
270270
)),
271271
#[cfg(feature = "whatsapp")]
272-
"whatsapp" => Some(chat_system_config::MessengerConfig::WhatsApp(
273-
chat_system_config::WhatsAppConfig {
274-
name: name.clone(),
275-
db_path: messenger_state_dir("whatsapp", &name)?
276-
.join(format!("{name}.db"))
277-
.to_string_lossy()
278-
.into_owned(),
279-
},
280-
)),
272+
"whatsapp" => {
273+
let db_path = whatsapp_state_dir(&name)?
274+
.join(format!("{name}.db"))
275+
.to_string_lossy()
276+
.into_owned();
277+
Some(chat_system_config::MessengerConfig::WhatsApp(
278+
chat_system_config::WhatsAppConfig { name, db_path },
279+
))
280+
}
281281
_ => None,
282282
};
283283

284284
Ok(messenger)
285285
}
286286

287287
#[cfg(feature = "whatsapp")]
288-
fn messenger_state_dir(kind: &str, name: &str) -> Result<std::path::PathBuf> {
288+
fn whatsapp_state_dir(name: &str) -> Result<std::path::PathBuf> {
289289
Ok(dirs::data_dir()
290290
.context("Failed to get data directory")?
291291
.join("rustyclaw")
292-
.join(kind)
292+
.join("whatsapp")
293293
.join(name))
294294
}
295295

0 commit comments

Comments
 (0)