Core: put role over message in choose

This commit is contained in:
Natsu Kagami 2020-09-20 15:58:07 -04:00
parent e830eab3f2
commit 53f6286d3d
Signed by: nki
GPG key ID: 73376E117CD20735

View file

@ -31,17 +31,17 @@ struct Community;
#[command] #[command]
#[description = r"👑 Randomly choose an active member and mention them! #[description = r"👑 Randomly choose an active member and mention them!
Note that only online/idle users in the channel are chosen from."] Note that only online/idle users in the channel are chosen from."]
#[usage = "[title = the chosen one] / [limited roles = everyone online]"] #[usage = "[limited roles = everyone online] / [title = the chosen one]"]
#[example = "the strongest in Gensokyo"] #[example = "the strongest in Gensokyo"]
#[bucket = "community"] #[bucket = "community"]
#[max_args(2)] #[max_args(2)]
pub async fn choose(ctx: &Context, m: &Message, mut args: Args) -> CommandResult { pub async fn choose(ctx: &Context, m: &Message, mut args: Args) -> CommandResult {
let role = args.find::<RoleId>().ok();
let title = if args.is_empty() { let title = if args.is_empty() {
"the chosen one".to_owned() "the chosen one".to_owned()
} else { } else {
args.single::<String>()? args.single::<String>()?
}; };
let role = args.single::<RoleId>().ok();
let users: Result<Vec<_>, Error> = { let users: Result<Vec<_>, Error> = {
let guild = m.guild(&ctx).await.unwrap(); let guild = m.guild(&ctx).await.unwrap();