Spaces:
Paused
Paused
Captain Ezio
commited on
Commit
·
bb430b4
1
Parent(s):
a4049f0
Now fine
Browse files- Powers/plugins/utils.py +8 -6
Powers/plugins/utils.py
CHANGED
|
@@ -6,7 +6,7 @@ from os import remove
|
|
| 6 |
import aiofiles
|
| 7 |
from gpytranslate import Translator
|
| 8 |
from pyrogram import enums, filters
|
| 9 |
-
from pyrogram.errors import MessageTooLong
|
| 10 |
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
| 11 |
from wikipedia import summary
|
| 12 |
from wikipedia.exceptions import DisambiguationError, PageError
|
|
@@ -17,6 +17,8 @@ from Powers.database.users_db import Users
|
|
| 17 |
from Powers.utils.clean_file import remove_markdown_and_html
|
| 18 |
from Powers.utils.custom_filters import command
|
| 19 |
from Powers.utils.http_helper import *
|
|
|
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
@Gojo.on_message(command("wiki"))
|
|
@@ -115,6 +117,7 @@ async def get_lyrics(_, m: Message):
|
|
| 115 |
return
|
| 116 |
'''
|
| 117 |
|
|
|
|
| 118 |
@Gojo.on_message(
|
| 119 |
command("id") & (filters.group | filters.private),
|
| 120 |
)
|
|
@@ -262,15 +265,14 @@ async def paste(content: str):
|
|
| 262 |
async def paste_func(_, message: Message):
|
| 263 |
r = message.reply_to_message
|
| 264 |
m = await message.reply_text("Pasting...")
|
| 265 |
-
|
| 266 |
if not r:
|
| 267 |
content = message.text.split(None, 1)[1]
|
| 268 |
-
|
| 269 |
if r:
|
| 270 |
if not r.text and not r.document:
|
| 271 |
return await m.edit("Only text and documents are supported")
|
| 272 |
|
| 273 |
-
|
| 274 |
if r.text:
|
| 275 |
content = str(r.text)
|
| 276 |
if r.document:
|
|
@@ -286,7 +288,7 @@ async def paste_func(_, message: Message):
|
|
| 286 |
content = await f.read()
|
| 287 |
|
| 288 |
remove(doc)
|
| 289 |
-
|
| 290 |
link = await paste(content)
|
| 291 |
kb = [[InlineKeyboardButton(text="Paste Link ", url=link)]]
|
| 292 |
await m.delete()
|
|
@@ -296,7 +298,7 @@ async def paste_func(_, message: Message):
|
|
| 296 |
if link:
|
| 297 |
return await message.reply_text(f"Here's your paste:\n [link]({link})",)
|
| 298 |
return await message.reply_text(f"Failed to post. Due to following error:\n{e}")
|
| 299 |
-
|
| 300 |
|
| 301 |
@Gojo.on_message(command("tr"))
|
| 302 |
async def tr(_, message):
|
|
|
|
| 6 |
import aiofiles
|
| 7 |
from gpytranslate import Translator
|
| 8 |
from pyrogram import enums, filters
|
| 9 |
+
from pyrogram.errors import MessageTooLong, PeerIdInvalid
|
| 10 |
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
| 11 |
from wikipedia import summary
|
| 12 |
from wikipedia.exceptions import DisambiguationError, PageError
|
|
|
|
| 17 |
from Powers.utils.clean_file import remove_markdown_and_html
|
| 18 |
from Powers.utils.custom_filters import command
|
| 19 |
from Powers.utils.http_helper import *
|
| 20 |
+
from Powers.utils.extract_user import extract_user
|
| 21 |
+
from Powers.utils.parser import mention_html
|
| 22 |
|
| 23 |
|
| 24 |
@Gojo.on_message(command("wiki"))
|
|
|
|
| 117 |
return
|
| 118 |
'''
|
| 119 |
|
| 120 |
+
|
| 121 |
@Gojo.on_message(
|
| 122 |
command("id") & (filters.group | filters.private),
|
| 123 |
)
|
|
|
|
| 265 |
async def paste_func(_, message: Message):
|
| 266 |
r = message.reply_to_message
|
| 267 |
m = await message.reply_text("Pasting...")
|
| 268 |
+
|
| 269 |
if not r:
|
| 270 |
content = message.text.split(None, 1)[1]
|
| 271 |
+
|
| 272 |
if r:
|
| 273 |
if not r.text and not r.document:
|
| 274 |
return await m.edit("Only text and documents are supported")
|
| 275 |
|
|
|
|
| 276 |
if r.text:
|
| 277 |
content = str(r.text)
|
| 278 |
if r.document:
|
|
|
|
| 288 |
content = await f.read()
|
| 289 |
|
| 290 |
remove(doc)
|
| 291 |
+
|
| 292 |
link = await paste(content)
|
| 293 |
kb = [[InlineKeyboardButton(text="Paste Link ", url=link)]]
|
| 294 |
await m.delete()
|
|
|
|
| 298 |
if link:
|
| 299 |
return await message.reply_text(f"Here's your paste:\n [link]({link})",)
|
| 300 |
return await message.reply_text(f"Failed to post. Due to following error:\n{e}")
|
| 301 |
+
|
| 302 |
|
| 303 |
@Gojo.on_message(command("tr"))
|
| 304 |
async def tr(_, message):
|