-
Notifications
You must be signed in to change notification settings - Fork 121
/
Copy pathinherit_checks.rs
38 lines (36 loc) · 994 Bytes
/
inherit_checks.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use crate::{Context, Error};
async fn child2_check(_ctx: Context<'_>) -> Result<bool, Error> {
println!("Child2 check executed!");
Ok(true)
}
async fn child1_check(_ctx: Context<'_>) -> Result<bool, Error> {
println!("Child1 check executed!");
Ok(true)
}
async fn parent_check(_ctx: Context<'_>) -> Result<bool, Error> {
println!("Parent check executed!");
Ok(true)
}
#[poise::command(slash_command, prefix_command, check = "child2_check")]
async fn child2(ctx: Context<'_>, _b: bool, _s: String, _i: u32) -> Result<(), Error> {
ctx.say(ctx.invocation_string()).await?;
Ok(())
}
#[poise::command(
slash_command,
prefix_command,
subcommands("child2"),
check = "child1_check"
)]
async fn child1(_ctx: Context<'_>) -> Result<(), Error> {
Ok(())
}
#[poise::command(
slash_command,
prefix_command,
subcommands("child1"),
check = "parent_check"
)]
pub async fn parent_checks(_ctx: Context<'_>) -> Result<(), Error> {
Ok(())
}