add bot
This commit is contained in:
27
src/main.rs
27
src/main.rs
@@ -194,6 +194,13 @@ enum Commands {
|
||||
#[command(subcommand)]
|
||||
command: PdsCommands,
|
||||
},
|
||||
|
||||
/// Bot commands
|
||||
#[command(alias = "b")]
|
||||
Bot {
|
||||
#[command(subcommand)]
|
||||
command: BotCommands,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
@@ -220,6 +227,19 @@ enum NotifyCommands {
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum BotCommands {
|
||||
/// Start the bot (poll notifications and reply)
|
||||
Start {
|
||||
/// Poll interval in seconds
|
||||
#[arg(short, long, default_value = "30")]
|
||||
interval: u64,
|
||||
/// Path to config.json
|
||||
#[arg(short, long, default_value = "public/config.json")]
|
||||
config: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum PdsCommands {
|
||||
/// Check PDS versions
|
||||
@@ -310,6 +330,13 @@ async fn main() -> Result<()> {
|
||||
}
|
||||
}
|
||||
}
|
||||
Commands::Bot { command } => {
|
||||
match command {
|
||||
BotCommands::Start { interval, config } => {
|
||||
commands::bot::start(interval, &config).await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
Commands::Pds { command } => {
|
||||
match command {
|
||||
PdsCommands::Version { networks } => {
|
||||
|
||||
Reference in New Issue
Block a user