soumyadeepdas/TbhRichBotPublic · Community Store Listing

Rich Message Demo [TBH]

ProfileTelegram
17 commands0 envUpdated 5d agoCreated Jul 16, 2026
Back to folder

commands/_richDateTime.js

javascript · 57 lines · click line # to share

1/**#command2name: /richDateTime3answer: 4keyboard: 5parse_mode: 6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12const now = Math.floor(Date.now() / 1000);13const tomorrow = now + 86400;14const nextWeek = now + (86400 * 7);15const nextMonth = now + (86400 * 30);16 17const html = `18<h1>Date & Time</h1>19 20<p>This page demonstrates RichTextDateTime introduced in Bot API 10.1.</p>21 22<hr/>23 24<h3>Upcoming Events</h3>25<p><tg-time unix="${tomorrow}" format="wDT">Tomorrow</tg-time></p>26<p><tg-time unix="${nextWeek}" format="wDT">Next Week</tg-time></p>27<p><tg-time unix="${nextMonth}" format="wDT">Next Month</tg-time></p>28 29<hr/>30 31<h3>Different Formats</h3>32<p><tg-time unix="${now}" format="T">Time Only</tg-time></p>33<p><tg-time unix="${now}" format="D">Date Only</tg-time></p>34<p><tg-time unix="${now}" format="DT">Date & Time</tg-time></p>35 36<hr/>37 38<h3>User Local Timezone</h3>39<p>These timestamps automatically render according to the user's Telegram timezone.</p>40 41<footer>Bot API 10.1 • RichTextDateTime Demo</footer>42`;43 44Api.call("editMessageText", {45  chat_id: chat.chatid,46  message_id: update.callback_query.message.message_id,47  rich_message: { html: html },48  reply_markup: {49    inline_keyboard: [50      [51        { text: "« Entities", callback_data: "/richEntities" },52        { text: "Home", callback_data: "/start" },53        { text: "Math »", callback_data: "/richMath" }54      ]55    ]56  }57});