Browse Source

Merge pull request #205 from FiniteReality/issue/202

Add Prefix property to Module
tags/1.0-rc
RogueException GitHub 8 years ago
parent
commit
e1da83e2c7
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      src/Discord.Net.Commands/Module.cs

+ 3
- 1
src/Discord.Net.Commands/Module.cs View File

@@ -11,6 +11,7 @@ namespace Discord.Commands
public TypeInfo Source { get; } public TypeInfo Source { get; }
public CommandService Service { get; } public CommandService Service { get; }
public string Name { get; } public string Name { get; }
public string Prefix { get; }
public string Summary { get; } public string Summary { get; }
public string Description { get; } public string Description { get; }
public IEnumerable<Command> Commands { get; } public IEnumerable<Command> Commands { get; }
@@ -23,6 +24,7 @@ namespace Discord.Commands
Source = source; Source = source;
Service = service; Service = service;
Name = source.Name; Name = source.Name;
Prefix = moduleAttr.Prefix ?? "";
Instance = instance; Instance = instance;


var nameAttr = source.GetCustomAttribute<NameAttribute>(); var nameAttr = source.GetCustomAttribute<NameAttribute>();
@@ -38,7 +40,7 @@ namespace Discord.Commands
Description = descriptionAttr.Text; Description = descriptionAttr.Text;


List<Command> commands = new List<Command>(); List<Command> commands = new List<Command>();
SearchClass(source, instance, commands, moduleAttr.Prefix ?? "");
SearchClass(source, instance, commands, Prefix);
Commands = commands; Commands = commands;


Preconditions = BuildPreconditions(); Preconditions = BuildPreconditions();


Loading…
Cancel
Save