Telyx documentation
Icons through tx. Start with the examples below or choose a platform.
Installation
Python 3.10+. The command becomes available after publishing the package on PyPI. The examples below use aiogram, which is installed separately.
pip install telyxMessages
Inside an aiogram handler. Enable HTML for inline emoji in text.
import telyx as tx
await message.answer(
f"{tx.wallet} Ваш баланс",
parse_mode="HTML",
)Handle clicks
dp is your Dispatcher. Reply buttons arrive as messages, inline buttons as callbacks.
from aiogram import F
from aiogram.types import Message, CallbackQuery
@dp.message(F.text == "Баланс")
async def reply_balance(message: Message):
await message.answer("Баланс: 0")
@dp.callback_query(F.data == "balance")
async def inline_balance(callback: CallbackQuery):
await callback.answer("Баланс: 0", show_alert=True)Color and size in Telegram
An existing emoji stores its own image: its ID cannot change its size, arbitrary color or background. For a different design, create a 100×100 image and upload it as a new custom emoji. Telegram chooses the color of recolorable packs based on context. Button backgrounds support only the built-in primary, success and danger styles. Custom emoji availability depends on Telegram requirements: the bot owner's Premium and sending context, or additional Fragment usernames.
button = tx.wallet.button(
"Баланс", callback_data="balance", style="primary"
)
# Обычная emoji без premium-иконки:
plain = tx.wallet.button(
"Баланс", callback_data="balance", custom_emoji=False
)On the web
React icon size is set in pixels. Telegram button color uses style, not React component styling.
import { TelyxIcon } from "@telyx/react";
<TelyxIcon name="wallet" size={32} />