Spaces:
Paused
Paused
Captain Ezio
commited on
Commit
·
8367e56
1
Parent(s):
53eaca2
...
Browse files- Powers/plugins/utils.py +5 -6
Powers/plugins/utils.py
CHANGED
|
@@ -294,11 +294,11 @@ headers = {
|
|
| 294 |
"content-type": "application/json",
|
| 295 |
}
|
| 296 |
|
| 297 |
-
def paste(content):
|
| 298 |
-
|
|
|
|
| 299 |
if resp.ok:
|
| 300 |
return
|
| 301 |
-
print(resp)
|
| 302 |
resp = resp.json()
|
| 303 |
return BASE + resp["result"]['key']
|
| 304 |
|
|
@@ -332,12 +332,11 @@ async def paste_func(_, message: Message):
|
|
| 332 |
content = fdata
|
| 333 |
|
| 334 |
remove(doc)
|
| 335 |
-
|
| 336 |
link = paste(content)
|
| 337 |
except Exception as e:
|
| 338 |
await m.edit_text(e)
|
| 339 |
-
return
|
| 340 |
-
link = paste(content)
|
| 341 |
if not link:
|
| 342 |
await m.edit_text("Failed to post!")
|
| 343 |
return
|
|
|
|
| 294 |
"content-type": "application/json",
|
| 295 |
}
|
| 296 |
|
| 297 |
+
def paste(content: str):
|
| 298 |
+
data = {"content": content}
|
| 299 |
+
resp = resp_post(f"{BASE}api/v1/pastes", data=json.dumps(data), headers=headers)
|
| 300 |
if resp.ok:
|
| 301 |
return
|
|
|
|
| 302 |
resp = resp.json()
|
| 303 |
return BASE + resp["result"]['key']
|
| 304 |
|
|
|
|
| 332 |
content = fdata
|
| 333 |
|
| 334 |
remove(doc)
|
| 335 |
+
try:
|
| 336 |
link = paste(content)
|
| 337 |
except Exception as e:
|
| 338 |
await m.edit_text(e)
|
| 339 |
+
return
|
|
|
|
| 340 |
if not link:
|
| 341 |
await m.edit_text("Failed to post!")
|
| 342 |
return
|