Return whether command handled message
This commit is contained in:
parent
a6331d50b8
commit
4479126500
12 changed files with 142 additions and 47 deletions
|
|
@ -50,12 +50,20 @@ where
|
|||
B: HasDescriptions + Send,
|
||||
E: From<conn::Error>,
|
||||
{
|
||||
async fn execute(&self, arg: &str, msg: &Message, ctx: &Context, bot: &mut B) -> Result<(), E> {
|
||||
async fn execute(
|
||||
&self,
|
||||
arg: &str,
|
||||
msg: &Message,
|
||||
ctx: &Context,
|
||||
bot: &mut B,
|
||||
) -> Result<bool, E> {
|
||||
if arg.trim().is_empty() {
|
||||
let reply = self.formulate_reply(ctx, bot);
|
||||
ctx.reply(msg.id, reply).await?;
|
||||
Ok(true)
|
||||
} else {
|
||||
Ok(false)
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -77,9 +85,9 @@ where
|
|||
msg: &Message,
|
||||
ctx: &Context,
|
||||
bot: &mut B,
|
||||
) -> Result<(), E> {
|
||||
) -> Result<bool, E> {
|
||||
let reply = self.formulate_reply(ctx, bot);
|
||||
ctx.reply(msg.id, reply).await?;
|
||||
Ok(())
|
||||
Ok(true)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,11 +30,13 @@ where
|
|||
msg: &Message,
|
||||
ctx: &Context,
|
||||
_bot: &mut B,
|
||||
) -> Result<(), E> {
|
||||
) -> Result<bool, E> {
|
||||
if arg.trim().is_empty() {
|
||||
ctx.reply(msg.id, &self.0).await?;
|
||||
Ok(true)
|
||||
} else {
|
||||
Ok(false)
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -55,8 +57,8 @@ where
|
|||
msg: &Message,
|
||||
ctx: &Context,
|
||||
_bot: &mut B,
|
||||
) -> Result<(), E> {
|
||||
) -> Result<bool, E> {
|
||||
ctx.reply(msg.id, &self.0).await?;
|
||||
Ok(())
|
||||
Ok(true)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,11 +24,13 @@ where
|
|||
msg: &Message,
|
||||
ctx: &Context,
|
||||
_bot: &mut B,
|
||||
) -> Result<(), E> {
|
||||
) -> Result<bool, E> {
|
||||
if arg.trim().is_empty() {
|
||||
ctx.reply(msg.id, &self.0).await?;
|
||||
Ok(true)
|
||||
} else {
|
||||
Ok(false)
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -49,8 +51,8 @@ where
|
|||
msg: &Message,
|
||||
ctx: &Context,
|
||||
_bot: &mut B,
|
||||
) -> Result<(), E> {
|
||||
) -> Result<bool, E> {
|
||||
ctx.reply(msg.id, &self.0).await?;
|
||||
Ok(())
|
||||
Ok(true)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,12 +81,20 @@ where
|
|||
B: HasStartTime + Send,
|
||||
E: From<conn::Error>,
|
||||
{
|
||||
async fn execute(&self, arg: &str, msg: &Message, ctx: &Context, bot: &mut B) -> Result<(), E> {
|
||||
async fn execute(
|
||||
&self,
|
||||
arg: &str,
|
||||
msg: &Message,
|
||||
ctx: &Context,
|
||||
bot: &mut B,
|
||||
) -> Result<bool, E> {
|
||||
if arg.trim().is_empty() {
|
||||
let reply = self.formulate_reply(ctx, bot, false);
|
||||
ctx.reply(msg.id, reply).await?;
|
||||
Ok(true)
|
||||
} else {
|
||||
Ok(false)
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -112,9 +120,9 @@ where
|
|||
msg: &Message,
|
||||
ctx: &Context,
|
||||
bot: &mut B,
|
||||
) -> Result<(), E> {
|
||||
) -> Result<bool, E> {
|
||||
let reply = self.formulate_reply(ctx, bot, args.connected);
|
||||
ctx.reply(msg.id, reply).await?;
|
||||
Ok(())
|
||||
Ok(true)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue