Try to Handle Commands ...

This commit is contained in:
2026-11-12 23:48:17 +03:30
parent fa59823008
commit 2b7209c5fb
11 changed files with 412 additions and 64 deletions
+48 -42
View File
@@ -14,6 +14,7 @@ using System.Collections.Generic;
using xIdentityService.Interfaces;
using Microsoft.Extensions.Logging;
using xExceptions.Constants;
using System;
namespace xBotService.Providers
{
@@ -55,6 +56,9 @@ namespace xBotService.Providers
baseUrl: configuration.BaseRoute
);
//
result.Timeout = configuration.DefaultClientTimeout;
//
return result;
}
@@ -225,55 +229,57 @@ namespace xBotService.Providers
}
/// <summary>
/// Sending Verification Request Menu ...
/// Show Verification Request Menu ...
/// </summary>
/// <param name="chatId"></param>
/// <param name="botUserId"></param>
/// <param name="label"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
// public virtual async Task<XBotMessageResponse> SendVerificationMenu(
// long chatId,
// string label = "🔐 دریافت کد وریفیکیشن",
// CancellationToken cancellationToken = default
// )
// {
// //
// // Validate ...
// if (chatId <= 0 || label.IsNullOrEmpty())
// {
// XException.InvalidArgs.Throw();
// }
public virtual async Task<XBotMessage> ShowVerificationMenu(
long botUserId,
string label = XBotMessageIds.XBotRequestVerificationCodeLabel,
CancellationToken cancellationToken = default
)
{
//
// Validate ...
if (botUserId <= 0 || label.IsNullOrEmpty())
{
XException.InvalidArgs.Throw();
}
// //
// // Markup for Keyboards ...
// var markup = new XBotReplyMarkup
// {
// //
// InlineKeyboard =
// [
// //
// [
// //
// new XBotInlineButton
// {
// Text = label,
// CallbackData = "request_verification_code"
// }
// ]
// ]
// };
//
// Markup for Keyboards ...
var markup = XBotReplyMarkup
.InlineKeyboardMarkup(new XBotInlineKeyboardMarkup
{
InlineKeyboard = [
[
new XBotInlineKeyboardButton{
Text = label,
CallbackData = XBotMessageIds.XBotRequestVerificationCode
}
]
]
});
// //
// var response = await SendMessage(
// chatId: chatId,
// text: "برای دریافت کد وریفیکیشن روی دکمه زیر کلیک کنید:",
// replyMarkup: markup,
// cancellationToken: cancellationToken
// );
//
var requestModel = new XBotSendMessageRequest
{
ChatId = botUserId,
ReplyMarkup = markup.ReplyMarkup,
Text = XBotMessageIds.XBotRequestVerificationCodeMessageText,
};
//
var result = await SendMessage(
requestModel: requestModel,
cancellationToken: cancellationToken
);
// //
// return response;
// }
//
return result;
}
/// <summary>
/// Send Verification Code to Requests ...