constants.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # New file
  2. from pyrogram.enums import ChatType, ParseMode
  3. from pyrogram.filters import command
  4. from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
  5. from wbb import BOT_USERNAME, app
  6. MARKDOWN = """
  7. Read the below text carefully to find out how formatting works!
  8. <u>Supported Fillings:</u>
  9. <code>{name}</code> - This will mention the user with their name.
  10. <code>{chat}</code> - This will fill with the current chat name.
  11. NOTE: Fillings only works in greetings module.
  12. <u>Supported formatting:</u>
  13. <code>**Bold**</code> : This will show as <b>bold</b> text.
  14. <code>~~strike~~</code>: This will show as <strike>strike</strike> text.
  15. <code>__italic__</code>: This will show as <i>italic</i> text.
  16. <code>--underline--</code>: This will show as <u>underline</u> text.
  17. <code>`code words`</code>: This will show as <code>code</code> text.
  18. <code>||spoiler||</code>: This will show as <spoiler>Spoiler</spoiler> text.
  19. <code>[hyperlink](google.com)</code>: This will create a <a href='https://www.google.com'>hyperlink</a> text.
  20. <b>Note:</b> You can use both markdown & html tags.
  21. <u>Button formatting:</u>
  22. -> text ~ [button text, button link]
  23. <u>Example:</u>
  24. <b>example</b> <i>button with markdown</i> <code>formatting</code> ~ [button text, https://google.com]
  25. """
  26. @app.on_message(command("markdownhelp"))
  27. async def mkdwnhelp(_, m: Message):
  28. keyb = InlineKeyboardMarkup(
  29. [
  30. [
  31. InlineKeyboardButton(
  32. text="Click Here!",
  33. url=f"http://t.me/{BOT_USERNAME}?start=mkdwn_help",
  34. )
  35. ]
  36. ]
  37. )
  38. if m.chat.type != ChatType.PRIVATE:
  39. await m.reply(
  40. "Click on the below button to get markdown usage syntax in pm!",
  41. reply_markup=keyb,
  42. )
  43. else:
  44. await m.reply(
  45. MARKDOWN, parse_mode=ParseMode.HTML, disable_web_page_preview=True
  46. )
  47. return