aiogram
Messages, Reply and Inline without unpacking.
Installation
pip install telyx aiogramPackages are built locally; PyPI/npm publication is still pending.
Message
Inside a Message handler.
Python
import telyx as tx
await message.answer(f"{tx.wallet} Баланс: 500", parse_mode="HTML")
await message.answer(tx.render("<tx-circle-check> Оплачено"), parse_mode="HTML")Inline — no unpacking
Python
from aiogram.types import InlineKeyboardMarkup
keyboard = InlineKeyboardMarkup(inline_keyboard=[
[tx.wallet.button("Баланс", callback_data="balance")]
])
await message.answer("Меню", reply_markup=keyboard)Reply
Python
from aiogram.types import ReplyKeyboardMarkup
from telyx.telegram import keyboard_button
keyboard = ReplyKeyboardMarkup(
keyboard=[[keyboard_button("Баланс", tx.wallet)]],
resize_keyboard=True,
)
await message.answer("Меню", reply_markup=keyboard)Reusable helper
Reuse the keyboard function in your handlers.
Python
def balance_menu():
return InlineKeyboardMarkup(inline_keyboard=[
[tx.wallet.button("Баланс", callback_data="balance")]
])
# В обработчике:
await message.answer("Меню", reply_markup=balance_menu())Click
dp is your Dispatcher. Register the handler before polling.
Python
from aiogram import F
@dp.callback_query(F.data == "balance")
async def balance(callback):
await callback.answer("Баланс: 0", show_alert=True)Telegram requirements
Custom emoji availability depends on Telegram: the owner's Premium and sending context, or additional Fragment usernames. HTML is only for messages; button labels are plain text.