Files
Govor/Govor.ConsoleClient/Commands/SendMessageCommand.cs
T
Artemy b24649e53a Refactor message loading API and add message query support
Reworked message loading endpoints and services to support flexible message querying with 'before' and 'after' parameters via a new MessageQuery contract. Updated controller actions, service interfaces, and implementations to use the new query model, and improved error handling. Added integration tests for ChatLoadController and introduced IUserPresenceService interface. Minor fixes and help text improvements in console client commands.
2025-07-23 13:06:34 +07:00

44 lines
1.2 KiB
C#

using Govor.ConsoleClient.Services;
namespace Govor.ConsoleClient.Commands;
[CommandRoute("/send")]
public class SendMessageCommand : IInteractiveCommand
{
private string? _recipient;
private bool _isCompleted;
public bool IsCompleted => _isCompleted;
public Task ExecuteAsync(CommandContext context)
{
Console.WriteLine("Кому вы хотите отправить сообщение?");
return Task.CompletedTask;
}
public async Task HandleInputAsync(string input)
{
if (_recipient == null)
{
_recipient = input;
Console.WriteLine("Введите сообщение:");
}
else
{
var message = input;
Console.WriteLine($"(Отправка '{message}' пользователю '{_recipient}')");
_isCompleted = true;
}
await Task.CompletedTask;
}
public string LongHelp()
{
return "Отпарвка тестовых сообщений не существующему юзеру 2";
}
public string ShortHelp()
{
return "Отпарвка тестовых сообщений не существующему юзеру";
}
}