Ultroid v0.4 updates

Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com>
Co-authored-by: Danish <danish@ultroid.tech>
Co-authored-by: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com>
Co-authored-by: Aditya <xditya@ultroid.tech>
Co-authored-by: CyrusXD <79554993+Ashutosh1478@users.noreply.github.com>
This commit is contained in:
Devesh Pal
2022-02-09 11:53:45 +05:30
committed by GitHub
parent b9f9c543a4
commit 8ad7073d80
111 changed files with 2550 additions and 2113 deletions

View File

@@ -33,6 +33,10 @@ try:
from PIL import Image
except ImportError:
Image = None
try:
import cv2
except ImportError:
cv2 = None
from pyUltroid.functions.google_image import googleimagesdownload
from pyUltroid.functions.misc import google_search
from pyUltroid.functions.tools import saavn_search
@@ -45,7 +49,7 @@ from . import async_searcher, eod, fast_download, get_string, ultroid_cmd
pattern="github (.*)",
)
async def gitsearch(event):
usrname = event.pattern_match.group(1)
usrname = event.pattern_match.group(1).strip()
if not usrname:
return await event.eor(get_string("srch_1"))
url = f"https://api.github.com/users/{usrname}"
@@ -83,11 +87,11 @@ async def gitsearch(event):
@ultroid_cmd(
pattern="google ?(.*)",
pattern="google( (.*)|$)",
manager=True,
)
async def google(event):
inp = event.pattern_match.group(1)
inp = event.pattern_match.group(1).strip()
if not inp:
return await eod(event, get_string("autopic_1"))
x = await event.eor(get_string("com_2"))
@@ -104,9 +108,9 @@ async def google(event):
await x.eor(omk, link_preview=False)
@ultroid_cmd(pattern="img ?(.*)")
@ultroid_cmd(pattern="img( (.*)|$)")
async def goimg(event):
query = event.pattern_match.group(1)
query = event.pattern_match.group(1).strip()
if not query:
return await event.eor(get_string("autopic_1"))
nn = await event.eor(get_string("com_1"))
@@ -141,6 +145,12 @@ async def reverse(event):
return await event.eor("`Reply to an Image`")
ult = await event.eor(get_string("com_1"))
dl = await reply.download_media()
if reply.video:
img = cv2.VideoCapture(dl)
ult, roid = img.read()
os.remove(dl)
dl = "file.png"
cv2.imwrite(dl, roid)
img = Image.open(dl)
x, y = img.size
file = {"encoded_image": (dl, open(dl, "rb"))}
@@ -182,10 +192,10 @@ async def reverse(event):
@ultroid_cmd(
pattern="saavn ?(.*)",
pattern="saavn( (.*)|$)",
)
async def siesace(e):
song = e.pattern_match.group(1)
song = e.pattern_match.group(1).strip()
if not song:
return await e.eor("`Give me Something to Search", time=5)
eve = await e.eor(f"`Searching for {song} on Saavn...`")