Skip to main content

zeroclaw_channels/
listing.rs

1//! Enumerate the channel types compiled into this binary.
2//!
3//! Use [`compiled_channels`] in display commands (`zeroclaw channel list`) that
4//! should only mention channels that can actually be started.  For a full
5//! channel inventory regardless of compile-time features, use
6//! [`zeroclaw_config::schema::ChannelsConfig::channels`] instead.
7
8use zeroclaw_config::schema::ChannelsConfig;
9use zeroclaw_config::traits::ChannelInfo;
10
11/// Returns one entry per channel type compiled into this binary.
12///
13/// Filters the canonical channel list from [`ChannelsConfig::channels`] down to
14/// only those enabled at compile time via `channel-*` / `voice-wake` feature
15/// flags. Name, desc, and configured status come from the config crate's single
16/// source of truth; this function contributes only the compile-time filter.
17pub fn compiled_channels(cfg: &ChannelsConfig) -> Vec<ChannelInfo> {
18    // Each entry is the display name of one channel, included only when its
19    // corresponding feature flag is enabled at compile time.
20    let compiled: &[&str] = &[
21        #[cfg(feature = "channel-telegram")]
22        "Telegram",
23        #[cfg(feature = "channel-discord")]
24        "Discord",
25        #[cfg(feature = "channel-slack")]
26        "Slack",
27        #[cfg(feature = "channel-mattermost")]
28        "Mattermost",
29        #[cfg(feature = "channel-imessage")]
30        "iMessage",
31        #[cfg(feature = "channel-matrix")]
32        "Matrix",
33        #[cfg(feature = "channel-signal")]
34        "Signal",
35        #[cfg(feature = "channel-whatsapp-cloud")]
36        "WhatsApp",
37        #[cfg(feature = "whatsapp-web")]
38        "WhatsApp Web",
39        #[cfg(feature = "channel-linq")]
40        "Linq",
41        #[cfg(feature = "channel-wati")]
42        "WATI",
43        #[cfg(feature = "channel-nextcloud")]
44        "NextCloud Talk",
45        #[cfg(feature = "channel-email")]
46        "Email",
47        #[cfg(feature = "channel-email")]
48        "Gmail Push",
49        #[cfg(feature = "channel-irc")]
50        "IRC",
51        #[cfg(feature = "channel-lark")]
52        "Lark",
53        #[cfg(feature = "channel-dingtalk")]
54        "DingTalk",
55        #[cfg(feature = "channel-wecom")]
56        "WeCom",
57        #[cfg(feature = "channel-wecom-ws")]
58        "WeCom WebSocket",
59        #[cfg(feature = "channel-wechat")]
60        "WeChat",
61        #[cfg(feature = "channel-qq")]
62        "QQ Official",
63        #[cfg(feature = "channel-nostr")]
64        "Nostr",
65        #[cfg(feature = "channel-clawdtalk")]
66        "ClawdTalk",
67        #[cfg(feature = "channel-reddit")]
68        "Reddit",
69        #[cfg(feature = "channel-bluesky")]
70        "Bluesky",
71        #[cfg(feature = "channel-twitter")]
72        "X/Twitter",
73        #[cfg(feature = "channel-mochat")]
74        "Mochat",
75        #[cfg(feature = "channel-line")]
76        "LINE",
77        #[cfg(feature = "channel-voice-call")]
78        "Voice Call",
79        #[cfg(feature = "voice-wake")]
80        "VoiceWake",
81        #[cfg(feature = "channel-mqtt")]
82        "MQTT",
83        #[cfg(feature = "channel-webhook")]
84        "Webhook",
85    ];
86
87    cfg.channels()
88        .into_iter()
89        .filter(|info| compiled.contains(&info.name))
90        .collect()
91}