-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Expand file tree
/
Copy pathmod.rs
More file actions
75 lines (73 loc) · 2.81 KB
/
mod.rs
File metadata and controls
75 lines (73 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
pub use zeroclaw_channels::orchestrator::*;
#[cfg(feature = "channel-matrix")]
pub mod matrix;
#[cfg(feature = "channel-telegram")]
pub mod telegram;
pub mod session_backend {
pub use zeroclaw_infra::session_backend::*;
}
pub mod session_sqlite {
pub use zeroclaw_infra::session_sqlite::*;
}
use crate::config::Config;
use anyhow::Result;
pub async fn handle_command(command: crate::ChannelCommands, config: &Config) -> Result<()> {
match command {
crate::ChannelCommands::Start => {
anyhow::bail!("Start must be handled in main.rs (requires async runtime)")
}
crate::ChannelCommands::Doctor => {
anyhow::bail!("Doctor must be handled in main.rs (requires async runtime)")
}
crate::ChannelCommands::List => {
println!("Channels:");
println!(" ✅ CLI (always available)");
for (channel, configured) in config.channels.channels() {
println!(
" {} {}",
if configured { "✅" } else { "❌" },
channel.name()
);
}
// Notion is a top-level config section, not part of ChannelsConfig
{
let notion_configured =
config.notion.enabled && !config.notion.database_id.trim().is_empty();
println!(" {} Notion", if notion_configured { "✅" } else { "❌" });
}
if !cfg!(feature = "channel-matrix") {
println!(
" ℹ️ Matrix channel support is disabled in this build (enable `channel-matrix`)."
);
}
if !cfg!(feature = "channel-lark") {
println!(
" ℹ️ Lark/Feishu channel support is disabled in this build (enable `channel-lark`)."
);
}
println!("\nTo start channels: zeroclaw channel start");
println!("To check health: zeroclaw channel doctor");
println!("To configure: zeroclaw onboard");
Ok(())
}
crate::ChannelCommands::Add {
channel_type,
config: _,
} => {
anyhow::bail!(
"Channel type '{channel_type}' — use `zeroclaw onboard` to configure channels"
);
}
crate::ChannelCommands::Remove { name } => {
anyhow::bail!("Remove channel '{name}' — edit ~/.zeroclaw/config.toml directly");
}
crate::ChannelCommands::BindTelegram { identity } => {
Box::pin(bind_telegram_identity(config, &identity)).await
}
crate::ChannelCommands::Send {
message,
channel_id,
recipient,
} => send_channel_message(config, &channel_id, &recipient, &message).await,
}
}