minor rewrite to use map

This commit is contained in:
2024-10-11 20:52:55 -04:00
parent d22d53ae8d
commit bf80d9a486

View File

@@ -52,11 +52,9 @@ pub async fn dox(mut ctx: Context<'_>,
show_permissions: Option<bool>) -> Result<(), Error> show_permissions: Option<bool>) -> Result<(), Error>
{ {
let user = ctx.http().get_user(user.id).await?; let user = ctx.http().get_user(user.id).await?;
let member = if let Some(guild) = ctx.guild_id() { let member = ctx.guild_id().map(
guild.member(ctx.http(), user.id).await.ok() async move |guild|
} else { guild.member(ctx.http(), user.id).await.ok()).unwrap();
None
};
let embed = serenity::CreateEmbed::default() let embed = serenity::CreateEmbed::default()
.title(format!("Information about {}", user.name)) .title(format!("Information about {}", user.name))