V16 / 6df58cd3ed86
MessageCommands.cs
Lilith/Core/Messaging/MessageCommands.cs
Unchanged from the preceding versionCS
using Lilith.Core.Commands;
namespace Lilith.Core.Messaging;
public static class MessageCommands
{
public static void Register(ChatCommandRegistry commands, Func<ProviderClient> provider)
{
foreach (bool approve in new[] { true, false })
{
bool decision = approve;
commands.RegisterAsync(approve ? "message-approve" : "message-reject", "Apply the exact prepared message: NICKNAME PROPOSAL_ID. Dummy channels simulate delivery only.", async c =>
{
string[] parts = c.Arguments.Split(' ', StringSplitOptions.RemoveEmptyEntries);
if (parts.Length != 2) throw new ArgumentException("Specify nickname and proposal ID.");
return new(true, await provider().DecideMessageAsync(parts[0], parts[1], decision, c.CancellationToken));
});
}
}
}