using Discord.WebSocket; namespace Discord.Commands { /// /// Represents a WebSocket-based context of a command. This may include the client, guild, channel, user, and message. /// public class SocketCommandContext : ICommandContext { /// /// Gets the that the command is executed with. /// public DiscordSocketClient Client { get; } /// /// Gets the that the command is executed in. /// public SocketGuild Guild { get; } /// /// Gets the that the command is executed in. /// public ISocketMessageChannel Channel { get; } /// /// Gets the who executed the command. /// public SocketUser User { get; } /// /// Gets the that the command is interpreted from. /// public SocketUserMessage 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 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; } }