Spaces:
Paused
Paused
Captain Ezio
commited on
Commit
·
5ca983b
1
Parent(s):
c31d06c
...
Browse files- Powers/plugins/utils.py +4 -4
Powers/plugins/utils.py
CHANGED
|
@@ -294,8 +294,8 @@ headers = {
|
|
| 294 |
"content-type": "application/json",
|
| 295 |
}
|
| 296 |
|
| 297 |
-
def paste(content
|
| 298 |
-
resp = resp_post(f"{BASE}api/v1/pastes", data=content, headers=headers)
|
| 299 |
if resp.ok:
|
| 300 |
return
|
| 301 |
resp = resp.json()
|
|
@@ -315,7 +315,7 @@ async def paste_func(_, message: Message):
|
|
| 315 |
return await m.edit("Only text and documents are supported")
|
| 316 |
|
| 317 |
if r.text:
|
| 318 |
-
content =
|
| 319 |
exe = "txt"
|
| 320 |
if r.document:
|
| 321 |
if r.document.file_size > 40000:
|
|
@@ -328,7 +328,7 @@ async def paste_func(_, message: Message):
|
|
| 328 |
exe = doc.rsplit(".",1)[-1]
|
| 329 |
async with aiofiles.open(doc, mode="r") as f:
|
| 330 |
fdata = await f.read()
|
| 331 |
-
content =
|
| 332 |
|
| 333 |
remove(doc)
|
| 334 |
link = paste(content)
|
|
|
|
| 294 |
"content-type": "application/json",
|
| 295 |
}
|
| 296 |
|
| 297 |
+
def paste(content):
|
| 298 |
+
resp = resp_post(f"{BASE}api/v1/pastes", data=json.dumps(content), headers=headers)
|
| 299 |
if resp.ok:
|
| 300 |
return
|
| 301 |
resp = resp.json()
|
|
|
|
| 315 |
return await m.edit("Only text and documents are supported")
|
| 316 |
|
| 317 |
if r.text:
|
| 318 |
+
content = r.text
|
| 319 |
exe = "txt"
|
| 320 |
if r.document:
|
| 321 |
if r.document.file_size > 40000:
|
|
|
|
| 328 |
exe = doc.rsplit(".",1)[-1]
|
| 329 |
async with aiofiles.open(doc, mode="r") as f:
|
| 330 |
fdata = await f.read()
|
| 331 |
+
content = fdata
|
| 332 |
|
| 333 |
remove(doc)
|
| 334 |
link = paste(content)
|