Explorar o código

Added /markdownhelp (#113)

ÁÑÑÍHÌLÅTØR SPÄRK %!s(int64=5) %!d(string=hai) anos
pai
achega
6768091e27

+ 6 - 1
wbb/__main__.py

@@ -34,6 +34,7 @@ from wbb import (BOT_NAME, BOT_USERNAME, LOG_GROUP_ID, USERBOT_NAME,
 from wbb.modules import ALL_MODULES
 from wbb.modules.sudoers import bot_sys_stats
 from wbb.utils import paginate_modules
+from wbb.utils.constants import MARKDOWN
 from wbb.utils.dbfunctions import clean_restart_stage
 
 loop = asyncio.get_event_loop()
@@ -159,7 +160,11 @@ async def help_command(_, message):
         return await message.reply(
             "Pm Me For More Details.", reply_markup=keyboard
         )
-    await message.reply(
+    if len(message.text.split()) > 1:
+        start_what = (message.text.split(None, 1)[1]).lower()
+        if start_what == "mkdwn_help":
+            return await message.reply(MARKDOWN, parse_mode="html")
+    return await message.reply(
         home_text_pm,
         reply_markup=home_keyboard_pm,
     )

+ 4 - 1
wbb/modules/filters.py

@@ -40,7 +40,10 @@ __HELP__ = """/filters To Get All The Filters In The Chat.
 /stop [FILTER_NAME] To Stop A Filter.
 
 
-You can use markdown or html to save text too."""
+You can use markdown or html to save text too.
+
+Checkout /markdownhelp to know more about formattings and other syntax.
+"""
 
 
 @app.on_message(filters.command("filter") & ~filters.edited & ~filters.private)

+ 2 - 0
wbb/modules/greetings.py

@@ -73,6 +73,8 @@ button2=[Github, https://github.com]
 for /rules, you can do /filter rules to a message
 containing rules of your groups whenever a user
 sends /rules, he'll get the message
+
+Checkout /markdownhelp to know more about formattings and other syntax.
 """
 
 

+ 3 - 0
wbb/modules/misc.py

@@ -82,6 +82,9 @@ __HELP__ = """
 /pdf [Reply to an image (as document) or a group of images.]
     Convert images to PDF, helpful for online classes.
 
+/markdownhelp
+    Sends mark down and formatting help.
+
 #RTFM - Tell noobs to read the manual
 """
 

+ 4 - 1
wbb/modules/notes.py

@@ -37,7 +37,10 @@ __MODULE__ = "Notes"
 __HELP__ = """/notes To Get All The Notes In The Chat.
 /save [NOTE_NAME] To Save A Note (Can be a sticker or text).
 #NOTE_NAME To Get A Note.
-/delete [NOTE_NAME] To Delete A Note."""
+/delete [NOTE_NAME] To Delete A Note.
+
+Checkout /markdownhelp to know more about formattings and other syntax.
+"""
 
 
 @app.on_message(filters.command("save") & ~filters.edited & ~filters.private)

+ 55 - 0
wbb/utils/constants.py

@@ -0,0 +1,55 @@
+# New file
+
+from wbb import app, BOT_USERNAME
+
+from pyrogram.filters import command, edited
+from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
+
+
+MARKDOWN = """
+Read the below text carefully to find out how formatting works!
+
+<u>Supported Fillings:</u>
+
+<code>{name}</code> - This will mention the user with their name.
+<code>{chat}</code> - This will fill with the current chat name.
+
+* will be more soon!
+
+<u>Supported formatting:</u>
+
+<code>**Bold**</code> : Creates <b>bold</b> text.
+<code>--strike--</code>: Creates <strike>striked</strike> text.
+<code>__italic__</code>: Creates <i>italic</i> text.
+<code>--underline--</code>: Creates <u>underline</u> text.
+<code>`code words`</code>: Creates <code>code words</code> text.
+<code>[hyperlink](google.com)</code>: Creates <a href='https://www.google.com'>hyperlink</a> text.
+<b>Note:</b> You can use both markdown & html tags for formatting and can use\
+ telegram's native formatter to format a text and can do a lot of experimental stuffs!
+<u>Button formatting:</u>
+
+-> text ~ [button text, button link]
+
+<b>Example:</b>
+
+<b>example</b> <i>button with markdown</i> <code>formatting</code> ~ [button text, https://google.com]
+"""
+
+
+@app.on_message(command("markdownhelp") & ~edited)
+async def mkdwnhelp(_, m: Message):
+    keyb = InlineKeyboardMarkup(
+            [
+                [
+                    InlineKeyboardButton(
+                        text="Click Here!",
+                        url=f"http://t.me/{BOT_USERNAME}?start=mkdwn_help",
+                    )
+                ]
+            ]
+        )
+    if m.chat.type != "private":
+        await m.reply("Click on the below button to get markdown usage syntax in pm!", reply_markup=keyb)
+    else:
+        await m.reply(MARKDOWN, parse_mode="html")
+    return