use consistent guild getter syntax

This commit is contained in:
2025-05-17 23:16:59 -04:00
parent f75c0aa057
commit 6f1adcee5e
9 changed files with 31 additions and 60 deletions

View File

@@ -6,10 +6,8 @@ use poise::serenity_prelude as serenity;
/// Register an existing role as a user's custom role. This deletes their current self role.
#[poise::command(slash_command, prefix_command, required_permissions = "MANAGE_ROLES")]
pub async fn register(ctx: Context<'_>, user: serenity::User, role: serenity::Role) -> Result<(), Error> {
let guild = if let Some(guild) = ctx.guild_id() {
guild
} else {
ctx.reply("This command can only be run inside of a guild.").await?;
let Some(guild) = ctx.guild_id() else {
ctx.reply("This command must be ran within a guild.").await?;
return Ok(());
};