Spaces:
Paused
Paused
Captain Ezio
commited on
Commit
·
69e35c8
1
Parent(s):
3743160
Trying....
Browse files- Powers/plugins/formatting.py +36 -25
- Powers/plugins/utils.py +2 -7
Powers/plugins/formatting.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
from pyrogram import enums, filters
|
|
|
|
| 2 |
from pyrogram.types import CallbackQuery, Message
|
| 3 |
|
| 4 |
from Powers import LOGGER
|
|
@@ -35,35 +36,45 @@ async def markdownhelp(_, m: Message):
|
|
| 35 |
|
| 36 |
|
| 37 |
@Gojo.on_callback_query(filters.regex("^formatting."))
|
| 38 |
-
async def get_formatting_info(
|
| 39 |
cmd = q.data.split(".")[1]
|
| 40 |
kb = ikb([[("Back", "back.formatting")]])
|
| 41 |
|
| 42 |
if cmd == "md_formatting":
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
elif cmd == "fillings":
|
| 68 |
await q.message.edit_text(
|
| 69 |
text="""<b>Fillings</b>
|
|
|
|
| 1 |
from pyrogram import enums, filters
|
| 2 |
+
from pyrogram.errors import MediaCaptionTooLong
|
| 3 |
from pyrogram.types import CallbackQuery, Message
|
| 4 |
|
| 5 |
from Powers import LOGGER
|
|
|
|
| 36 |
|
| 37 |
|
| 38 |
@Gojo.on_callback_query(filters.regex("^formatting."))
|
| 39 |
+
async def get_formatting_info(c: Gojo, q: CallbackQuery):
|
| 40 |
cmd = q.data.split(".")[1]
|
| 41 |
kb = ikb([[("Back", "back.formatting")]])
|
| 42 |
|
| 43 |
if cmd == "md_formatting":
|
| 44 |
+
|
| 45 |
+
txt = """<b>Markdown Formatting</b>
|
| 46 |
+
You can format your message using <b>bold</b>, <i>italic</i>, <u>underline</u>, <strike>strike</strike> and much more. Go ahead and experiment!
|
| 47 |
+
|
| 48 |
+
**Note**: It supports telegram user based formatting as well as html and markdown formattings.
|
| 49 |
+
<b>Supported markdown</b>:
|
| 50 |
+
- <code>`code words`</code>: Backticks are used for monospace fonts. Shows as: <code>code words</code>.
|
| 51 |
+
- <code>__italic__</code>: Underscores are used for italic fonts. Shows as: <i>italic words</i>.
|
| 52 |
+
- <code>**bold**</code>: Asterisks are used for bold fonts. Shows as: <b>bold words</b>.
|
| 53 |
+
- <code>```pre```</code>: To make the formatter ignore other formatting characters inside the text formatted with '```', like: <code>**bold** | *bold*</code>.
|
| 54 |
+
- <code>--underline--</code>: To make text <u>underline</u>.
|
| 55 |
+
- <code>~~strike~~</code>: Tildes are used for strikethrough. Shows as: <strike>strike</strike>.
|
| 56 |
+
- <code>||spoiler||</code>: Double vertical bars are used for spoilers. Shows as: <spoiler>Spoiler</spoiler>.
|
| 57 |
+
- <code>[hyperlink](example.com)</code>: This is the formatting used for hyperlinks. Shows as: <a href="https://example.com/">hyperlink</a>.
|
| 58 |
+
- <code>[My Button](buttonurl://example.com)</code>: This is the formatting used for creating buttons. This example will create a button named "My button" which opens <code>example.com</code> when clicked.
|
| 59 |
+
If you would like to send buttons on the same row, use the <code>:same</code> formatting.
|
| 60 |
+
<b>Example:</b>
|
| 61 |
+
<code>[button 1](buttonurl:example.com)</code>
|
| 62 |
+
<code>[button 2](buttonurl://example.com:same)</code>
|
| 63 |
+
<code>[button 3](buttonurl://example.com)</code>
|
| 64 |
+
This will show button 1 and 2 on the same line, while 3 will be underneath."""
|
| 65 |
+
try:
|
| 66 |
+
await q.message.edit_text(
|
| 67 |
+
text=txt,
|
| 68 |
+
reply_markup=kb,
|
| 69 |
+
parse_mode=enums.ParseMode.HTML,
|
| 70 |
+
)
|
| 71 |
+
except MediaCaptionTooLong:
|
| 72 |
+
await q.message.delete()
|
| 73 |
+
await c.send_message(
|
| 74 |
+
chat_id=q.message.chat.id,
|
| 75 |
+
text=txt,
|
| 76 |
+
reply_markup=kb,
|
| 77 |
+
parse_mode=enums.ParseMode.HTML,)
|
| 78 |
elif cmd == "fillings":
|
| 79 |
await q.message.edit_text(
|
| 80 |
text="""<b>Fillings</b>
|
Powers/plugins/utils.py
CHANGED
|
@@ -303,16 +303,11 @@ async def paste_func(_, message: Message):
|
|
| 303 |
await message.reply_photo(
|
| 304 |
photo=link,
|
| 305 |
quote=False,
|
| 306 |
-
caption="
|
| 307 |
-
reply_markup=InlineKeyboardMarkup(kb),
|
| 308 |
)
|
| 309 |
await m.delete()
|
| 310 |
except Exception:
|
| 311 |
-
await m.
|
| 312 |
-
await message.reply_text(
|
| 313 |
-
"Here is the link of the document....",
|
| 314 |
-
reply_markup=InlineKeyboardMarkup(kb),
|
| 315 |
-
)
|
| 316 |
|
| 317 |
|
| 318 |
@Gojo.on_message(command("tr"))
|
|
|
|
| 303 |
await message.reply_photo(
|
| 304 |
photo=link,
|
| 305 |
quote=False,
|
| 306 |
+
caption=f"**Paste Link:** [Here]({link})"
|
|
|
|
| 307 |
)
|
| 308 |
await m.delete()
|
| 309 |
except Exception:
|
| 310 |
+
await m.edit("Here's your paste", reply_markup=kb)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 311 |
|
| 312 |
|
| 313 |
@Gojo.on_message(command("tr"))
|