Update paste.py

This commit is contained in:
Yasir Aris M 2024-09-06 22:11:49 +07:00 committed by GitHub
parent 6403e6d406
commit acfe74be3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -431,10 +431,12 @@ async def imgbb_upload(_, message):
uname = message.sender_chat.title
try:
path = await reply.download()
data = {"type": "file", "action": "upload"}
files = {"source": (path, open(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"}
res = await fetch.post("https://imgbb.com/json", files=files, data=data, headers=headers)
remove(path)
url = res.json()["image"]["url"]
button = [
[InlineKeyboardButton("Open Link", url=url)],