Instant in-bot preference toggles without web dashboards Forcing… — ⏤͟͞ROCODER — TG.ME

🎛️ Instant in-bot preference toggles without web dashboards

Forcing users out of Telegram into a web dashboard just to switch off digest emails usually leads to them blocking your bot. I built an interactive settings panel that toggles user alerts directly in Firebase and updates the button labels on the fly. Users can customize their exact notification preferences with one tap without reloading messages or leaving the chat.

📁 Filename: command/settings.js
👨‍💻 Code:
let email = await USER.getProp('opt_email').value() ?? true;
let digest = await USER.getProp('opt_digest').value() ?? false;
let buttons = [
[{ text: `Email Alerts: ${email ? 'ON 🔔' : 'OFF 🔕'}`, command: '/toggle_email' }],
[{ text: `Weekly Digest: ${digest ? 'ON 🔔' : 'OFF 🔕'}`, command: '/toggle_digest' }]
];
sendMessage('*Notification Preferences*\nTap options below to toggle instantly:', { buttons });


📁 Filename: command/toggle_email.js
👨‍💻 Code:
let current = await USER.getProp('opt_email').value() ?? true;
let next = !current;
USER.setProp('opt_email', next);
let digest = await USER.getProp('opt_digest').value() ?? false;
let buttons = [
[{ text: `Email Alerts: ${next ? 'ON 🔔' : 'OFF 🔕'}`, command: '/toggle_email' }],
[{ text: `Weekly Digest: ${digest ? 'ON 🔔' : 'OFF 🔕'}`, command: '/toggle_digest' }]
];
if (isCallback) answerCallback(`Email alerts turned ${next ? 'ON' : 'OFF'}`);
editButton(message_id, buttons);


📁 Filename: command/toggle_digest.js
👨‍💻 Code:
let current = await USER.getProp('opt_digest').value() ?? false;
let next = !current;
USER.setProp('opt_digest', next);
let email = await USER.getProp('opt_email').value() ?? true;
let buttons = [
[{ text: `Email Alerts: ${email ? 'ON 🔔' : 'OFF 🔕'}`, command: '/toggle_email' }],
[{ text: `Weekly Digest: ${next ? 'ON 🔔' : 'OFF 🔕'}`, command: '/toggle_digest' }]
];
if (isCallback) answerCallback(`Weekly digest turned ${next ? 'ON' : 'OFF'}`);
editButton(message_id, buttons);


💡 Always invoke answerCallback() during button updates to immediately stop Telegram's loading spinner on the user's screen.

#FlexGram
August 9, 2026 48