soumyadeepdas/TbhRichBotPublic · Community Store Listing

Rich Message Demo [TBH]

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

commands/_richMath.js

javascript · 74 lines · click line # to share

1/**#command2name: /richMath3answer: 4keyboard: 5parse_mode: 6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12const html = `13<h1>Mathematical Expressions</h1>14 15<p>This page demonstrates mathematical expressions introduced in Bot API 10.1.</p>16 17<hr/>18 19<h3>Inline Mathematical Expressions</h3>20<p><tg-math>x^2 + y^2 = z^2</tg-math></p>21<p><tg-math>E = mc^2</tg-math></p>22<p><tg-math>\\frac{a+b}{2}</tg-math></p>23<p><tg-math>\\sqrt{x}</tg-math></p>24 25<hr/>26 27<h3>Block Mathematical Expressions</h3>28<tg-math-block>x^2 + y^2 = z^2</tg-math-block>29<tg-math-block>E = mc^2</tg-math-block>30<tg-math-block>\\int_0^1 x^2\\,dx</tg-math-block>31<tg-math-block>\\sum_{n=1}^{10} n</tg-math-block>32 33<hr/>34 35<h3>Algebra Examples</h3>36<tg-math-block>x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}</tg-math-block>37<tg-math-block>(a+b)^2 = a^2 + 2ab + b^2</tg-math-block>38 39<hr/>40 41<h3>Calculus Examples</h3>42<tg-math-block>\\frac{d}{dx}(x^2)=2x</tg-math-block>43<tg-math-block>\\int x^2\\,dx = \\frac{x^3}{3}+C</tg-math-block>44 45<hr/>46 47<h3>Greek Symbols</h3>48<p><tg-math>\\alpha + \\beta = \\gamma</tg-math></p>49<p><tg-math>\\pi \\approx 3.14159</tg-math></p>50<p><tg-math>\\theta = 90^{\\circ}</tg-math></p>51 52<hr/>53 54<h3>Large Formula (Scrollable)</h3>55<p>Large formulas automatically become horizontally scrollable when needed.</p>56<tg-math-block>f(x)=a_0+\\sum_{n=1}^{50}\\left(a_n\\cos\\left(\\frac{2\\pi nx}{L}\\right)+b_n\\sin\\left(\\frac{2\\pi nx}{L}\\right)\\right)+\\frac{\\sqrt{x^4+2x^2+1}}{\\sqrt{x^8+x^4+1}}+\\prod_{k=1}^{20}\\left(1+\\frac{1}{k^2}\\right)</tg-math-block>57 58<footer>Bot API 10.1 • Mathematical Expressions Demo</footer>59`;60 61Api.call("editMessageText", {62  chat_id: chat.chatid,63  message_id: update.callback_query.message.message_id,64  rich_message: { html: html },65  reply_markup: {66    inline_keyboard: [67      [68        { text: "« Date & Time", callback_data: "/richDateTime" },69        { text: "Home", callback_data: "/start" },70        { text: "Layout »", callback_data: "/richLayout" }71      ]72    ]73  }74});