Table of Contents

Method TryGetCommand

Namespace
DSharpPlus.Commands.Processors.TextCommands
Assembly
DSharpPlus.Commands.dll

TryGetCommand(string, ulong, out int, out Command?)

Attempts to retrieve a command from the provided command text. Searches for the command by name, then by alias. Subcommands are also resolved. This method ignores DefaultGroupCommandAttribute's and will instead return the group command instead of the default subcommand.

public bool TryGetCommand(string commandText, ulong guildId, out int index, out Command? command)

Parameters

commandText string

The full command name and optionally it's arguments.

guildId ulong

The guild ID to check if the command is available in the guild. Pass 0 if not applicable.

index int

The index of commandText that the command name ends at.

command Command

The resolved command.

Returns

bool

If the command was found.