Created At: 2026-11-18T04:16:37Z
Completed At: 2026-11-18T04:16:37Z
Command exited with code 0.
Command output:
const { Markup } = require('telegraf');
function getOfferCountdown() {
const now = new Date();
// Offset for IST (UTC+5:30)
const istOffsetMs = 5.5 * 60 * 60 * 1000;
const istNow = new Date(now.getTime() + istOffsetMs);
// Target: Next 12:00:00 AM IST (Midnight)
const nextMidnight = new Date(istNow);
nextMidnight.setUTCHours(24, 0, 0, 0);
const diffMs = Math.max(0, nextMidnight.getTime() - istNow.getTime());
const hours = Math.floor(diffMs / (1000 * 60 * 60));
const minutes = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((diffMs % (1000 * 60)) / 1000);
const pad = (n) => String(n).padStart(2, '0');
return `${pad(hours)}h : ${pad(minutes)}m : ${pad(seconds)}s`;
}
function getOffersMessage() {
const timer = getOfferCountdown();
return `╭━━━━━━━━━━━━━━━━━━━━━━╮\n` +
`🔥 @MayaXAdharbot\n` +
`🎁 𝐓𝐎𝐃𝐀𝐘'𝐒 𝐒𝐏𝐄𝐂𝐈𝐀𝐋 𝐎𝐅𝐅𝐄𝐑𝐒\n` +
`╰━━━━━━━━━━━━━━━━━━━━━━╯\n\n` +
`⏳ 𝐎𝐅𝐅𝐄𝐑 𝐄𝐍𝐃𝐒 𝐈𝐍: ${timer}\n` +
`━━━━━━━━━━━━━━━━━━━━━━━━\n\n` +
`🪙 𝐄𝐗𝐓𝐑𝐀 𝐂𝐑𝐄𝐃𝐈𝐓 𝐁𝐎𝐍𝐔𝐒 𝐎𝐅𝐅𝐄𝐑𝐒\n` +
`━━━━━━━━━━━━━━━━━━━━━━━━\n` +
`🔹 Buy 𝟓 Credits (₹𝟑𝟎𝟎) → +𝟐 Credits Extra 🎁 (Total: 𝟕)\n` +
`🔹 Buy 𝟏𝟎 Credits (₹𝟔𝟎𝟎) → +𝟒 Credits Extra 🎁 (Total: 𝟏𝟒)\n` +
`🔹 Buy 𝟐𝟎 Credits (₹𝟏,𝟐𝟎𝟎) → +𝟏𝟎 Credits Extra 🎁 (Total: 𝟑𝟎)\n` +
`🔹 Buy 𝟓𝟎 Credits (₹𝟑,𝟎𝟎𝟎) → +𝟒𝟎 Credits Extra 🎁 (Total: 𝟗𝟎)\n` +
`🔹 Buy 𝟏𝟎𝟎 Credits (₹𝟔,𝟎𝟎𝟎) → +𝟐𝟎𝟎 Credits Extra 🚀 (Total: 𝟑𝟎𝟎)\n\n` +
`━━━━━━━━━━━━━━━━━━━━━━━━\n` +
`💎 𝐔𝐍𝐋𝐈𝐌𝐈𝐓𝐄𝐃 𝐕𝐈𝐏 𝐄𝐗𝐓𝐑𝐀 𝐃𝐀𝐘𝐒 𝐎𝐅𝐅𝐄𝐑\n` +
`━━━━━━━━━━━━━━━━━━━━━━━━\n` +
`👑 𝟏 𝐃𝐚𝐲 𝐕𝐈𝐏 (₹𝟑𝟗𝟗) → +𝟏 Day Extra Free 🎁 (Total: 𝟐 Days)\n` +
`👑 𝐖𝐞𝐞𝐤𝐥𝐲 𝐕𝐈𝐏 (₹𝟏,𝟗𝟗𝟗) → +𝟑 Days Extra Free 🎁 (Total: 𝟏𝟎 Days)\n` +
`👑 𝐌𝐨𝐧𝐭𝐡𝐥𝐲 𝐕𝐈𝐏 (₹𝟓,𝟗𝟗𝟗) → +𝟏𝟎 Days Extra Free 🚀 (Total: 𝟒𝟎 Days)\n\n` +
`━━━━━━━━━━━━━━━━━━━━━━━━\n` +
`⚡ 𝐍𝐎𝐓𝐄: Payment confirm hote hi bonus credits / extra days automatic account mein jud jaate hain!\n\n` +
`👇 Niche diye gaye buttons se offer claim karein:`;
}
function getOffersKeyboard() {
return Markup.inlineKeyboard([
[
{ text: '🪙 Buy Credits (With Bonus)', callback_data: 'BUY_CUSTOM_CREDITS', style: 'primary' },
{ text: '💎 Buy VIP (Extra Days)', callback_data: 'BUY_UNLIMITED_PLANS', style: 'primary' }
],
[
{ text: '🔄 Refresh Countdown ⏳', callback_data: 'REFRESH_OFFERS_TIMER', style: 'success' }
]
]);
}
function startLiveTimer(ctx, messageId) {
let ticks = 0;
const maxTicks = 12; // 12 * 5s = 60 seconds of live updating
const interval = setInterval(async () => {
ticks++;
if (ticks >= maxTicks) {
clearInterval(interval);
return;
}
try {
await ctx.telegram.editMessageText(
ctx.chat.id,
messageId,
undefined,
getOffersMessage(),
{ parse_mode: 'HTML', ...getOffersKeyboard() }
);
} catch (e) {
// Stop on any error (e.g. message deleted or not modified)
clearInterval(interval);
}
}, 5000);
}
function registerOffersCommand(bot) {
bot.command(['offers', 'Offers', 'offer', 'Offer'], async (ctx) => {
try {
const msg = await ctx.reply(getOffersMessage(), {
parse_mode: 'HTML',
...getOffersKeyboard()
});
if (msg && msg.message_id) {
startLiveTimer(ctx, msg.message_id);
}
} catch (err) {
console.error('[OFFERS COMMAND ERROR]:', err.message);
}
});
bot.action('REFRESH_OFFERS_TIMER', async (ctx) => {
try {
await ctx.answerCbQuery('⏳ Live timer refreshed!').catch(() => {});
await ctx.editMessageText(getOffersMessage(), {
parse_mode: 'HTML',
...getOffersKeyboard()
});
} catch (e) {
// Ignore if content not changed
}
});
bot.action('SHOW_OFFERS_MENU', async (ctx) => {
try {
await ctx.answerCbQuery().catch(() => {});
await ctx.reply(getOffersMessage(), {
parse_mode: 'HTML',
...getOffersKeyboard()
});
} catch (e) {
console.error('[SHOW_OFFERS_MENU ERROR]:', e.message);
}
});
}
module.exports = {
registerOffersCommand,
getOfferCountdown,
getOffersMessage,
getOffersKeyboard
};