This commit is contained in:
@@ -6,6 +6,7 @@ from src.handlers.city import city_list_handler, select_city_handler
|
||||
from src.handlers.company import company_list_handler, select_company_handler
|
||||
from src.handlers.category import category_list_handler
|
||||
from src.handlers.cart import cart_list_handler, add_item_handler
|
||||
from src.handlers.cart import order_handler
|
||||
from src.handlers.user import register_handler
|
||||
|
||||
from src.fmt.city_formatter import CityFormatter
|
||||
@@ -62,3 +63,6 @@ def setup(bot: botlib.Bot, prefix: str):
|
||||
count = int(count)
|
||||
await add_item_handler(bot=bot, room_id=room.room_id, sender=message.sender, admin_id=bot.config.admin_id, item_name=name, count=count)
|
||||
|
||||
if match.command('order'):
|
||||
await order_handler(bot=bot, room_id=room.room_id, sender=message.sender, admin_id=bot.config.admin_id)
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ from src.api.v2.cart_api import CartAPI
|
||||
from src.fetcher.v2.api_fetcher import ApiFetcher
|
||||
from src.fmt.item_formatter import ItemFormatter
|
||||
from src.fmt.cart_item_formatter import CartItemFormatter
|
||||
from src.fmt.order_formatter import OrderFormatter
|
||||
|
||||
dots_bot_api_config = DotsBotApiConfig()
|
||||
|
||||
@@ -22,6 +23,17 @@ async def cart_list_handler(room_id: str, bot: botlib.Bot, sender: str, admin_id
|
||||
|
||||
await bot.api.send_markdown_message(room_id=room_id, message=msg)
|
||||
|
||||
async def order_handler(room_id: str, bot: botlib.Bot, sender: str, admin_id: str):
|
||||
|
||||
session = aiohttp.ClientSession(json_serialize=ujson.dumps)
|
||||
apiFetcher = ApiFetcher(dots_bot_api_config.get_base_url(), session)
|
||||
formatter = OrderFormatter()
|
||||
cartAPI = CartAPI(apiFetcher, formatter)
|
||||
|
||||
msg: str = await cartAPI.get_order_message(sender)
|
||||
|
||||
await bot.api.send_markdown_message(room_id=room_id, message=msg)
|
||||
|
||||
async def add_item_handler(room_id: str, bot: botlib.Bot, sender: str, admin_id: str, item_name: str, count: int):
|
||||
|
||||
session = aiohttp.ClientSession(json_serialize=ujson.dumps)
|
||||
|
||||
Reference in New Issue
Block a user