mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
feat(store): job application
This commit is contained in:
@@ -19,13 +19,13 @@ public class Store : CommonHandler
|
||||
{
|
||||
private readonly IReputation? _reputation;
|
||||
private readonly IServiceProvider _provider;
|
||||
private readonly ContentStore _store;
|
||||
private readonly UserService _userService;
|
||||
|
||||
public Store(CoreContext db, IServiceProvider provider, ContentStore store) : base(db)
|
||||
public Store(CoreContext db, IServiceProvider provider, UserService userService) : base(db)
|
||||
{
|
||||
_reputation = provider.GetService<IReputation>();
|
||||
_provider = provider;
|
||||
_store = store;
|
||||
_userService = userService;
|
||||
}
|
||||
|
||||
[InChat(InChat.Public)]
|
||||
@@ -47,6 +47,7 @@ public class Store : CommonHandler
|
||||
var reputation = await _reputation.GetUserReputationAsync(Chat, user);
|
||||
|
||||
await Bot.SendMessage(Chat.Id, $"<b>{user.ToHtml()} ({reputation})</b>, чего пожелаете?", parseMode: ParseMode.Html,
|
||||
replyParameters: Message!.Id,
|
||||
replyMarkup: new InlineKeyboardMarkup(
|
||||
_provider.GetServices<IRandomMediaService>()
|
||||
.ToAsyncEnumerable()
|
||||
@@ -99,12 +100,21 @@ public class Store : CommonHandler
|
||||
var messageId = query.Message!.MessageId;
|
||||
var reputation = await _reputation.GetUserReputationAsync(Chat, From);
|
||||
if (reputation < storeItem.Price)
|
||||
{
|
||||
if (!_userService.IsUserUnlucky(From.Id))
|
||||
{
|
||||
await Bot.EditMessageText(
|
||||
Chat.Id,
|
||||
messageId,
|
||||
$"<b>{From.ToHtml()} ({reputation})</b>, продолжай работать и тебе обязательно хватит на покупку.",
|
||||
ParseMode.Html);
|
||||
}
|
||||
else
|
||||
{
|
||||
var inputFile = new InputFileUrl("https://unclesix-prod-static.s3.twcstorage.ru/job_application.jpg");
|
||||
await Bot.EditMessageMedia(Chat.Id, messageId, new InputMediaPhoto(inputFile));
|
||||
}
|
||||
|
||||
await AnswerQuery(query.Id);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user