Added support for custom ModuleBase command contexts. Added SocketCommandContext/RpcCommandContext.

This commit is contained in:
RogueException
2016-12-23 16:52:32 -04:00
parent 1965c0539a
commit 2c075e186a
32 changed files with 138 additions and 53 deletions

View File

@@ -9,7 +9,7 @@ namespace Discord.Commands
internal class ChannelTypeReader<T> : TypeReader
where T : class, IChannel
{
public override async Task<TypeReaderResult> Read(CommandContext context, string input)
public override async Task<TypeReaderResult> Read(ICommandContext context, string input)
{
if (context.Guild != null)
{

View File

@@ -44,7 +44,7 @@ namespace Discord.Commands
_enumsByValue = byValueBuilder.ToImmutable();
}
public override Task<TypeReaderResult> Read(CommandContext context, string input)
public override Task<TypeReaderResult> Read(ICommandContext context, string input)
{
T baseValue;
object enumValue;

View File

@@ -6,7 +6,7 @@ namespace Discord.Commands
internal class MessageTypeReader<T> : TypeReader
where T : class, IMessage
{
public override async Task<TypeReaderResult> Read(CommandContext context, string input)
public override async Task<TypeReaderResult> Read(ICommandContext context, string input)
{
ulong id;

View File

@@ -21,7 +21,7 @@ namespace Discord.Commands
_tryParse = PrimitiveParsers.Get<T>();
}
public override Task<TypeReaderResult> Read(CommandContext context, string input)
public override Task<TypeReaderResult> Read(ICommandContext context, string input)
{
T value;
if (_tryParse(input, out value))

View File

@@ -9,7 +9,7 @@ namespace Discord.Commands
internal class RoleTypeReader<T> : TypeReader
where T : class, IRole
{
public override Task<TypeReaderResult> Read(CommandContext context, string input)
public override Task<TypeReaderResult> Read(ICommandContext context, string input)
{
ulong id;

View File

@@ -4,6 +4,6 @@ namespace Discord.Commands
{
public abstract class TypeReader
{
public abstract Task<TypeReaderResult> Read(CommandContext context, string input);
public abstract Task<TypeReaderResult> Read(ICommandContext context, string input);
}
}

View File

@@ -10,7 +10,7 @@ namespace Discord.Commands
internal class UserTypeReader<T> : TypeReader
where T : class, IUser
{
public override async Task<TypeReaderResult> Read(CommandContext context, string input)
public override async Task<TypeReaderResult> Read(ICommandContext context, string input)
{
var results = new Dictionary<ulong, TypeReaderValue>();
IReadOnlyCollection<IUser> channelUsers = (await context.Channel.GetUsersAsync(CacheMode.CacheOnly).Flatten().ConfigureAwait(false)).ToArray(); //TODO: must be a better way?