Captain Ezio commited on
Commit
c34c0f1
·
1 Parent(s): b8c220c

Update utils.py

Browse files
Files changed (1) hide show
  1. Powers/plugins/utils.py +7 -2
Powers/plugins/utils.py CHANGED
@@ -252,8 +252,10 @@ BASE = "https://nekobin.com/"
252
 
253
  async def paste(content: str):
254
  resp = await post(f"{BASE}api/documents", data=content)
255
- if not resp["ok"]:
256
- return
 
 
257
  return BASE + resp["result"]["key"]
258
 
259
 
@@ -287,6 +289,9 @@ async def paste_func(_, message: Message):
287
  remove(doc)
288
 
289
  link = await paste(content)
 
 
 
290
  kb = [[InlineKeyboardButton(text="Paste Link ", url=link)]]
291
  await m.delete()
292
  try:
 
252
 
253
  async def paste(content: str):
254
  resp = await post(f"{BASE}api/documents", data=content)
255
+ try:
256
+ KEY = resp["result"]["key"]
257
+ except Exception as e:
258
+ return e
259
  return BASE + resp["result"]["key"]
260
 
261
 
 
289
  remove(doc)
290
 
291
  link = await paste(content)
292
+ if len(link.split()) != 1:
293
+ await m.delete()
294
+ return await message.reply_text(f"Failed to post. Due to following error:\n{e}")
295
  kb = [[InlineKeyboardButton(text="Paste Link ", url=link)]]
296
  await m.delete()
297
  try: