1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-09 23:55:42 +00:00

Expose Client from CommandContext

This commit is contained in:
Oliver Booth 2022-12-08 20:26:10 +00:00
parent a1e018b32e
commit 18f26925da
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634

View File

@ -9,12 +9,10 @@ namespace VpSharp.Commands;
/// </summary> /// </summary>
public sealed class CommandContext public sealed class CommandContext
{ {
private readonly VirtualParadiseClient _client;
internal CommandContext(VirtualParadiseClient client, VirtualParadiseAvatar avatar, string commandName, string alias, internal CommandContext(VirtualParadiseClient client, VirtualParadiseAvatar avatar, string commandName, string alias,
string rawArguments) string rawArguments)
{ {
_client = client; Client = client;
Avatar = avatar; Avatar = avatar;
CommandName = commandName; CommandName = commandName;
Alias = alias; Alias = alias;
@ -39,6 +37,12 @@ public sealed class CommandContext
/// </summary> /// </summary>
/// <value>The executing avatar.</value> /// <value>The executing avatar.</value>
public VirtualParadiseAvatar Avatar { get; } public VirtualParadiseAvatar Avatar { get; }
/// <summary>
/// Gets the client which raised the event.
/// </summary>
/// <value>The Virtual Paradise client.</value>
public VirtualParadiseClient Client { get; }
/// <summary> /// <summary>
/// Gets the command name. /// Gets the command name.
@ -64,7 +68,7 @@ public sealed class CommandContext
public Task<VirtualParadiseMessage> RespondAsync(string message, bool ephemeral = false) public Task<VirtualParadiseMessage> RespondAsync(string message, bool ephemeral = false)
{ {
return ephemeral return ephemeral
? Avatar.SendMessageAsync(_client.CurrentAvatar?.Name, message, FontStyle.Regular, Color.Black) ? Avatar.SendMessageAsync(Client.CurrentAvatar?.Name, message, FontStyle.Regular, Color.Black)
: _client.SendMessageAsync(message); : Client.SendMessageAsync(message);
} }
} }