Removed Install function from CommandsPlugin
This commit is contained in:
@@ -113,7 +113,7 @@ namespace Discord.Commands
|
|||||||
}
|
}
|
||||||
var command = new Command(text);
|
var command = new Command(text);
|
||||||
command.MinPerms = _defaultMinPermissions;
|
command.MinPerms = _defaultMinPermissions;
|
||||||
_plugin._commands.Add(command);
|
_plugin.AddCommand(command);
|
||||||
return new CommandBuilder(command);
|
return new CommandBuilder(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ namespace Discord.Commands
|
|||||||
/// <summary> A Discord.Net client with extensions for handling common bot operations like text commands. </summary>
|
/// <summary> A Discord.Net client with extensions for handling common bot operations like text commands. </summary>
|
||||||
public partial class CommandsPlugin
|
public partial class CommandsPlugin
|
||||||
{
|
{
|
||||||
internal List<Command> _commands;
|
private readonly DiscordClient _client;
|
||||||
|
private List<Command> _commands;
|
||||||
private Func<User, Server, int> _getPermissions;
|
private Func<User, Server, int> _getPermissions;
|
||||||
|
|
||||||
public IEnumerable<Command> Commands => _commands;
|
public IEnumerable<Command> Commands => _commands;
|
||||||
@@ -16,8 +17,9 @@ namespace Discord.Commands
|
|||||||
public bool RequireCommandCharInPublic { get; set; }
|
public bool RequireCommandCharInPublic { get; set; }
|
||||||
public bool RequireCommandCharInPrivate { get; set; }
|
public bool RequireCommandCharInPrivate { get; set; }
|
||||||
|
|
||||||
public CommandsPlugin(Func<User, Server, int> getPermissions = null)
|
public CommandsPlugin(DiscordClient client, Func<User, Server, int> getPermissions = null)
|
||||||
{
|
{
|
||||||
|
_client = client;
|
||||||
_getPermissions = getPermissions;
|
_getPermissions = getPermissions;
|
||||||
_commands = new List<Command>();
|
_commands = new List<Command>();
|
||||||
|
|
||||||
@@ -25,10 +27,7 @@ namespace Discord.Commands
|
|||||||
UseCommandChar = false;
|
UseCommandChar = false;
|
||||||
RequireCommandCharInPublic = true;
|
RequireCommandCharInPublic = true;
|
||||||
RequireCommandCharInPrivate = true;
|
RequireCommandCharInPrivate = true;
|
||||||
}
|
|
||||||
|
|
||||||
public void Install(DiscordClient client)
|
|
||||||
{
|
|
||||||
client.MessageCreated += async (s, e) =>
|
client.MessageCreated += async (s, e) =>
|
||||||
{
|
{
|
||||||
//If commands aren't being used, don't bother processing them
|
//If commands aren't being used, don't bother processing them
|
||||||
@@ -123,5 +122,10 @@ namespace Discord.Commands
|
|||||||
_commands.Add(command);
|
_commands.Add(command);
|
||||||
return new CommandBuilder(command);
|
return new CommandBuilder(command);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
internal void AddCommand(Command command)
|
||||||
|
{
|
||||||
|
_commands.Add(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user