randydev commited on
Commit
a281fbe
1 Parent(s): 5a04c21

Fix SuccessResponse "False"

Browse files
Files changed (1) hide show
  1. main.py +16 -20
main.py CHANGED
@@ -216,14 +216,13 @@ def get_profile_clone(user_id):
216
  else:
217
  return None
218
 
219
- @app.post("/ryuzaki/profile-clone", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
220
  def profile_clone(
221
  item: ProfileClone,
222
  api_key: None = Depends(validate_api_key)
223
  ):
224
  if item.user_id == 1191668125:
225
- return {"status": "false", "message": "Only Developer"}
226
-
227
  try:
228
  new_profile_clone(
229
  user_id=item.user_id,
@@ -242,10 +241,10 @@ def profile_clone(
242
  "bio": item.bio
243
  }
244
  )
245
- except Exception as e:
246
- return ErrorStatus(status="false", message=f"Internal server error: {str(e)}")
247
 
248
- @app.get("/ryuzaki/get-profile-clone", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
249
  def get_profile_(
250
  item: GetProfileClone,
251
  api_key: None = Depends(validate_api_key)
@@ -276,8 +275,8 @@ def get_profile_(
276
  status="False",
277
  randydev={"message": "Not found user"}
278
  )
279
- except Exception as e:
280
- return ErrorStatus(status="false", message=f"Internal server error: {str(e)}")
281
 
282
  @app.get("/ryuzaki/getbanlist")
283
  def sibyl_get_all_banlist():
@@ -298,7 +297,7 @@ def blacklist_words():
298
  except Exception as e:
299
  return {"status": "false", "message": f"Internal server error: {str(e)}"}
300
 
301
- @app.delete("/ryuzaki/sibyldel", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
302
  def sibyl_system_delete(
303
  item: SibylSystemDel,
304
  api_key: None = Depends(validate_api_key_only_devs)
@@ -318,9 +317,9 @@ def sibyl_system_delete(
318
  randydev={"message": "Not Found UserID"}
319
  )
320
  except Exception as e:
321
- return ErrorStatus(status="false", message=f"Internal server error: {str(e)}")
322
 
323
- @app.post("/ryuzaki/sibylban", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
324
  def sibyl_system_ban(
325
  item: SibylSystemBan,
326
  api_key: None = Depends(validate_api_key)
@@ -334,10 +333,7 @@ def sibyl_system_ban(
334
  _, _, is_banned, _, sibyl_user_id = get_sibyl_system_banned(item.user_id)
335
 
336
  if sibyl_user_id is not None and is_banned:
337
- return SuccessResponse(
338
- status="False",
339
- randydev={"message": "User is already banned"}
340
- )
341
 
342
  new_sibyl_system_banned(item.user_id, sibyl_ban, item.reason, date_joined)
343
  return SuccessResponse(
@@ -350,10 +346,10 @@ def sibyl_system_ban(
350
  "message": f"Successfully banned {item.user_id} from the Sibyl ban list."
351
  }
352
  )
353
- except Exception as e:
354
- return ErrorStatus(status="false", message=f"Internal server error: {str(e)}")
355
 
356
- @app.get("/ryuzaki/sibyl", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
357
  def sibyl_system(
358
  item: SibylSystem,
359
  api_key: None = Depends(validate_api_key)
@@ -373,7 +369,7 @@ def sibyl_system(
373
  )
374
  else:
375
  return SuccessResponse(
376
- status="false",
377
  randydev={
378
  "message": "Not found user"
379
  }
@@ -1344,7 +1340,7 @@ def custom_openapi():
1344
  return app.openapi_schema
1345
  openapi_schema = get_openapi(
1346
  title="RyuzakiLib API",
1347
- version="2.2.5",
1348
  summary="Use It Only For Personal Project Else I Need To Delete The Api",
1349
  description=description,
1350
  routes=app.routes,
 
216
  else:
217
  return None
218
 
219
+ @app.post("/ryuzaki/profile-clone", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
220
  def profile_clone(
221
  item: ProfileClone,
222
  api_key: None = Depends(validate_api_key)
223
  ):
224
  if item.user_id == 1191668125:
225
+ return SuccessResponse(status="False", randydev={"message": "Only Developer."})
 
226
  try:
227
  new_profile_clone(
228
  user_id=item.user_id,
 
241
  "bio": item.bio
242
  }
243
  )
244
+ except Exception:
245
+ return SuccessResponse(status="False", randydev={"message": "Internal server error."})
246
 
247
+ @app.get("/ryuzaki/get-profile-clone", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
248
  def get_profile_(
249
  item: GetProfileClone,
250
  api_key: None = Depends(validate_api_key)
 
275
  status="False",
276
  randydev={"message": "Not found user"}
277
  )
278
+ except Exception:
279
+ return SuccessResponse(status="False", randydev={"message": "Internal server error."})
280
 
281
  @app.get("/ryuzaki/getbanlist")
282
  def sibyl_get_all_banlist():
 
297
  except Exception as e:
298
  return {"status": "false", "message": f"Internal server error: {str(e)}"}
299
 
300
+ @app.delete("/ryuzaki/sibyldel", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
301
  def sibyl_system_delete(
302
  item: SibylSystemDel,
303
  api_key: None = Depends(validate_api_key_only_devs)
 
317
  randydev={"message": "Not Found UserID"}
318
  )
319
  except Exception as e:
320
+ return SuccessResponse(status="False", randydev={"message": "Internal server error."})
321
 
322
+ @app.post("/ryuzaki/sibylban", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
323
  def sibyl_system_ban(
324
  item: SibylSystemBan,
325
  api_key: None = Depends(validate_api_key)
 
333
  _, _, is_banned, _, sibyl_user_id = get_sibyl_system_banned(item.user_id)
334
 
335
  if sibyl_user_id is not None and is_banned:
336
+ return SuccessResponse(status="False", randydev={"message": "User is already banned."})
 
 
 
337
 
338
  new_sibyl_system_banned(item.user_id, sibyl_ban, item.reason, date_joined)
339
  return SuccessResponse(
 
346
  "message": f"Successfully banned {item.user_id} from the Sibyl ban list."
347
  }
348
  )
349
+ except Exception:
350
+ return SuccessResponse(status="False", randydev={"message": "Internal server error."})
351
 
352
+ @app.get("/ryuzaki/sibyl", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
353
  def sibyl_system(
354
  item: SibylSystem,
355
  api_key: None = Depends(validate_api_key)
 
369
  )
370
  else:
371
  return SuccessResponse(
372
+ status="False",
373
  randydev={
374
  "message": "Not found user"
375
  }
 
1340
  return app.openapi_schema
1341
  openapi_schema = get_openapi(
1342
  title="RyuzakiLib API",
1343
+ version="2.2.7",
1344
  summary="Use It Only For Personal Project Else I Need To Delete The Api",
1345
  description=description,
1346
  routes=app.routes,