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

@@ -0,0 +1,31 @@
using Discord.WebSocket;
namespace Discord.Commands
{
public class SocketCommandContext : ICommandContext
{
public DiscordSocketClient Client { get; }
public SocketGuild Guild { get; }
public ISocketMessageChannel Channel { get; }
public SocketUser User { get; }
public SocketUserMessage Message { get; }
public bool IsPrivate => Channel is IPrivateChannel;
public SocketCommandContext(DiscordSocketClient client, SocketUserMessage msg)
{
Client = client;
Guild = (msg.Channel as SocketGuildChannel)?.Guild;
Channel = msg.Channel;
User = msg.Author;
Message = msg;
}
//ICommandContext
IDiscordClient ICommandContext.Client => Client;
IGuild ICommandContext.Guild => Guild;
IMessageChannel ICommandContext.Channel => Channel;
IUser ICommandContext.User => User;
IUserMessage ICommandContext.Message => Message;
}
}