[store] Fix button order. Fix internal id for anim boobs.

This commit is contained in:
West14
2022-02-16 18:27:09 +02:00
parent 56cc2ebf77
commit 5718b49455
6 changed files with 9 additions and 6 deletions
+2 -1
View File
@@ -41,7 +41,8 @@ public class Store : BotEventHandler
var counter = 0; var counter = 0;
var list = new List<InlineKeyboardButton>(); var list = new List<InlineKeyboardButton>();
foreach (var item in _provider.GetServices<IRandomMediaService>()) foreach (var item in _provider.GetServices<IRandomMediaService>()
.OrderByDescending(s => s.StoreItem.Order))
{ {
var btn = item.StoreItem.ToButton(From.Id); var btn = item.StoreItem.ToButton(From.Id);
if ((counter & 1) == 0) // 0 - even, 1 - odd if ((counter & 1) == 0) // 0 - even, 1 - odd
+3 -1
View File
@@ -7,12 +7,14 @@ public class StoreItem
public string Id; public string Id;
public readonly string Name; public readonly string Name;
public readonly double Price; public readonly double Price;
public readonly int Order;
public StoreItem(string id, string name, double price) public StoreItem(string id, string name, double price, int order = 0)
{ {
Id = id; Id = id;
Name = name; Name = name;
Price = price; Price = price;
Order = order;
} }
public InlineKeyboardButton ToButton(long userId) public InlineKeyboardButton ToButton(long userId)
@@ -6,7 +6,7 @@ namespace West.TelegramBot.ContentStore.Service;
public class AnimBoobsService : IRandomMediaService public class AnimBoobsService : IRandomMediaService
{ {
private readonly HttpClient _httpClient; private readonly HttpClient _httpClient;
public StoreItem StoreItem { get; } = new("boobs", "Сиськи движущиеся", 120); public StoreItem StoreItem { get; } = new("anim_boobs", "Сиськи движущиеся", 120, 40);
public AnimBoobsService() public AnimBoobsService()
{ {
@@ -4,6 +4,6 @@ namespace West.TelegramBot.ContentStore.Service;
public class CatApiService : AnimalAsAService public class CatApiService : AnimalAsAService
{ {
public override StoreItem StoreItem { get; } = new("cat", "Котэ", 40); public override StoreItem StoreItem { get; } = new("cat", "Котэ", 40, 10);
public CatApiService() : base(new Uri("https://api.thecatapi.com/v1/")) {} public CatApiService() : base(new Uri("https://api.thecatapi.com/v1/")) {}
} }
@@ -4,6 +4,6 @@ namespace West.TelegramBot.ContentStore.Service;
public class DogApiService : AnimalAsAService public class DogApiService : AnimalAsAService
{ {
public override StoreItem StoreItem { get; } = new("dog", "Пёсель", 40); public override StoreItem StoreItem { get; } = new("dog", "Пёсель", 40, 20);
public DogApiService() : base(new Uri("https://api.thedogapi.com/v1/")) {} public DogApiService() : base(new Uri("https://api.thedogapi.com/v1/")) {}
} }
@@ -6,7 +6,7 @@ namespace West.TelegramBot.ContentStore.Service;
public class OBoobsService : IRandomMediaService public class OBoobsService : IRandomMediaService
{ {
private readonly HttpClient _httpClient; private readonly HttpClient _httpClient;
public StoreItem StoreItem { get; } = new("boobs", "Сиськи", 60); public StoreItem StoreItem { get; } = new("boobs", "Сиськи", 60, 30);
public OBoobsService() public OBoobsService()
{ {