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