Skip to content

Commit

Permalink
Fix OCR CMD
Browse files Browse the repository at this point in the history
Signed-off-by: Yasir Aris M <git@yasirdev.my.id>
  • Loading branch information
yasirarism committed Sep 7, 2024
1 parent 9aca2a8 commit a5542d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions misskaty/plugins/ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ async def ocr(_, ctx: Message, strings):
file_path = await reply.download(
f"ocr_{ctx.from_user.id if ctx.from_user else ctx.sender_chat.id}.jpg"
)
response = await Telegraph().upload_file(file_path)
url = f"https://img.yasirweb.eu.org{response[0]['src']}"
data = {"type": "file", "action": "upload"}
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 = f"https://ibb.co.com/{response.json()['image']['id_encoded']}"
req = (
await fetch.get(
f"https://script.google.com/macros/s/AKfycbwURISN0wjazeJTMHTPAtxkrZTWTpsWIef5kxqVGoXqnrzdLdIQIfLO7jsR5OQ5GO16/exec?url={url}",
Expand Down
2 changes: 1 addition & 1 deletion misskaty/plugins/paste.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async def telegraph_paste(_, message):
data = ""
limit = 1024 * 1024
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.document.file_size > limit:
return await msg.edit_msg(
Expand Down

0 comments on commit a5542d0

Please sign in to comment.