Убраны старые api
This commit is contained in:
@@ -25,10 +25,10 @@ public sealed class MessageBuilder
|
||||
/// <summary>
|
||||
/// Установить опции для конкретного адаптера. Ключ адаптера определяется адаптером (напр., "telegram").
|
||||
/// </summary>
|
||||
public MessageBuilder WithAdapterOption<T>(string adapterKey, T options)
|
||||
public MessageBuilder WithAdapterOption<T>(string adapterType, T options)
|
||||
{
|
||||
if (_adapterOptions is null) _adapterOptions = new AdapterOptionsBag();
|
||||
_adapterOptions.Set(adapterKey, options);
|
||||
_adapterOptions.Set(adapterType, options);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -141,13 +141,35 @@ public sealed class MessageBuilder
|
||||
// Текст
|
||||
if (!string.IsNullOrWhiteSpace(_text))
|
||||
{
|
||||
messageId = await _ctx.SendTextAsync(_text, _format, _inline, reply, _editMessageId, _adapterOptions, ct);
|
||||
var req = new SendRequest
|
||||
{
|
||||
ChatId = _ctx.Update.Chat.Id,
|
||||
Text = _text,
|
||||
TextFormat = _format,
|
||||
Inline = _inline,
|
||||
Reply = reply,
|
||||
MessageId = _editMessageId,
|
||||
AdapterOptions = _adapterOptions
|
||||
};
|
||||
|
||||
messageId = await _ctx.SendAsync(req, ct);
|
||||
}
|
||||
|
||||
// Файлы
|
||||
foreach (var (file, caption, captionFormat) in _files)
|
||||
{
|
||||
var res = await _ctx.SendFileAsync(file, caption, captionFormat, _inline, reply, _adapterOptions, ct);
|
||||
var req = new SendRequest
|
||||
{
|
||||
ChatId = _ctx.Update.Chat.Id,
|
||||
File = file,
|
||||
Caption = caption,
|
||||
CaptionFormat = captionFormat,
|
||||
Inline = _inline,
|
||||
Reply = reply,
|
||||
AdapterOptions = _adapterOptions
|
||||
};
|
||||
|
||||
var res = await _ctx.SendAsync(req, ct);
|
||||
// сохранить первый возвращённый id сообщения
|
||||
if (messageId is null && res is not null) messageId = res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user