Table of Contents

Class AliasAttribute

Namespace
Discord.Commands
Assembly
Discord.Net.Commands.dll

Marks the aliases for a command.

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class AliasAttribute : Attribute
Inheritance
AliasAttribute
Inherited Members

Examples

In the following example, the command can be triggered with the base name, "stats", or either "stat" or "info".

[Command("stats")]
[Alias("stat", "info")]
public async Task GetStatsAsync(IUser user)
{
    // ...pull stats
}

Remarks

This attribute allows a command to have one or multiple aliases. In other words, the base command can have multiple aliases when triggering the command itself, giving the end-user more freedom of choices when giving hot-words to trigger the desired command. See the example for a better illustration.

Constructors

AliasAttribute(params string[])

Creates a new AliasAttribute with the given aliases.

public AliasAttribute(params string[] aliases)

Parameters

aliases string[]

Properties

Aliases

Gets the aliases which have been defined for the command.

public string[] Aliases { get; }

Property Value

string[]