Fix OCR CMD

Signed-off-by: Yasir Aris M <git@yasirdev.my.id>
This commit is contained in:
Yasir Aris M 2024-09-07 11:28:07 +07:00
parent 9aca2a8c7b
commit 8908da603c
2 changed files with 6 additions and 3 deletions

View file

@ -41,8 +41,11 @@ async def ocr(_, ctx: Message, strings):
file_path = await reply.download( file_path = await reply.download(
f"ocr_{ctx.from_user.id if ctx.from_user else ctx.sender_chat.id}.jpg" f"ocr_{ctx.from_user.id if ctx.from_user else ctx.sender_chat.id}.jpg"
) )
response = await Telegraph().upload_file(file_path) data = {"type": "file", "action": "upload"}
url = f"https://img.yasirweb.eu.org{response[0]['src']}" files = {"source": (file_path, open(file_path, "rb"), "images/jpeg")}
headers = {"origin": "https://imgbb.com", "referer": "https://imgbb.com/upload", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.42"}
response = await fetch.post("https://imgbb.com/json", files=files, data=data, headers=headers)
url = response.json()['image']['url']
req = ( req = (
await fetch.get( await fetch.get(
f"https://script.google.com/macros/s/AKfycbwURISN0wjazeJTMHTPAtxkrZTWTpsWIef5kxqVGoXqnrzdLdIQIfLO7jsR5OQ5GO16/exec?url={url}", f"https://script.google.com/macros/s/AKfycbwURISN0wjazeJTMHTPAtxkrZTWTpsWIef5kxqVGoXqnrzdLdIQIfLO7jsR5OQ5GO16/exec?url={url}",

View file

@ -85,7 +85,7 @@ async def telegraph_paste(_, message):
data = "" data = ""
limit = 1024 * 1024 limit = 1024 * 1024
if reply and not (reply.text or reply.document): if reply and not (reply.text or reply.document):
return await msg.edit_msg("**Reply to a text message or file to paste to Telegraph.**") return await msg.edit_msg("**Telegraph upload has been disabled by Durov, use ImgBB command instead.**")
if reply and reply.document: if reply and reply.document:
if reply.document.file_size > limit: if reply.document.file_size > limit:
return await msg.edit_msg( return await msg.edit_msg(