async def grant_role(guild, member, role_name) -> bool:
    """Grant a Discord role to a user."""
    roles = {r.name: r for r in guild.roles}
    if role_name not in roles:
        return False
    await member.add_roles(
        roles[role_name],
        reason=f"Assigned to {role_name} by bot"
    )
    return True