Return whether command handled message

This commit is contained in:
Joscha 2023-02-27 12:41:49 +01:00
parent a6331d50b8
commit 4479126500
12 changed files with 142 additions and 47 deletions

View file

@ -34,10 +34,10 @@ impl ClapCommand<Bot, conn::Error> for Kill {
msg: &Message,
ctx: &Context,
bot: &mut Bot,
) -> Result<(), conn::Error> {
) -> Result<bool, conn::Error> {
bot.stop = true;
ctx.reply(msg.id, "/me dies").await?;
Ok(())
Ok(true)
}
}
@ -61,14 +61,14 @@ impl ClapCommand<Bot, conn::Error> for Test {
msg: &Message,
ctx: &Context,
_bot: &mut Bot,
) -> Result<(), conn::Error> {
) -> Result<bool, conn::Error> {
let content = if args.amount == 1 {
format!("/me did {} test", args.amount)
} else {
format!("/me did {} tests", args.amount)
};
ctx.reply(msg.id, content).await?;
Ok(())
Ok(true)
}
}