Reduced command module lifetime to a single command execution. Removed ModuleAttribute.

This commit is contained in:
RogueException
2016-10-10 20:26:01 -03:00
parent 3930e1147c
commit 635819b89f
16 changed files with 203 additions and 202 deletions

View File

@@ -9,7 +9,7 @@ namespace Discord.Commands
private readonly ConcurrentDictionary<string, CommandMapNode> _nodes;
private readonly string _name;
private readonly object _lockObj = new object();
private ImmutableArray<Command> _commands;
private ImmutableArray<CommandInfo> _commands;
public bool IsEmpty => _commands.Length == 0 && _nodes.Count == 0;
@@ -17,10 +17,10 @@ namespace Discord.Commands
{
_name = name;
_nodes = new ConcurrentDictionary<string, CommandMapNode>();
_commands = ImmutableArray.Create<Command>();
_commands = ImmutableArray.Create<CommandInfo>();
}
public void AddCommand(string text, int index, Command command)
public void AddCommand(string text, int index, CommandInfo command)
{
int nextSpace = text.IndexOf(' ', index);
string name;
@@ -41,7 +41,7 @@ namespace Discord.Commands
}
}
}
public void RemoveCommand(string text, int index, Command command)
public void RemoveCommand(string text, int index, CommandInfo command)
{
int nextSpace = text.IndexOf(' ', index);
string name;
@@ -68,7 +68,7 @@ namespace Discord.Commands
}
}
public IEnumerable<Command> GetCommands(string text, int index)
public IEnumerable<CommandInfo> GetCommands(string text, int index)
{
int nextSpace = text.IndexOf(' ', index);
string name;