constants.py 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. """
  2. MIT License
  3. Copyright (c) present TheHamkerCat
  4. Permission is hereby granted, free of charge, to any person obtaining a copy
  5. of this software and associated documentation files (the "Software"), to deal
  6. in the Software without restriction, including without limitation the rights
  7. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. copies of the Software, and to permit persons to whom the Software is
  9. furnished to do so, subject to the following conditions:
  10. The above copyright notice and this permission notice shall be included in all
  11. copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  18. SOFTWARE.
  19. """
  20. # New file
  21. from pyrogram import filters, enums
  22. from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
  23. from wbb import BOT_USERNAME, app
  24. MARKDOWN = """
  25. Read the below text carefully to find out how formatting works!
  26. <u>Supported Fillings:</u>
  27. <code>{name}</code> - This will mention the user with their name.
  28. <code>{chat}</code> - This will fill with the current chat name.
  29. NOTE: Fillings only works in greetings module.
  30. <u>Supported formatting:</u>
  31. <code>**Bold**</code> : This will show as <b>bold</b> text.
  32. <code>~~strike~~</code>: This will show as <strike>strike</strike> text.
  33. <code>__italic__</code>: This will show as <i>italic</i> text.
  34. <code>--underline--</code>: This will show as <u>underline</u> text.
  35. <code>`code words`</code>: This will show as <code>code</code> text.
  36. <code>||spoiler||</code>: This will show as <spoiler>Spoiler</spoiler> text.
  37. <code>[hyperlink](google.com)</code>: This will create a <a href='https://www.google.com'>hyperlink</a> text.
  38. <b>Note:</b> You can use both markdown & html tags.
  39. <u>Button formatting:</u>
  40. -> text ~ [button text, button link]
  41. <u>Example:</u>
  42. <b>example</b> <i>button with markdown</i> <code>formatting</code> ~ [button text, https://google.com]
  43. """
  44. @app.on_message(
  45. filters.command("markdownhelp")
  46. )
  47. async def mkdwnhelp(_, m: Message):
  48. keyb = InlineKeyboardMarkup(
  49. [
  50. [
  51. InlineKeyboardButton(
  52. text="Click Here!",
  53. url=f"http://t.me/{BOT_USERNAME}?start=mkdwn_help",
  54. )
  55. ]
  56. ]
  57. )
  58. if m.chat.type != enums.ChatType.PRIVATE:
  59. await m.reply(
  60. "Click on the below button to get markdown usage syntax in pm!",
  61. reply_markup=keyb,
  62. )
  63. else:
  64. await m.reply(
  65. MARKDOWN,
  66. parse_mode=enums.ParseMode.HTML,
  67. disable_web_page_preview=True
  68. )
  69. return