pikadick_slash_framework/
check.rs1use crate::{
2 BoxFuture,
3 Command,
4};
5use serenity::{
6 client::Context,
7 model::application::CommandInteraction,
8};
9
10pub type CheckFn = for<'a> fn(
11 &'a Context,
12 &'a CommandInteraction,
13 &'a Command,
14) -> BoxFuture<'a, Result<(), Reason>>;
15
16pub struct Reason {
18 pub user: Option<String>,
20
21 pub log: Option<String>,
23}
24
25impl Reason {
26 pub fn new_unknown() -> Self {
28 Self {
29 user: None,
30 log: None,
31 }
32 }
33
34 pub fn new_user<S>(user: S) -> Self
36 where
37 S: Into<String>,
38 {
39 Self {
40 user: Some(user.into()),
41 log: None,
42 }
43 }
44}