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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
use TokenStream;
use TokenStream as TokenStream2;
/// Converts an `async` function into a normal function returning a
/// `Pin<Box<dyn Future<Output = _> + '_>>`
/// Converts an `async-compatible` function into a builder and modifies function's body
/// to parse all required commands, for further information about the behaviour of this macro, see
/// the implementation.
///
/// By an `async-compatible` function it's meant a function with a minimum of one argument,
/// which must be an `&SlashContext<T>`, which is always given and also used to parse all arguments.
///
/// Usage:
///
/// This macro can be used two ways:
///
/// - Without arguments, as #[command], which takes the caller function name as the name of the command.
/// - Providing the name, as #[command("command name")] which takes the provided name as the command name.
///
/// When marking a function with this attribute macro, you **must** provide a description of the
/// command that will be seen on discord when using the command, this is made by adding a
/// `description` attribute, which can be added two ways:
///
/// - List way: #[description("Some description")]
///
/// - Named value way: #[description = "Some description"]
///
/// Arguments:
///
/// You **must** provide another `description` attribute for every argument describing what they
/// are, this description will be seen on discord when filling up the argument. This needs to be
/// done with all the arguments except the context, which must be the first one, the accepted
/// syntax is the same as the previous `description` one.
///
/// Adding a `rename` attribute is optional, but can be used to modify the name of the argument seen
/// in discord, it is allowed to have only one `name` attribute per argument and the attribute can
/// be used the same ways a the `description` one.
/// Prepares the function to allow it to be set as an after hook, see
/// the implementation for more information about this macro's behaviour.
/// Prepares the function to allow it to be set as a before hook, see
/// the implementation for more information about this macro's behaviour.
/// Extracts the given result, throwing a compile error if an error is given.