PutForAuction.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System.Linq;
  2. using System.Threading.Tasks;
  3. using CardCollector.Commands.Message;
  4. using CardCollector.Controllers;
  5. using CardCollector.DataBase.Entity;
  6. using CardCollector.Resources;
  7. using CardCollector.Session.Modules;
  8. using Telegram.Bot.Types;
  9. namespace CardCollector.Commands.CallbackQuery
  10. {
  11. public class PutForAuction : CallbackQueryCommand
  12. {
  13. protected override string CommandText => Command.sell_on_auction;
  14. protected override bool ClearMenu => false;
  15. protected override bool AddToStack => false;
  16. public override async Task Execute()
  17. {
  18. await MessageController.AnswerCallbackQuery(User, CallbackQueryId, Messages.comission_warning, true);
  19. await User.ClearChat();
  20. var module = User.Session.GetModule<CollectionModule>();
  21. var priceList = (await AuctionController.GetPriceList(module.SelectedSticker.Id)).ToList();
  22. var lowerPrice = priceList.Count > 0 ? priceList.Min() : 0;
  23. var message = await MessageController.SendMessage(User,
  24. $"{Messages.current_price} {module.SellPrice}{Text.gem}" +
  25. $"\n{Messages.lower_price} {lowerPrice}{Text.gem}" +
  26. $"\n{Messages.enter_your_gems_price} {Text.gem}:", Keyboard.AuctionPutCancelKeyboard);
  27. EnterGemsPrice.AddToQueue(User.Id);
  28. User.Session.Messages.Add(message.MessageId);
  29. }
  30. public PutForAuction() { }
  31. public PutForAuction(UserEntity user, Update update) : base(user, update) { }
  32. }
  33. }