Add 'Upcoming Jackpot' button to Telegram bot menu
Shows current prize pool, ticket price, draw time, and time remaining
This commit is contained in:
@@ -238,6 +238,33 @@ bot.on('message', async (msg) => {
|
|||||||
|
|
||||||
// Handle menu button presses
|
// Handle menu button presses
|
||||||
switch (text) {
|
switch (text) {
|
||||||
|
case '🎰 Upcoming Jackpot':
|
||||||
|
try {
|
||||||
|
const jackpot = await apiClient.getNextJackpot();
|
||||||
|
|
||||||
|
if (!jackpot) {
|
||||||
|
await bot.sendMessage(msg.chat.id, messages.buy.noActiveJackpot, {
|
||||||
|
parse_mode: 'Markdown',
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const drawTime = new Date(jackpot.cycle.scheduled_at);
|
||||||
|
const jackpotMessage = `🎰 *Upcoming Jackpot*
|
||||||
|
|
||||||
|
💰 *Prize Pool:* ${formatSats(jackpot.cycle.pot_total_sats)} sats
|
||||||
|
🎟 *Ticket Price:* ${formatSats(jackpot.lottery.ticket_price_sats)} sats
|
||||||
|
⏰ *Draw at:* ${formatDate(drawTime)}
|
||||||
|
⏳ *Time left:* ${formatTimeUntil(drawTime)}
|
||||||
|
|
||||||
|
Use /buyticket to get your tickets! 🍀`;
|
||||||
|
|
||||||
|
await bot.sendMessage(msg.chat.id, jackpotMessage, { parse_mode: 'Markdown' });
|
||||||
|
} catch (error) {
|
||||||
|
logger.error('Error showing jackpot', { error });
|
||||||
|
await bot.sendMessage(msg.chat.id, messages.errors.systemUnavailable);
|
||||||
|
}
|
||||||
|
return;
|
||||||
case '🎟 Buy Tickets':
|
case '🎟 Buy Tickets':
|
||||||
await handleBuyCommand(bot, msg);
|
await handleBuyCommand(bot, msg);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { NotificationPreferences } from '../types';
|
|||||||
export function getMainMenuKeyboard(): ReplyKeyboardMarkup {
|
export function getMainMenuKeyboard(): ReplyKeyboardMarkup {
|
||||||
return {
|
return {
|
||||||
keyboard: [
|
keyboard: [
|
||||||
|
[{ text: '🎰 Upcoming Jackpot' }],
|
||||||
[{ text: '🎟 Buy Tickets' }, { text: '🧾 My Tickets' }],
|
[{ text: '🎟 Buy Tickets' }, { text: '🧾 My Tickets' }],
|
||||||
[{ text: '🏆 My Wins' }, { text: '⚡ Lightning Address' }],
|
[{ text: '🏆 My Wins' }, { text: '⚡ Lightning Address' }],
|
||||||
[{ text: '⚙️ Settings' }, { text: 'ℹ️ Help' }],
|
[{ text: '⚙️ Settings' }, { text: 'ℹ️ Help' }],
|
||||||
|
|||||||
Reference in New Issue
Block a user