namespace Discord.Commands
{
/// The context of a command which may contain the client, user, guild, channel, and message.
public class CommandContext : ICommandContext
{
///
public IDiscordClient Client { get; }
///
public IGuild Guild { get; }
///
public IMessageChannel Channel { get; }
///
public IUser User { get; }
///
public IUserMessage Message { get; }
/// Indicates whether the channel that the command is executed in is a private channel.
public bool IsPrivate => Channel is IPrivateChannel;
///
/// Initializes a new class with the provided client and message.
///
/// The underlying client.
/// The underlying message.
public CommandContext(IDiscordClient client, IUserMessage msg)
{
Client = client;
Guild = (msg.Channel as IGuildChannel)?.Guild;
Channel = msg.Channel;
User = msg.Author;
Message = msg;
}
}
}