You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: macros/src/lib.rs
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -109,12 +109,13 @@ attributes you can use on parameters:
109
109
- `#[min_length = 0]`: Minimum length for this string parameter (slash-only)
110
110
- `#[max_length = 1]`: Maximum length for this string parameter (slash-only)
111
111
112
-
## Parser settings (prefix only)
112
+
## Parser settings
113
113
- `#[string]`: Indicates that a type implements `FromStr` and should be parsed from a string argument.
114
114
- `#[rest]`: Use the entire rest of the message for this parameter (prefix-only)
115
115
- `#[lazy]`: Can be used on Option and Vec parameters and is equivalent to regular expressions' laziness (prefix-only)
116
-
- `#[flag]`: Can be used on a bool parameter to set the bool to true if the user typed the parameter name literally (prefix-only)
117
-
- For example with `async fn my_command(ctx: Context<'_>, #[flag] my_flag: bool)`, `~my_command` would set my_flag to false, and `~my_command my_flag` would set my_flag to true
116
+
- `#[flag]`: Can be used on a bool parameter to make it optional and default to `false`; additionally,
117
+
in prefix commands only, the user can pass in the parameter name literally to set it to `true`.
118
+
- For example with `async fn my_command(ctx: Context<'_>, #[flag] my_flag: bool)`, `~my_command` or `/my_command` would set `my_flag` to false, while `~my_command my_flag` would set `my_flag` to true
0 commit comments