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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! Some common permission checkers.
//!
//! Currently, the built-in permission checkers are:
//!
//! - [`is_in_dms`] - Only runs the command if run in DMs.
//! - [`is_in_server`] - Only runs the command if run in a server.
use cratePermissionContext;
/// The command was not run in DMs.
;
/// Blocks the execution of the command if it's not being run in a DM.
///
/// Use it like this:
///
/// ```
/// Command::prefixed("command", handle_command).check(is_in_dms)
/// ```
///
/// The error returned when the command is not run in DMs is [`NotInDms`]. Catch it with a custom
/// error handler to let the user know why they're not allowed to run the command.
pub async
/// The command was not run in a server.
;
/// Blocks the execution of the command if it's not being run in a server.
///
/// Use it like this:
///
/// ```
/// Command::prefixed("command", handle_command).check(is_in_server)
/// ```
///
/// The error returned when the command is not run in a server is [`NotInServer`]. Catch it with a
/// custom error handler to let the user know why they're not allowed to run the command.
pub async