feat(platform): interactive wizard to configure Telegram + Discord bots

New command: 'gyandoot platform configure'

Walks users through:
1. Telegram bot token input (from @BotFather)
2. Discord bot token + guild ID input
3. Summary showing which platforms are configured
4. Saves [platform] section to config.toml

Existing 'gyandoot setup' and flat config parser also handle
the new [platform] section format.
This commit is contained in:
2026-06-12 17:09:36 +05:30
parent a694757b6f
commit 9954f28aa6
3 changed files with 270 additions and 1 deletions

View File

@@ -81,6 +81,12 @@ enum Commands {
#[command(subcommand)]
action: ServiceAction,
},
/// Configure messaging platforms (Telegram, Discord)
#[command(name = "platform")]
Platform {
#[command(subcommand)]
action: PlatformAction,
},
}
#[derive(Subcommand, Debug)]
@@ -132,6 +138,13 @@ enum ServiceAction {
Status,
}
#[derive(Subcommand, Debug)]
enum PlatformAction {
/// Interactive wizard to configure Telegram and Discord bots
#[command(name = "configure")]
Configure,
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let cli = Cli::parse();
@@ -180,6 +193,9 @@ async fn main() -> anyhow::Result<()> {
Some(Commands::Service { action }) => {
cmd_service(action).await?;
}
Some(Commands::Platform { action }) => {
cmd_platform(action).await?;
}
None => {
// Default: run interactive CLI mode
cmd_run(&cli.profile, "cli", None).await?;
@@ -714,4 +730,26 @@ async fn cmd_service(action: ServiceAction) -> anyhow::Result<()> {
}
}
Ok(())
}
}
/// Configure messaging platforms (Telegram, Discord)
async fn cmd_platform(action: PlatformAction) -> anyhow::Result<()> {
match action {
PlatformAction::Configure => {
tracing::info!("Starting platform configuration wizard");
match gyandoot_tui::platform::run_platform_wizard() {
Ok(Some(_config)) => {
println!("✅ Platform configuration saved!");
println!(" Run 'gyandoot serve' to start the gateway.");
}
Ok(None) => {
println!("Platform configuration cancelled.");
}
Err(e) => {
tracing::error!("Platform wizard failed: {}", e);
eprintln!("Platform setup error: {}", e);
}
}
}
}
Ok(())
}