Ultroid 0.0.5 - 06/04/21
Co-authored-by: AndrewLaneX <AndrewLaneX@users.noreply.github.com> Co-authored-by: Aditya <me@xditya.me> Co-authored-by: Danish <danish@ultroid.tech> Co-authored-by: buddhhu <buddhuu0@users.noreply.github.com> Co-authored-by: sppidy <sppidy@users.noreply.github.com> Co-authored-by: Arnab Paryali <Arnabxd@users.noreply.github.com> Co-authored-by: divkix <divkix@users.noreply.github.com> Co-authored-by: hellboi_atul <hellboi-atul@users.noreply.github.com> Co-authored-by: Programming Error <error@notavailable.live> Co-authored-by: New-dev0 <New-dev0@notavailable.live>
This commit is contained in:
committed by
ProgrammingError
parent
97146a9402
commit
4e8b0543ce
@@ -8,15 +8,18 @@
|
||||
"""
|
||||
✘ Commands Available -
|
||||
|
||||
• `{i}grey <reply to any media>`
|
||||
To make it black nd white.
|
||||
|
||||
• `{i}color <reply to any Black nd White media>`
|
||||
To make it Colorfull.
|
||||
|
||||
• `{i}toon <reply to any media>`
|
||||
To make it toon.
|
||||
|
||||
• `{i}danger <reply to any media>`
|
||||
To make it look Danger.
|
||||
|
||||
• `{i}grey <reply to any media>`
|
||||
To make it black nd white.
|
||||
|
||||
• `{i}negative <reply to any media>`
|
||||
To make negative image.
|
||||
|
||||
@@ -66,7 +69,9 @@ async def sketch(e):
|
||||
cmd = ["lottie_convert.py", ultt, "ult.png"]
|
||||
file = "ult.png"
|
||||
process = await asyncio.create_subprocess_exec(
|
||||
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
||||
*cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE,
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
stderr.decode().strip()
|
||||
@@ -90,6 +95,36 @@ async def sketch(e):
|
||||
os.remove("ultroid.png")
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="color$")
|
||||
async def _(event):
|
||||
reply = await event.get_reply_message()
|
||||
if not reply.media:
|
||||
return await eor(event, "`Reply To a Black nd White Image`")
|
||||
xx = await eor(event, "`Coloring image 🎨🖌️...`")
|
||||
image = await ultroid_bot.download_media(reply.media)
|
||||
img = cv2.VideoCapture(image)
|
||||
ret, frame = img.read()
|
||||
cv2.imwrite("ult.jpg", frame)
|
||||
if udB.get("DEEP_API"):
|
||||
key = Redis("DEEP_API")
|
||||
else:
|
||||
key = "quickstart-QUdJIGlzIGNvbWluZy4uLi4K"
|
||||
r = requests.post(
|
||||
"https://api.deepai.org/api/colorizer",
|
||||
files={"image": open("ult.jpg", "rb")},
|
||||
headers={"api-key": key},
|
||||
)
|
||||
os.remove("ult.jpg")
|
||||
os.remove(image)
|
||||
if "status" in r.json():
|
||||
return await event.edit(
|
||||
r.json()["status"] + "\nGet api nd set `{i}setredis DEEP_API key`"
|
||||
)
|
||||
r_json = r.json()["output_url"]
|
||||
await ultroid_bot.send_file(event.chat_id, r_json, reply_to=reply)
|
||||
await xx.delete()
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="grey$",
|
||||
)
|
||||
@@ -104,7 +139,9 @@ async def ultd(event):
|
||||
cmd = ["lottie_convert.py", ultt, "ult.png"]
|
||||
file = "ult.png"
|
||||
process = await asyncio.create_subprocess_exec(
|
||||
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
||||
*cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE,
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
stderr.decode().strip()
|
||||
@@ -119,7 +156,10 @@ async def ultd(event):
|
||||
ultroid = cv2.cvtColor(ult, cv2.COLOR_BGR2GRAY)
|
||||
cv2.imwrite("ult.jpg", ultroid)
|
||||
await event.client.send_file(
|
||||
event.chat_id, "ult.jpg", force_document=False, reply_to=event.reply_to_msg_id
|
||||
event.chat_id,
|
||||
"ult.jpg",
|
||||
force_document=False,
|
||||
reply_to=event.reply_to_msg_id,
|
||||
)
|
||||
await xx.delete()
|
||||
os.remove("ult.png")
|
||||
@@ -141,7 +181,9 @@ async def ultd(event):
|
||||
cmd = ["lottie_convert.py", ultt, "ult.png"]
|
||||
file = "ult.png"
|
||||
process = await asyncio.create_subprocess_exec(
|
||||
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
||||
*cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE,
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
stderr.decode().strip()
|
||||
@@ -156,7 +198,10 @@ async def ultd(event):
|
||||
ultroid = cv2.GaussianBlur(ult, (35, 35), 0)
|
||||
cv2.imwrite("ult.jpg", ultroid)
|
||||
await event.client.send_file(
|
||||
event.chat_id, "ult.jpg", force_document=False, reply_to=event.reply_to_msg_id
|
||||
event.chat_id,
|
||||
"ult.jpg",
|
||||
force_document=False,
|
||||
reply_to=event.reply_to_msg_id,
|
||||
)
|
||||
await xx.delete()
|
||||
os.remove("ult.png")
|
||||
@@ -179,7 +224,9 @@ async def ultd(event):
|
||||
cmd = ["lottie_convert.py", ultt, "ult.png"]
|
||||
file = "ult.png"
|
||||
process = await asyncio.create_subprocess_exec(
|
||||
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
||||
*cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE,
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
stderr.decode().strip()
|
||||
@@ -194,7 +241,10 @@ async def ultd(event):
|
||||
ultroid = cv2.bitwise_not(ult)
|
||||
cv2.imwrite("ult.jpg", ultroid)
|
||||
await event.client.send_file(
|
||||
event.chat_id, "ult.jpg", force_document=False, reply_to=event.reply_to_msg_id
|
||||
event.chat_id,
|
||||
"ult.jpg",
|
||||
force_document=False,
|
||||
reply_to=event.reply_to_msg_id,
|
||||
)
|
||||
await xx.delete()
|
||||
os.remove("ult.png")
|
||||
@@ -217,7 +267,9 @@ async def ultd(event):
|
||||
cmd = ["lottie_convert.py", ultt, "ult.png"]
|
||||
file = "ult.png"
|
||||
process = await asyncio.create_subprocess_exec(
|
||||
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
||||
*cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE,
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
stderr.decode().strip()
|
||||
@@ -233,7 +285,10 @@ async def ultd(event):
|
||||
ultroid = cv2.hconcat([ult, ish])
|
||||
cv2.imwrite("ult.jpg", ultroid)
|
||||
await event.client.send_file(
|
||||
event.chat_id, "ult.jpg", force_document=False, reply_to=event.reply_to_msg_id
|
||||
event.chat_id,
|
||||
"ult.jpg",
|
||||
force_document=False,
|
||||
reply_to=event.reply_to_msg_id,
|
||||
)
|
||||
await xx.delete()
|
||||
os.remove("ult.png")
|
||||
@@ -256,7 +311,9 @@ async def ultd(event):
|
||||
cmd = ["lottie_convert.py", ultt, "ult.png"]
|
||||
file = "ult.png"
|
||||
process = await asyncio.create_subprocess_exec(
|
||||
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
||||
*cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE,
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
stderr.decode().strip()
|
||||
@@ -273,7 +330,10 @@ async def ultd(event):
|
||||
ultroid = cv2.vconcat([ult, ish])
|
||||
cv2.imwrite("ult.jpg", ultroid)
|
||||
await event.client.send_file(
|
||||
event.chat_id, "ult.jpg", force_document=False, reply_to=event.reply_to_msg_id
|
||||
event.chat_id,
|
||||
"ult.jpg",
|
||||
force_document=False,
|
||||
reply_to=event.reply_to_msg_id,
|
||||
)
|
||||
await xx.delete()
|
||||
os.remove("ult.png")
|
||||
@@ -296,7 +356,9 @@ async def ultd(event):
|
||||
cmd = ["lottie_convert.py", ultt, "ult.png"]
|
||||
file = "ult.png"
|
||||
process = await asyncio.create_subprocess_exec(
|
||||
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
||||
*cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE,
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
stderr.decode().strip()
|
||||
@@ -315,7 +377,10 @@ async def ultd(event):
|
||||
ultroid = cv2.vconcat([mici, trn])
|
||||
cv2.imwrite("ult.jpg", ultroid)
|
||||
await event.client.send_file(
|
||||
event.chat_id, "ult.jpg", force_document=False, reply_to=event.reply_to_msg_id
|
||||
event.chat_id,
|
||||
"ult.jpg",
|
||||
force_document=False,
|
||||
reply_to=event.reply_to_msg_id,
|
||||
)
|
||||
await xx.delete()
|
||||
os.remove("ult.png")
|
||||
@@ -338,7 +403,9 @@ async def ultd(event):
|
||||
cmd = ["lottie_convert.py", ultt, "ult.png"]
|
||||
file = "ult.png"
|
||||
process = await asyncio.create_subprocess_exec(
|
||||
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
||||
*cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE,
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
stderr.decode().strip()
|
||||
@@ -367,10 +434,13 @@ async def ultd(event):
|
||||
)
|
||||
centers = np.uint8(centers)
|
||||
ish = centers[labels.flatten()]
|
||||
ultroid = ish.reshape((ult.shape))
|
||||
ultroid = ish.reshape(ult.shape)
|
||||
cv2.imwrite("ult.jpg", ultroid)
|
||||
await event.client.send_file(
|
||||
event.chat_id, "ult.jpg", force_document=False, reply_to=event.reply_to_msg_id
|
||||
event.chat_id,
|
||||
"ult.jpg",
|
||||
force_document=False,
|
||||
reply_to=event.reply_to_msg_id,
|
||||
)
|
||||
await xx.delete()
|
||||
os.remove("ult.png")
|
||||
@@ -393,7 +463,9 @@ async def ultd(event):
|
||||
cmd = ["lottie_convert.py", ultt, "ult.png"]
|
||||
file = "ult.png"
|
||||
process = await asyncio.create_subprocess_exec(
|
||||
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
||||
*cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE,
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
stderr.decode().strip()
|
||||
@@ -409,7 +481,10 @@ async def ultd(event):
|
||||
ultroid = cv2.cvtColor(dan, cv2.COLOR_HSV2BGR)
|
||||
cv2.imwrite("ult.jpg", ultroid)
|
||||
await event.client.send_file(
|
||||
event.chat_id, "ult.jpg", force_document=False, reply_to=event.reply_to_msg_id
|
||||
event.chat_id,
|
||||
"ult.jpg",
|
||||
force_document=False,
|
||||
reply_to=event.reply_to_msg_id,
|
||||
)
|
||||
await xx.delete()
|
||||
os.remove("ult.png")
|
||||
@@ -432,7 +507,9 @@ async def ultd(event):
|
||||
cmd = ["lottie_convert.py", ultt, "ult.png"]
|
||||
file = "ult.png"
|
||||
process = await asyncio.create_subprocess_exec(
|
||||
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
||||
*cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE,
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
stderr.decode().strip()
|
||||
@@ -446,7 +523,7 @@ async def ultd(event):
|
||||
got = upf(file)
|
||||
lnk = f"https://telegra.ph{got[0]}"
|
||||
r = requests.get(
|
||||
f"https://nekobot.xyz/api/imagegen?type=blurpify&image={lnk}"
|
||||
f"https://nekobot.xyz/api/imagegen?type=blurpify&image={lnk}",
|
||||
).json()
|
||||
ms = r.get("message")
|
||||
utd = url(ms)
|
||||
@@ -457,7 +534,10 @@ async def ultd(event):
|
||||
img = Image.open("ult.png").convert("RGB")
|
||||
img.save("ult.webp", "webp")
|
||||
await event.client.send_file(
|
||||
event.chat_id, "ult.webp", force_document=False, reply_to=event.reply_to_msg_id
|
||||
event.chat_id,
|
||||
"ult.webp",
|
||||
force_document=False,
|
||||
reply_to=event.reply_to_msg_id,
|
||||
)
|
||||
await xx.delete()
|
||||
os.remove("ult.png")
|
||||
|
||||
Reference in New Issue
Block a user