Ultroid v0.3 Updates
Co-authored-by: Aditya <xditya@ultroid.tech> Co-authored-by: Danish <danish@ultroid.tech> Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com> Co-authored-by: TechiError <error@notavailable.live> Co-authored-by: Avish Kumar <85635883+aviskumar@users.noreply.github.com> Co-authored-by: Vɪɴᴀʏᴀᴋ Pᴀɴᴅᴇʏ <87496159+harpia-vieillot@users.noreply.github.com> Co-authored-by: Shrimadhav U K <6317196+spechide@users.noreply.github.com> Co-authored-by: Dark <darkbeamer.official@gmail.com> Co-authored-by: Muhamad Risman Aziz <62795826+mrismanaziz@users.noreply.github.com> Co-authored-by: Ashik Muhammed <84127769+MR-JINN-OF-TG@users.noreply.github.com> Co-authored-by: MMETMA <79155572+MMETMA@users.noreply.github.com> Co-authored-by: amirmehdinzri <94852182+amirmehdinzri@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Ultroid - UserBot
|
||||
# Copyright (C) 2021 TeamUltroid
|
||||
# Copyright (C) 2021-2022 TeamUltroid
|
||||
#
|
||||
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
||||
# PLease read the GNU Affero General Public License in
|
||||
@@ -7,12 +7,11 @@
|
||||
"""
|
||||
✘ Commands Available -
|
||||
|
||||
`{i}write <text or reply to text>`
|
||||
• `{i}write <text or reply to text>`
|
||||
It will write on a paper.
|
||||
|
||||
• `{i}image <text or reply to html or any doc file>`
|
||||
Write a image from html or any text.
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
@@ -20,7 +19,20 @@ import os
|
||||
from htmlwebshot import WebShot
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
from . import eod, eor, get_string, text_set, ultroid_cmd
|
||||
from . import async_searcher, eod, get_string, text_set, ultroid_cmd
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="gethtml ?(.*)")
|
||||
async def ghtml(e):
|
||||
txt = e.pattern_match.group(1)
|
||||
if txt:
|
||||
link = e.text.split(maxsplit=1)[1]
|
||||
else:
|
||||
return await eod(e, "`Either reply to any file or give any text`")
|
||||
k = await async_searcher(link)
|
||||
with open("file.html", "w+") as f:
|
||||
f.write(k)
|
||||
await e.reply(file="file.html")
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="image ?(.*)")
|
||||
@@ -40,10 +52,7 @@ async def f2i(e):
|
||||
shot = WebShot(quality=85)
|
||||
css = "body {background: white;} p {color: red;}"
|
||||
pic = await shot.create_pic_async(html=html, css=css)
|
||||
try:
|
||||
await e.reply(file=pic)
|
||||
except BaseException:
|
||||
await e.reply(file=pic, force_document=True)
|
||||
await e.reply(file=pic, force_document=True)
|
||||
os.remove(pic)
|
||||
if os.path.exists(html):
|
||||
os.remove(html)
|
||||
@@ -58,7 +67,7 @@ async def writer(e):
|
||||
text = e.text.split(maxsplit=1)[1]
|
||||
else:
|
||||
return await eod(e, get_string("writer_1"))
|
||||
k = await eor(e, get_string("com_1"))
|
||||
k = await e.eor(get_string("com_1"))
|
||||
img = Image.open("resources/extras/template.jpg")
|
||||
draw = ImageDraw.Draw(img)
|
||||
font = ImageFont.truetype("resources/fonts/assfont.ttf", 30)
|
||||
|
||||
Reference in New Issue
Block a user