Add Premium Emoji Support for Premium Bot Accounts
All checks were successful
continuous-integration/drone/push Build is passing

- Create src/core/premium_emoji.py module for premium emoji handling
- Create src/core/telegram_config.py for global parse_mode configuration
- Update bot_controller.py to use HTML parse_mode for better emoji support
- Add PREMIUM_EMOJI_SUPPORT.md documentation with usage examples
- HTML parse_mode now default for all messages to support premium emojis
- Aiogram 3.16.0+ supports premium emojis natively when using correct parse_mode

Benefits:
- Premium bot accounts can now display special premium emojis
- Better emoji rendering across all message types
- Centralized configuration for parse modes
- Backwards compatible with regular emoji
This commit is contained in:
Lottery Bot Admin
2026-03-07 00:26:20 +00:00
parent 4daec268e6
commit 21f348471e
3 changed files with 140 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ import logging
from src.interfaces.base import IBotController, ILotteryService, IUserService, IKeyboardBuilder, IMessageFormatter
from src.interfaces.base import ILotteryRepository, IParticipationRepository
from src.core.config import ADMIN_IDS
from src.core.telegram_config import get_parse_mode
logger = logging.getLogger(__name__)
@@ -88,7 +89,7 @@ class BotController(IBotController):
await callback.answer("❌ Нет активных розыгрышей", show_alert=True)
return
text = "🎲 **Активные розыгрыши:**\n\n"
text = "🎲 <b>Активные розыгрыши:</b>\n\n"
for lottery in lotteries:
participants_count = await self.participation_repo.get_count_by_lottery(lottery.id)
@@ -112,7 +113,7 @@ class BotController(IBotController):
await callback.message.edit_text(
text,
reply_markup=keyboard,
parse_mode="Markdown"
parse_mode=get_parse_mode("inline_keyboard")
)
except Exception as e:
# Если сообщение не изменилось - просто отвечаем на callback
@@ -124,5 +125,5 @@ class BotController(IBotController):
await callback.message.answer(
text,
reply_markup=keyboard,
parse_mode="Markdown"
)
parse_mode=get_parse_mode("inline_keyboard")
)