52 lines
2.0 KiB
C#
52 lines
2.0 KiB
C#
using Telegram.Bot;
|
|
using Telegram.Bot.Types;
|
|
using Telegram.Bot.Types.Enums;
|
|
using Telegram.Bot.Types.ReplyMarkups;
|
|
|
|
namespace JOBot.TClient.Infrastructure.Extensions;
|
|
|
|
public static class TelegramBotClientExtensions
|
|
{
|
|
/// <summary>
|
|
/// Extension method for auto-remove of reply keyboard if is null
|
|
/// </summary>
|
|
/// <param name="bot"></param>
|
|
/// <param name="chatId"></param>
|
|
/// <param name="text"></param>
|
|
/// <param name="parseMode"></param>
|
|
/// <param name="replyParameters"></param>
|
|
/// <param name="replyMarkup"></param>
|
|
/// <param name="linkPreviewOptions"></param>
|
|
/// <param name="messageThreadId"></param>
|
|
/// <param name="entities"></param>
|
|
/// <param name="disableNotification"></param>
|
|
/// <param name="protectContent"></param>
|
|
/// <param name="messageEffectId"></param>
|
|
/// <param name="businessConnectionId"></param>
|
|
/// <param name="allowPaidBroadcast"></param>
|
|
/// <param name="cancellationToken"></param>
|
|
/// <returns></returns>
|
|
public static Task<Message> SendMessageRemK(
|
|
this ITelegramBotClient bot,
|
|
ChatId chatId,
|
|
string text,
|
|
ParseMode parseMode = default,
|
|
ReplyParameters? replyParameters = null,
|
|
ReplyMarkup? replyMarkup = null,
|
|
LinkPreviewOptions? linkPreviewOptions = null,
|
|
int? messageThreadId = null,
|
|
IEnumerable<MessageEntity>? entities = null,
|
|
bool disableNotification = false,
|
|
bool protectContent = false,
|
|
string? messageEffectId = null,
|
|
string? businessConnectionId = null,
|
|
bool allowPaidBroadcast = false,
|
|
CancellationToken cancellationToken = default)
|
|
{
|
|
replyMarkup ??= new ReplyKeyboardRemove();
|
|
|
|
return bot.SendMessage(chatId, text, parseMode, replyParameters, replyMarkup, linkPreviewOptions, messageThreadId,
|
|
entities, disableNotification, protectContent, messageEffectId, businessConnectionId, allowPaidBroadcast,
|
|
cancellationToken);
|
|
}
|
|
} |