-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGroupAttribute.cs
More file actions
42 lines (38 loc) · 1.35 KB
/
GroupAttribute.cs
File metadata and controls
42 lines (38 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using Ultz.Extensions.Commands.Built;
namespace Ultz.Extensions.Commands.Attributes.Modules
{
/// <summary>
/// Marks the class as a group <see cref="Module" /> with the given aliases.
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public sealed class GroupAttribute : Attribute
{
/// <summary>
/// Initialises a new <see cref="GroupAttribute" /> with the specified <paramref name="aliases" />.
/// </summary>
/// <param name="aliases"> The aliases to set. </param>
/// <exception cref="ArgumentNullException">
/// Group aliases must not be null."
/// </exception>
/// <exception cref="ArgumentException">
/// You must provide at least one alias for the group.
/// </exception>
public GroupAttribute(params string[] aliases)
{
if (aliases == null)
{
throw new ArgumentNullException(nameof(aliases), "Group aliases must not be null.");
}
if (aliases.Length == 0)
{
throw new ArgumentException("You must provide at least one alias for the group.", nameof(aliases));
}
Aliases = aliases;
}
/// <summary>
/// Gets the aliases.
/// </summary>
public string[] Aliases { get; }
}
}