diff --git a/src/commands/roles.rs b/src/commands/roles.rs index 16b5ea8..a01b337 100644 --- a/src/commands/roles.rs +++ b/src/commands/roles.rs @@ -21,22 +21,20 @@ async fn autocomplete_role<'a>( .get_table("roles") .unwrap() .get(&ctx.guild_id().expect("Not in a guild").to_string()) - { - None => {vec![]} - Some(val) => { - match val.clone() - .into_table() - { - Err(_) => {vec![]} - Ok(val) => { - val.into_keys() - .filter(|str| {str.contains(partial)}) - .collect() - } - } - + { + None => { + vec![] + } + Some(val) => match val.clone().into_table() { + Err(_) => { + vec![] } - }; + Ok(val) => val + .into_keys() + .filter(|str| str.contains(partial)) + .collect(), + }, + }; roles.sort_unstable(); @@ -84,8 +82,8 @@ pub async fn roles( mem.remove_role(ctx, role_ding).await?; ctx.say(format!("Role {} Added", role)).await? } else { - mem.add_role(ctx, role_ding).await?; - ctx.say(format!("Role {} Added", role)).await? + mem.add_role(ctx, role_ding).await?; + ctx.say(format!("Role {} Added", role)).await? } } }; diff --git a/src/commands/utils.rs b/src/commands/utils.rs index ee724f4..515af24 100644 --- a/src/commands/utils.rs +++ b/src/commands/utils.rs @@ -44,6 +44,7 @@ pub fn paginator(input: Vec, chunk_size: usize, join_string: String) -> return result; } + pub async fn paginate_string(ctx: Context<'_>, pages: Vec) -> Result<(), Error> { let uuid_command = ctx.id().to_string(); let page_count = pages.len(); @@ -60,7 +61,7 @@ pub async fn paginate_string(ctx: Context<'_>, pages: Vec) -> Result<(), _ => {} }; - ctx.send(|m| { + let reply_handle = ctx.send(|m| { m.content(format!( "{}\n\nPage: {}/{}", pages.get(0).unwrap(), @@ -115,8 +116,7 @@ pub async fn paginate_string(ctx: Context<'_>, pages: Vec) -> Result<(), page = 0; } - let mut msg = mci.message.clone(); - msg.edit(ctx, |m| { + reply_handle.edit(ctx, |m| { m.content(format!( "{}\n\nPage: {}/{}", pages.get(page).unwrap(), @@ -157,7 +157,7 @@ pub async fn paginate_string_embed( _ => {} }; - ctx.send(|m| { + let reply_handle = ctx.send(|m| { // m.content(format!( // "{}\n\nPage: {}/{}", // pages.get(0).unwrap(), @@ -216,8 +216,7 @@ pub async fn paginate_string_embed( page = 0; } - let mut msg = mci.message.clone(); - msg.edit(ctx, |m| { + reply_handle.edit(ctx, |m| { m.embed(|e| { e.title(format!("{} Page {}/{}", title, page + 1, page_count)) .description(pages.get(page).unwrap())