mirror of
https://github.com/kurbezz/discord-bot.git
synced 2025-12-06 15:15:37 +01:00
Fix
This commit is contained in:
@@ -38,6 +38,12 @@ class Category(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class GameList:
|
class GameList:
|
||||||
|
CATEGORY_MAP = {
|
||||||
|
"points": "Заказанные игры (за 12к)",
|
||||||
|
"paids": "Проплачены 🤑 ",
|
||||||
|
"gifts": "Подарки",
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(self, data: list[Category]):
|
def __init__(self, data: list[Category]):
|
||||||
self.data = data
|
self.data = data
|
||||||
|
|
||||||
@@ -58,11 +64,13 @@ class GameList:
|
|||||||
return cls(data=categories)
|
return cls(data=categories)
|
||||||
|
|
||||||
def add_game(self, category: str, game_item: GameItem):
|
def add_game(self, category: str, game_item: GameItem):
|
||||||
|
_category = self.CATEGORY_MAP.get(category)
|
||||||
|
|
||||||
if game_item.date is None:
|
if game_item.date is None:
|
||||||
game_item.date = datetime.now().strftime("%d.%m.%Y")
|
game_item.date = datetime.now().strftime("%d.%m.%Y")
|
||||||
|
|
||||||
for category_item in self.data:
|
for category_item in self.data:
|
||||||
if category_item.name == category:
|
if category_item.name == _category:
|
||||||
category_item.games.append(game_item)
|
category_item.games.append(game_item)
|
||||||
|
|
||||||
def delete_game(self, game_name: str):
|
def delete_game(self, game_name: str):
|
||||||
|
|||||||
Reference in New Issue
Block a user