Files
BotPages/BotPages.Core/Context/PageContextAdapterExtensions.cs
FrigaT 57b3706241
All checks were successful
CI / build-test (push) Successful in 29s
Release / pack-and-publish (release) Successful in 32s
Выделены отдельные расширения
2025-12-06 07:52:01 +03:00

31 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using BotPages.Core.Abstractions;
using BotPages.Core.Messaging;
namespace BotPages.Core;
/// <summary>
/// Расширения <see cref="PageContext"/> для работы с <see cref="IMessengerAdapter"/>
/// </summary>
public static class PageContextAdapterExtensions
{
/// <summary>
/// Отправить текстовое сообщение.
/// </summary>
public static Task SendTextAsync(this PageContext ctx, string text, MessageFormat format = MessageFormat.Plain,
IEnumerable<IEnumerable<InlineButton>>? inline = null,
IEnumerable<IEnumerable<ReplyButton>>? reply = null,
CancellationToken ct = default)
=> ctx.Adapter.SendTextAsync(ctx.Update.Chat.Id, text, format, inline, reply, ct);
/// <summary>
/// Отправить файл.
/// </summary>
public static Task SendFileAsync(this PageContext ctx, FileDescriptor file, string? caption = null, MessageFormat? captionFormat = null, CancellationToken ct = default)
=> ctx.Adapter.SendFileAsync(ctx.Update.Chat.Id, file, caption, captionFormat, ct);
/// <summary>
/// Отправить файл.
/// </summary>
public static Task SendFileAsync(this PageContext ctx, FileDescriptor file, string? caption = null, CancellationToken ct = default)
=> ctx.Adapter.SendFileAsync(ctx.Update.Chat.Id, file, caption, null, ct);
}