Add CommandExt trait

This commit is contained in:
Joscha 2024-12-28 19:50:10 +01:00
parent 4030d8af09
commit 3e93e1192b
2 changed files with 51 additions and 15 deletions

View file

@ -3,10 +3,8 @@ use std::time::Duration;
use async_trait::async_trait;
use euphoxide::api::Message;
use euphoxide_bot::{
bang::{General, Specific},
basic::Described,
botrulez::{FullHelp, Ping, ShortHelp},
Command, Commands, Context, Info, Propagate,
Command, CommandExt, Commands, Context, Info, Propagate,
};
use euphoxide_client::MultiClient;
use log::error;
@ -44,18 +42,21 @@ impl Command for Pyramid {
async fn main() {
let (event_tx, mut event_rx) = mpsc::channel(10);
let commands = Commands::new()
.then(Described::hidden(General::new("ping", Ping::default())))
.then(Described::hidden(Specific::new("ping", Ping::default())))
.then(Described::hidden(General::new(
"help",
ShortHelp::new("/me demonstrates how to use euphoxide"),
)))
.then(Described::hidden(Specific::new(
"help",
FullHelp::new().with_after("Created using euphoxide."),
)))
.then(General::new("pyramid", Pyramid))
let commands = Commands::<euphoxide::Error>::new()
.then(Ping::default().general("ping").hidden())
.then(Ping::default().specific("ping").hidden())
.then(
ShortHelp::new("/me demonstrates how to use euphoxide")
.general("help")
.hidden(),
)
.then(
FullHelp::new()
.with_after("Created using euphoxide.")
.specific("help")
.hidden(),
)
.then(Pyramid.general("pyramid"))
.build();
let clients = MultiClient::new(event_tx);