Files
shveitechbot/misc/texts.py

21 lines
671 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from db.models import Product
from dto.cart import CartDTO
def get_product_description(product: Product) -> str:
output = f"📦 <b>{product.name}</b>\n\n<b><i>🏷️ {product.price}₽</i></b>"
if product.description:
output += f"\n\n📜 {product.description}"
return output
def get_order_item_list(cart: CartDTO):
text = "🛍 Состав заказа:\n"
for i, product in enumerate(cart.items):
text += f"\n{i+1}. <b>{product.name}</b>\n\t<i>{product.quantity} × {product.price} = {product.total}₽</i>\n"
text += f"\n━━━━━━━━━━━━━━\n💰 Итого: {cart.total}"
return text