FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Parameters Not Resolving All Role Mentions in Commands · Issue #2213 · DSharpPlus/DSharpPlus · GitHub

Parameters Not Resolving All Role Mentions in Commands #2213

Description

Summary

When using a command parameter of type DiscordRole[] to parse multiple role mentions, only a subset of the mentioned roles is successfully parsed and received by the command method. This behavior appears to be inconsistent, as some role mentions are correctly resolved while others are missing entirely.

What version of the library are you using?

v5.0.0-nightly (make sure you are using the latest nightly!)

What .NET version are you using? Make sure to use the latest patch release for your major version.

.NET 9.0

Operating System

Windows 11

Reproduction Steps

Steps to Reproduce

  1. Create a command with the following signature:
     [RequirePermissions(DiscordPermission.Administrator)]
     [Command("send-role-menu")]
     [Description("Sends a role selection menu to the channel.")]
     public async Task ExecuteAsync(CommandContext ctx,
     [Description("The roles to give as options.")] params DiscordRole[] roles)
    {
        // Log the roles received
        foreach (var role in roles)
        {
            Console.WriteLine($"Received Role: {role?.Name} (ID: {role?.Id})");
        }
    }
  2. Call the command with multiple role mentions, e.g.:
    /send-role-menu @Owner @Admin
    
  3. Observe the roles received in the roles parameter.

Trace Logs

Exceptions or other error messages

Anything else you'd like to share

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    commandsFor issues related to DSharpPlus.Commands

    Type

    Fields

    Effort

    None yet

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL