|
|
@@ -1,15 +1,23 @@ |
|
|
|
using Discord.WebSocket; |
|
|
|
using Discord.WebSocket; |
|
|
|
|
|
|
|
namespace Discord.Commands |
|
|
|
{ |
|
|
|
/// <summary> The WebSocket variant of <see cref="ICommandContext"/>, which may contain the client, user, guild, channel, and message. </summary> |
|
|
|
/// <seealso cref="ICommandContext"/> |
|
|
|
public class SocketCommandContext : ICommandContext |
|
|
|
{ |
|
|
|
/// <summary> Gets the <see cref="DiscordSocketClient"/> that the command is executed with. </summary> |
|
|
|
public DiscordSocketClient Client { get; } |
|
|
|
/// <summary> Gets the <see cref="SocketGuild"/> that the command is executed in. </summary> |
|
|
|
public SocketGuild Guild { get; } |
|
|
|
/// <summary> Gets the <see cref="ISocketMessageChannel"/> that the command is executed in. </summary> |
|
|
|
public ISocketMessageChannel Channel { get; } |
|
|
|
/// <summary> Gets the <see cref="SocketUser"/> who executed the command. </summary> |
|
|
|
public SocketUser User { get; } |
|
|
|
/// <summary> Gets the <see cref="SocketUserMessage"/> that the command is interpreted from. </summary> |
|
|
|
public SocketUserMessage Message { get; } |
|
|
|
|
|
|
|
/// <summary> Indicates whether the channel that the command is executed in is a private channel. </summary> |
|
|
|
public bool IsPrivate => Channel is IPrivateChannel; |
|
|
|
|
|
|
|
public SocketCommandContext(DiscordSocketClient client, SocketUserMessage msg) |
|
|
@@ -22,10 +30,15 @@ namespace Discord.Commands |
|
|
|
} |
|
|
|
|
|
|
|
//ICommandContext |
|
|
|
/// <inheritdoc/> |
|
|
|
IDiscordClient ICommandContext.Client => Client; |
|
|
|
/// <inheritdoc/> |
|
|
|
IGuild ICommandContext.Guild => Guild; |
|
|
|
/// <inheritdoc/> |
|
|
|
IMessageChannel ICommandContext.Channel => Channel; |
|
|
|
/// <inheritdoc/> |
|
|
|
IUser ICommandContext.User => User; |
|
|
|
/// <inheritdoc/> |
|
|
|
IUserMessage ICommandContext.Message => Message; |
|
|
|
} |
|
|
|
} |