feat: created auth hook on TClient

This commit is contained in:
2025-07-25 18:35:59 +03:00
parent f115760713
commit 970526d84e
12 changed files with 141 additions and 71 deletions

View File

@@ -1,3 +1,4 @@
using JOBot.TClient.Infrastructure.Extensions;
using Telegram.Bot;
using Telegram.Bot.Types;
@@ -9,6 +10,6 @@ public class MenuService(ITelegramBotClient bot)
{
ArgumentNullException.ThrowIfNull(update.Message?.From);
await bot.SendMessage(update.Message.From.Id, "PrepareUser stage is done.", cancellationToken: ct);
await bot.SendMessageRemK(update.Message.From.Id, "PrepareUser stage is done.", cancellationToken: ct);
}
}

View File

@@ -1,5 +1,6 @@
using JOBot.Proto;
using JOBot.TClient.Infrastructure.Exceptions;
using JOBot.TClient.Infrastructure.Extensions;
using Telegram.Bot;
using Telegram.Bot.Types;
using User = JOBot.Proto.User;
@@ -31,7 +32,7 @@ public class PrepareUserService(ITelegramBotClient bot, User.UserClient userClie
if (!result.Success)
{
await _bot.SendMessage(update.Message.Chat.Id,
await _bot.SendMessageRemK(update.Message.Chat.Id,
TextResource.FallbackMessage,
cancellationToken: ct);
@@ -59,7 +60,7 @@ public class PrepareUserService(ITelegramBotClient bot, User.UserClient userClie
{
ArgumentNullException.ThrowIfNull(update.Message?.From);
await _bot.SendMessage(
await _bot.SendMessageRemK(
update.Message.From.Id,
TextResource.EULA,
replyMarkup: new[] { ButtonResource.EULAAgrement }, cancellationToken: ct);
@@ -93,7 +94,7 @@ public class PrepareUserService(ITelegramBotClient bot, User.UserClient userClie
UserId = update.Message.From.Id
});
await _bot.SendMessage(
await _bot.SendMessageRemK(
update.Message.From.Id,
string.Format(TextResource.AskForAuth, [url.RegistrationUrl]),
cancellationToken: ct);
@@ -101,7 +102,7 @@ public class PrepareUserService(ITelegramBotClient bot, User.UserClient userClie
public async Task AuthHookReceived(long userId, CancellationToken ct = default)
{
await _bot.SendMessage(userId, "Авторизация завершена успешно!", cancellationToken: ct);
await _bot.SendMessageRemK(userId, "✅ Авторизация завершена успешно!", cancellationToken: ct);
await SelectCv(userId, ct);
}
@@ -114,7 +115,7 @@ public class PrepareUserService(ITelegramBotClient bot, User.UserClient userClie
public async Task SelectCv(long userId, CancellationToken ct = default)
{
await _bot.SendMessage(userId, "Давайте выберем одно из доступных резюме:",
await _bot.SendMessageRemK(userId, "Давайте выберем одно из доступных резюме:",
cancellationToken: ct); //TODO: https://git.lisoveliy.su/Lisoveliy/JOBot/issues/9
}
}