diff --git a/misskaty/plugins/ocr.py b/misskaty/plugins/ocr.py index 06d8b23d0e..49431a5e02 100644 --- a/misskaty/plugins/ocr.py +++ b/misskaty/plugins/ocr.py @@ -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}", diff --git a/misskaty/plugins/paste.py b/misskaty/plugins/paste.py index 4e0f973537..492c040e3f 100644 --- a/misskaty/plugins/paste.py +++ b/misskaty/plugins/paste.py @@ -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(