Spaces:
Running
Running
Commit
•
094aba4
1
Parent(s):
6b5e22e
sorts
Browse files- functions.py +3 -1
- main.py +393 -433
- models.py +58 -20
- templates/config.py +7 -7
- templates/main.py +11 -49
functions.py
CHANGED
@@ -17,14 +17,16 @@
|
|
17 |
# You should have received a copy of the GNU Affero General Public License
|
18 |
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
19 |
|
20 |
-
import requests
|
21 |
import os
|
|
|
|
|
22 |
from dotenv import load_dotenv
|
23 |
|
24 |
load_dotenv()
|
25 |
HUGGING_TOKEN = os.environ["HUGGING_TOKEN"]
|
26 |
SOURCE_ALPHA_URL = os.environ["SOURCE_ALPHA_URL"]
|
27 |
|
|
|
28 |
def ryuzaki_ai_text(text):
|
29 |
API_URL = SOURCE_ALPHA_URL
|
30 |
headers = {"Authorization": f"Bearer {HUGGING_TOKEN}"}
|
|
|
17 |
# You should have received a copy of the GNU Affero General Public License
|
18 |
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
19 |
|
|
|
20 |
import os
|
21 |
+
|
22 |
+
import requests
|
23 |
from dotenv import load_dotenv
|
24 |
|
25 |
load_dotenv()
|
26 |
HUGGING_TOKEN = os.environ["HUGGING_TOKEN"]
|
27 |
SOURCE_ALPHA_URL = os.environ["SOURCE_ALPHA_URL"]
|
28 |
|
29 |
+
|
30 |
def ryuzaki_ai_text(text):
|
31 |
API_URL = SOURCE_ALPHA_URL
|
32 |
headers = {"Authorization": f"Bearer {HUGGING_TOKEN}"}
|
main.py
CHANGED
@@ -17,61 +17,33 @@
|
|
17 |
# You should have received a copy of the GNU Affero General Public License
|
18 |
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
19 |
|
20 |
-
import uvicorn
|
21 |
-
import tempfile
|
22 |
-
import shutil
|
23 |
-
import requests
|
24 |
-
import re
|
25 |
-
import random
|
26 |
-
import os
|
27 |
-
import openai
|
28 |
-
import logging
|
29 |
-
import json
|
30 |
-
import io
|
31 |
-
import g4f
|
32 |
-
import functions as code
|
33 |
import base64
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
from
|
40 |
-
|
41 |
-
from telegraph import Telegraph, upload_file
|
42 |
-
from serpapi import GoogleSearch
|
43 |
-
from random import choice
|
44 |
-
from pymongo import MongoClient
|
45 |
-
from pydantic import BaseModel
|
46 |
-
from pathlib import Path
|
47 |
-
from models import *
|
48 |
-
from io import BytesIO
|
49 |
-
from httpx import AsyncClient
|
50 |
-
from gpytranslate import SyncTranslator
|
51 |
-
|
52 |
-
from fastapi.templating import Jinja2Templates
|
53 |
-
from fastapi.staticfiles import StaticFiles
|
54 |
-
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
|
55 |
-
from fastapi.responses import StreamingResponse, JSONResponse, FileResponse
|
56 |
-
from fastapi.openapi.utils import get_openapi
|
57 |
-
from fastapi import Request, Header, Depends, HTTPException, status
|
58 |
-
from fastapi import FastAPI, UploadFile, File, Response
|
59 |
-
from fastapi import Body, Query
|
60 |
-
|
61 |
-
from dotenv import load_dotenv
|
62 |
from datetime import datetime as dt
|
|
|
|
|
|
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
from base64 import b64decode
|
67 |
from bardapi import Bard
|
68 |
-
|
69 |
-
from
|
70 |
-
from
|
71 |
-
from
|
72 |
-
from
|
73 |
-
from
|
|
|
74 |
from RyuzakiLib.hackertools.chatgpt import RendyDevChat
|
|
|
|
|
|
|
75 |
|
76 |
from models import *
|
77 |
|
@@ -103,7 +75,7 @@ HUGGING_TOKEN = os.environ["HUGGING_TOKEN"]
|
|
103 |
ASSISTANT_GOOGLE_API_KEYS = os.environ["ASSISTANT_GOOGLE_API_KEYS"]
|
104 |
COOKIE_BARD_TOKEN = os.environ["COOKIE_BARD_TOKEN"]
|
105 |
|
106 |
-
#unlocks
|
107 |
ORACLE_TOKEN = os.environ["ORACLE_TOKEN"]
|
108 |
TruAI = os.environ["TruAI"]
|
109 |
|
@@ -125,7 +97,7 @@ app = FastAPI(
|
|
125 |
"name": "🌀ʊʄ⊕ք🌀",
|
126 |
"url": "https://t.me/UFoPInfo",
|
127 |
},
|
128 |
-
docs_url="/"
|
129 |
)
|
130 |
|
131 |
timeout = 100
|
@@ -145,6 +117,7 @@ Please modify your search terms and/or try again later thank you for your unders
|
|
145 |
~ 🌀ʊʄ⊕ք🌀 Team
|
146 |
"""
|
147 |
|
|
|
148 |
def get_all_api_keys():
|
149 |
user = collection.find({})
|
150 |
api_keys = []
|
@@ -154,15 +127,18 @@ def get_all_api_keys():
|
|
154 |
api_keys.append(api_key)
|
155 |
return api_keys
|
156 |
|
|
|
157 |
def validate_api_key(api_key: str = Header(...)):
|
158 |
USERS_API_KEYS = get_all_api_keys()
|
159 |
if api_key not in USERS_API_KEYS:
|
160 |
raise HTTPException(status_code=401, detail="Invalid API key")
|
161 |
|
|
|
162 |
def validate_api_key_only_devs(api_key: str = Header(...)):
|
163 |
if api_key not in ONLY_DEVELOPER_API_KEYS:
|
164 |
raise HTTPException(status_code=401, detail="Invalid API key")
|
165 |
|
|
|
166 |
RAMDOM_STATUS = [
|
167 |
"Spammer",
|
168 |
"wanted",
|
@@ -170,18 +146,22 @@ RAMDOM_STATUS = [
|
|
170 |
"rogue_agent",
|
171 |
"pornbot prolly",
|
172 |
"fugitive",
|
173 |
-
"simp"
|
174 |
]
|
175 |
|
|
|
176 |
def remove_sibyl_system_banned(user_id):
|
177 |
update_doc = {
|
178 |
"sibyl_ban": None,
|
179 |
"reason_sibyl": None,
|
180 |
"is_banned_sibly": None,
|
181 |
"date_joined_sib": None,
|
182 |
-
"sibyl_userid": None
|
183 |
}
|
184 |
-
return collection.update_one(
|
|
|
|
|
|
|
185 |
|
186 |
def new_sibyl_system_banned(user_id, name, reason, date_joined):
|
187 |
update_doc = {
|
@@ -189,13 +169,19 @@ def new_sibyl_system_banned(user_id, name, reason, date_joined):
|
|
189 |
"reason_sibyl": reason,
|
190 |
"is_banned_sibly": True,
|
191 |
"date_joined_sib": date_joined,
|
192 |
-
"sibyl_userid": user_id
|
193 |
}
|
194 |
-
return collection.update_one(
|
|
|
|
|
|
|
195 |
|
196 |
def cybersecuritydb(user_id, mongo_url):
|
197 |
update_doc = {"mongodb": mongo_url}
|
198 |
-
return collection.update_one(
|
|
|
|
|
|
|
199 |
|
200 |
def get_sibyl_system_banned(user_id):
|
201 |
user = collection.find_one({"user_id": user_id})
|
@@ -209,6 +195,7 @@ def get_sibyl_system_banned(user_id):
|
|
209 |
else:
|
210 |
return None, None, False, None, None
|
211 |
|
|
|
212 |
def get_all_banned():
|
213 |
banned_users = []
|
214 |
|
@@ -220,11 +207,14 @@ def get_all_banned():
|
|
220 |
banned_users.append({"user_id": user_id, "reason": reason})
|
221 |
return banned_users
|
222 |
|
|
|
223 |
@app.get("/UFoP/blacklist-words")
|
224 |
def blacklist_words():
|
225 |
try:
|
226 |
BLACKLIST_WORDS = BadWordsList()
|
227 |
-
results_all = BLACKLIST_WORDS.banned_by_google(
|
|
|
|
|
228 |
return {"status": "true", "results": results_all}
|
229 |
except Exception as e:
|
230 |
return {"status": "false", "message": f"Internal server error: {str(e)}"}
|
@@ -233,17 +223,16 @@ def blacklist_words():
|
|
233 |
@app.get("/UFoP/getbanlist")
|
234 |
def sibyl_get_all_banlist():
|
235 |
banned_users = get_all_banned()
|
236 |
-
return {
|
237 |
-
|
238 |
-
"sukuna": {
|
239 |
-
"results": banned_users
|
240 |
-
}
|
241 |
-
}
|
242 |
|
243 |
-
@app.delete(
|
|
|
|
|
|
|
|
|
244 |
def sibyl_system_delete(
|
245 |
-
item: SibylSystemDel,
|
246 |
-
api_key: None = Depends(validate_api_key_only_devs)
|
247 |
):
|
248 |
try:
|
249 |
_, _, _, _, sibyl_user_id = get_sibyl_system_banned(item.user_id)
|
@@ -252,20 +241,25 @@ def sibyl_system_delete(
|
|
252 |
remove_sibyl_system_banned(item.user_id)
|
253 |
return SuccessResponse(
|
254 |
status="True",
|
255 |
-
randydev={
|
|
|
|
|
256 |
)
|
257 |
else:
|
258 |
return SuccessResponse(
|
259 |
-
status="False",
|
260 |
-
randydev={"message": "Not Found UserID"}
|
261 |
)
|
262 |
except Exception as e:
|
263 |
return ErrorStatus(status="false", message=f"Internal server error: {str(e)}")
|
264 |
|
265 |
-
|
|
|
|
|
|
|
|
|
|
|
266 |
def sibyl_system_ban(
|
267 |
-
item: SibylSystemBan,
|
268 |
-
api_key: None = Depends(validate_api_key_only_devs)
|
269 |
):
|
270 |
if item.user_id == DEVELOPER_ID:
|
271 |
return {"status": "false", "message": "Only Developer"}
|
@@ -277,8 +271,7 @@ def sibyl_system_ban(
|
|
277 |
|
278 |
if sibyl_user_id is not None and is_banned:
|
279 |
return SuccessResponse(
|
280 |
-
status="False",
|
281 |
-
randydev={"message": "User is already banned"}
|
282 |
)
|
283 |
|
284 |
new_sibyl_system_banned(item.user_id, sibyl_ban, item.reason, date_joined)
|
@@ -289,16 +282,17 @@ def sibyl_system_ban(
|
|
289 |
"sibyl_name": sibyl_ban,
|
290 |
"reason": item.reason,
|
291 |
"date_joined": date_joined,
|
292 |
-
"message": f"Successfully banned {item.user_id} from the Sibyl ban list."
|
293 |
-
}
|
294 |
)
|
295 |
except Exception as e:
|
296 |
return ErrorStatus(status="false", message=f"Internal server error: {str(e)}")
|
297 |
|
|
|
298 |
@app.get("/UFoP/bans")
|
299 |
def sibyl_system(
|
300 |
user_id: int = Query(..., description="User ID in query parameter"),
|
301 |
-
api_key: None = Depends(validate_api_key)
|
302 |
):
|
303 |
result = get_sibyl_system_banned(user_id)
|
304 |
if result is not None:
|
@@ -310,14 +304,19 @@ def sibyl_system(
|
|
310 |
"reason": reason,
|
311 |
"is_banned": is_banned,
|
312 |
"date_joined": date_joined,
|
313 |
-
"sibyl_user_id": sibyl_user_id
|
314 |
-
}
|
315 |
}
|
316 |
else:
|
317 |
return {"status": "false", "message": "Not Found User"}
|
318 |
|
319 |
-
|
320 |
-
|
|
|
|
|
|
|
|
|
|
|
321 |
if item.is_multi_chat:
|
322 |
selected_api_key = ASSISTANT_GOOGLE_API_KEYS or item.gemini_api_key
|
323 |
oracle_base = ORACLE_TOKEN or item.oracle_base
|
@@ -327,20 +326,21 @@ async def gemini_oracle(item: GeminiOracle):
|
|
327 |
mongo_url=item.mongo_url,
|
328 |
version=item.version,
|
329 |
user_id=item.user_id,
|
330 |
-
oracle_base=oracle_base
|
331 |
)
|
332 |
cybersecuritydb(item.user_id, item.mongo_url)
|
333 |
if item.oracle_base == "Delete":
|
334 |
clearedhistory = await geni._clear_oracle_history_in_db()
|
335 |
-
return SuccessResponse(
|
|
|
|
|
|
|
336 |
else:
|
337 |
-
answer, oracle_chat = await geni._GeminiLatest__get_response_oracle(
|
|
|
|
|
338 |
return SuccessResponse(
|
339 |
-
status="True",
|
340 |
-
randydev={
|
341 |
-
"message": answer,
|
342 |
-
"chat_history": oracle_chat
|
343 |
-
}
|
344 |
)
|
345 |
except Exception as excep:
|
346 |
return SuccessResponse(status="False", randydev={"message": internal_error})
|
@@ -357,46 +357,44 @@ async def gemini_oracle(item: GeminiOracle):
|
|
357 |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",
|
358 |
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
|
359 |
"Origin": "https://bard.google.com",
|
360 |
-
"Referer": "https://bard.google.com/"
|
361 |
}
|
362 |
session.cookies.set("__Secure-1PSID", token)
|
363 |
bard = Bard(token=token, session=session, timeout=30)
|
364 |
bard.get_answer(owner_base)["content"]
|
365 |
message = bard.get_answer(item.query)["content"]
|
366 |
return SuccessResponse(status="True", randydev={"message": message})
|
367 |
-
except:
|
368 |
-
return SuccessResponse(
|
|
|
|
|
369 |
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
api_url = f"{SOURCE_ASSISTANT_GOOGLE_AI}/models/text-bison-001:generateText?key={ASSISTANT_GOOGLE_API_KEYS}"
|
378 |
try:
|
379 |
headers = {"Content-Type": "application/json"}
|
380 |
-
data = {
|
381 |
-
"prompt": {
|
382 |
-
"text": item.query
|
383 |
-
}
|
384 |
-
}
|
385 |
response = requests.post(api_url, headers=headers, json=data)
|
386 |
response_str = response.json()
|
387 |
answer = response_str["candidates"]
|
388 |
for results in answer:
|
389 |
message = results.get("output")
|
390 |
-
return SuccessResponse(
|
391 |
-
|
392 |
-
randydev={
|
393 |
-
"message": message
|
394 |
-
}
|
395 |
-
)
|
396 |
-
except:
|
397 |
return SuccessResponse(status="False", randydev={"message": internal_error})
|
398 |
|
399 |
-
|
|
|
|
|
|
|
|
|
|
|
400 |
def gemini_pro(item: GeminiPro):
|
401 |
owner_base = TruAI
|
402 |
if item.is_multi_chat:
|
@@ -406,19 +404,17 @@ def gemini_pro(item: GeminiPro):
|
|
406 |
api_key=selected_api_key,
|
407 |
mongo_url=item.mongo_url,
|
408 |
version=item.version,
|
409 |
-
user_id=item.user_id
|
410 |
)
|
411 |
cybersecuritydb(item.user_id, item.mongo_url)
|
412 |
answer, gemini_chat = geni._GeminiLatest__get_response_gemini(item.query)
|
413 |
return SuccessResponse(
|
414 |
-
status="True",
|
415 |
-
randydev={
|
416 |
-
"message": answer,
|
417 |
-
"chat_history": gemini_chat
|
418 |
-
}
|
419 |
)
|
420 |
except Exception:
|
421 |
-
return SuccessResponse(
|
|
|
|
|
422 |
else:
|
423 |
if item.is_login:
|
424 |
token = item.bard_api_key
|
@@ -432,21 +428,21 @@ def gemini_pro(item: GeminiPro):
|
|
432 |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",
|
433 |
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
|
434 |
"Origin": "https://bard.google.com",
|
435 |
-
"Referer": "https://bard.google.com/"
|
436 |
}
|
437 |
session.cookies.set("__Secure-1PSID", token)
|
438 |
bard = Bard(token=token, session=session, timeout=30)
|
439 |
bard.get_answer(owner_base)["content"]
|
440 |
message = bard.get_answer(item.query)["content"]
|
441 |
return SuccessResponse(status="True", randydev={"message": message})
|
442 |
-
except:
|
443 |
-
return SuccessResponse(
|
|
|
|
|
|
|
444 |
|
445 |
@app.post("/UFoP/dalle3xl")
|
446 |
-
def dalle_3xl(
|
447 |
-
item: Dalle3XL,
|
448 |
-
api_key: None = Depends(validate_api_key)
|
449 |
-
):
|
450 |
API_URL = SOURCE_DALLE3XL_URL
|
451 |
try:
|
452 |
payload = {"inputs": item.query}
|
@@ -454,21 +450,17 @@ def dalle_3xl(
|
|
454 |
"Authorization": f"Bearer {HUGGING_TOKEN}",
|
455 |
"Content-Type": "application/json",
|
456 |
}
|
457 |
-
response = requests.post(
|
|
|
|
|
458 |
response.raise_for_status()
|
459 |
except requests.exceptions.RequestException:
|
460 |
-
raise HTTPException(
|
461 |
-
status_code=500,
|
462 |
-
detail=internal_error
|
463 |
-
)
|
464 |
|
465 |
try:
|
466 |
encoded_string = base64.b64encode(response.content).decode("utf-8")
|
467 |
except Exception:
|
468 |
-
raise HTTPException(
|
469 |
-
status_code=500,
|
470 |
-
detail=contact_support
|
471 |
-
)
|
472 |
|
473 |
if encoded_string:
|
474 |
return SuccessResponse(status="True", randydev={"data": encoded_string})
|
@@ -477,7 +469,7 @@ def dalle_3xl(
|
|
477 |
|
478 |
|
479 |
@app.get("/ryuzaki/unsplash")
|
480 |
-
async def get_image_unsplash(query: str, size: str="500x500"):
|
481 |
url = SOURCE_UNSPLASH_URL
|
482 |
image_url = f"{url}/?{query}/{size}"
|
483 |
|
@@ -489,20 +481,21 @@ async def get_image_unsplash(query: str, size: str="500x500"):
|
|
489 |
|
490 |
return StreamingResponse(BytesIO(response.content), media_type="image/jpeg")
|
491 |
|
|
|
492 |
@app.get("/ryuzaki/reverse")
|
493 |
def google_reverse(
|
494 |
-
engine: str="google_reverse_image",
|
495 |
-
image_url: str=None,
|
496 |
-
language: str="en",
|
497 |
-
google_lang: str="us",
|
498 |
-
api_key: None = Depends(validate_api_key)
|
499 |
):
|
500 |
params = {
|
501 |
"api_key": REVERSE_IMAGE_API,
|
502 |
"engine": engine,
|
503 |
"image_url": image_url,
|
504 |
"hl": language,
|
505 |
-
"gl": google_lang
|
506 |
}
|
507 |
try:
|
508 |
search = GoogleSearch(params)
|
@@ -517,24 +510,25 @@ def google_reverse(
|
|
517 |
"link": link,
|
518 |
"total_time_taken": total_time_taken,
|
519 |
"create_at": create_at,
|
520 |
-
"processed_at": processed_at
|
521 |
-
}
|
522 |
}
|
523 |
except Exception as e:
|
524 |
return {"status": "false", "message": f"Error {e}"}
|
525 |
|
|
|
526 |
@app.get("/ryuzaki/ocr")
|
527 |
def ocr_space_url(
|
528 |
url: str = Query(..., description="URL in query parameter"),
|
529 |
-
overlay: bool=False,
|
530 |
language: str = Query("eng", description="Language in query parameter"),
|
531 |
-
api_key: None = Depends(validate_api_key)
|
532 |
):
|
533 |
payload = {
|
534 |
"url": url,
|
535 |
"isOverlayRequired": overlay,
|
536 |
"apikey": OCR_API_KEY,
|
537 |
-
"language": language
|
538 |
}
|
539 |
try:
|
540 |
response = requests.post(SOURCE_OCR_URL, data=payload)
|
@@ -544,61 +538,50 @@ def ocr_space_url(
|
|
544 |
return f"Error: {str(e)}"
|
545 |
try:
|
546 |
parsed_response = json.loads(test_url)
|
547 |
-
if
|
|
|
|
|
|
|
548 |
return {
|
549 |
"status": "true",
|
550 |
-
"sukuna":{
|
551 |
-
"text": parsed_response["ParsedResults"][0]["ParsedText"]
|
552 |
-
}
|
553 |
}
|
554 |
else:
|
555 |
return {"status": "false", "message": "Error response."}
|
556 |
except (json.JSONDecodeError, KeyError):
|
557 |
return "Error parsing the OCR response."
|
558 |
|
|
|
559 |
@app.get("/ryuzaki/chatgpt4")
|
560 |
-
def chatgpt4_support(
|
561 |
-
query: str=None,
|
562 |
-
api_key: None = Depends(validate_api_key)
|
563 |
-
):
|
564 |
try:
|
565 |
response = g4f.ChatCompletion.create(
|
566 |
model=g4f.models.gpt_4,
|
567 |
messages=[{"role": "user", "content": query}],
|
568 |
)
|
569 |
-
return {
|
570 |
-
|
571 |
-
"sukuna":{
|
572 |
-
"message": response
|
573 |
-
}
|
574 |
-
}
|
575 |
-
except:
|
576 |
return {"status": "false", "message": "Error response."}
|
577 |
|
|
|
578 |
@app.post("/ryuzaki/chatgpt-model")
|
579 |
-
def chatgpt_model(
|
580 |
-
query: str=None,
|
581 |
-
model_id: int=1,
|
582 |
-
is_models: bool=True
|
583 |
-
):
|
584 |
try:
|
585 |
-
response = RendyDevChat(query).get_response_model(
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
}
|
591 |
-
}
|
592 |
-
except:
|
593 |
return {"status": "false", "message": "Error response."}
|
594 |
|
|
|
595 |
async def get_data(username):
|
596 |
base_msg = ""
|
597 |
async with AsyncClient() as gpx:
|
598 |
req = (await gpx.get(f"https://api.github.com/users/{username}")).json()
|
599 |
try:
|
600 |
avatar = req["avatar_url"]
|
601 |
-
twitter = req[
|
602 |
base_msg += "**❆ Gitub Information ❆** \n\n"
|
603 |
base_msg += f"**Profile Url:** {req['html_url']} \n"
|
604 |
base_msg += f"**Name:** `{req['name']}` \n"
|
@@ -620,52 +603,49 @@ async def get_data(username):
|
|
620 |
base_msg += f"**An error occured while parsing the data!** \n\n**Traceback:** \n `{e}` \n\n`Make sure that you've sent the command with the correct username!`"
|
621 |
return [base_msg, "https://telegra.ph//file/32f69c18190666ea96553.jpg"]
|
622 |
|
|
|
623 |
@app.get("/ryuzaki/github")
|
624 |
-
async def github(username: str=None):
|
625 |
try:
|
626 |
details = await get_data(username)
|
627 |
return {
|
628 |
"status": "true",
|
629 |
-
"sukuna":{
|
630 |
-
"avatar": details[1],
|
631 |
-
"results": details[0]
|
632 |
-
}
|
633 |
}
|
634 |
-
except:
|
635 |
return {"status": "false", "message": "Error response."}
|
636 |
|
|
|
637 |
@app.get("/ryuzaki/webshot")
|
638 |
def webshot(
|
639 |
-
url: str=None,
|
640 |
-
quality: str="1920x1080",
|
641 |
-
type_mine: str="JPEG",
|
642 |
-
pixels: str="1024",
|
643 |
-
cast: str="Z100"
|
644 |
):
|
645 |
try:
|
646 |
-
required_url =
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
}
|
652 |
-
}
|
653 |
-
except:
|
654 |
return {"status": "false", "message": "Error response."}
|
655 |
|
|
|
656 |
@app.get("/ryuzaki/chatbot")
|
657 |
def chatbot(
|
658 |
-
query: str=None,
|
659 |
-
user_id: int=None,
|
660 |
-
bot_name: str=None,
|
661 |
-
bot_username: str=None
|
662 |
):
|
663 |
api_url = b64decode("aHR0cHM6Ly9hcGkuc2Fmb25lLmRldi9jaGF0Ym90").decode("utf-8")
|
664 |
params = {
|
665 |
"query": query,
|
666 |
"user_id": user_id,
|
667 |
"bot_name": bot_name,
|
668 |
-
"bot_master": bot_username
|
669 |
}
|
670 |
x = requests.get(f"{api_url}", params=params)
|
671 |
if x.status_code != 200:
|
@@ -673,27 +653,22 @@ def chatbot(
|
|
673 |
try:
|
674 |
y = x.json()
|
675 |
response = y["response"]
|
676 |
-
return {
|
677 |
-
|
678 |
-
"sukuna":{
|
679 |
-
"message": response
|
680 |
-
}
|
681 |
-
}
|
682 |
-
except:
|
683 |
return {"status": "false", "message": "Error response."}
|
684 |
|
|
|
685 |
@app.get("/ryuzaki/waifu")
|
686 |
-
def waifu_pics(
|
687 |
-
types: str="sfw",
|
688 |
-
category: str="neko"
|
689 |
-
):
|
690 |
waifu_api = f"{SOURCE_WAIFU_URL}/{types}"
|
691 |
waifu_param = f"{waifu_api}/{category}"
|
692 |
|
693 |
response = requests.get(waifu_param)
|
694 |
|
695 |
if response.status_code != 200:
|
696 |
-
return
|
|
|
|
|
697 |
data_waifu = response.json()
|
698 |
try:
|
699 |
waifu_image_url = data_waifu["url"]
|
@@ -701,25 +676,21 @@ def waifu_pics(
|
|
701 |
return f"Error request {e}"
|
702 |
if waifu_image_url:
|
703 |
try:
|
704 |
-
return {
|
705 |
-
|
706 |
-
"sukuna":{
|
707 |
-
"image_url": waifu_image_url
|
708 |
-
}
|
709 |
-
}
|
710 |
-
except:
|
711 |
return {"status": "false", "message": "Error response"}
|
712 |
else:
|
713 |
return {"status": "false", "message": "Error response."}
|
714 |
|
|
|
715 |
@app.get("/ryuzaki/rayso")
|
716 |
def make_rayso(
|
717 |
code=None,
|
718 |
-
title: str="Ryuzaki Dev",
|
719 |
-
theme: str=None,
|
720 |
-
setlang: str="en",
|
721 |
-
auto_translate: bool=None,
|
722 |
-
ryuzaki_dark: bool=None
|
723 |
):
|
724 |
trans = SyncTranslator()
|
725 |
api_url = b64decode("aHR0cHM6Ly9hcGkuc2Fmb25lLm1lL3JheXNv").decode("utf-8")
|
@@ -732,52 +703,33 @@ def make_rayso(
|
|
732 |
if ryuzaki_dark:
|
733 |
x = requests.post(
|
734 |
f"{api_url}",
|
735 |
-
json={
|
736 |
-
"code": code,
|
737 |
-
"title": title,
|
738 |
-
"theme": theme,
|
739 |
-
"darkMode": True
|
740 |
-
}
|
741 |
)
|
742 |
if x.status_code != 200:
|
743 |
return "Error api Gay"
|
744 |
data = x.json()
|
745 |
try:
|
746 |
image_data = base64.b64decode(data["image"])
|
747 |
-
return {
|
748 |
-
|
749 |
-
"data":{
|
750 |
-
"image": image_data
|
751 |
-
}
|
752 |
-
}
|
753 |
-
except:
|
754 |
return {"status": "false", "message": "Error response"}
|
755 |
else:
|
756 |
x = requests.post(
|
757 |
f"{api_url}",
|
758 |
-
json={
|
759 |
-
"code": code,
|
760 |
-
"title": title,
|
761 |
-
"theme": theme,
|
762 |
-
"darkMode": False
|
763 |
-
}
|
764 |
)
|
765 |
if x.status_code != 200:
|
766 |
return "Error api Gay"
|
767 |
data = x.json()
|
768 |
try:
|
769 |
image_data = base64.b64decode(data["image"])
|
770 |
-
return {
|
771 |
-
|
772 |
-
"data":{
|
773 |
-
"image": image_data
|
774 |
-
}
|
775 |
-
}
|
776 |
-
except:
|
777 |
return {"status": "false", "message": "Error response"}
|
778 |
|
|
|
779 |
@app.get("/ryuzaki/ipcheck")
|
780 |
-
def whois_ip_address(ip_address: str=None):
|
781 |
apikey = kc("M0QwN0UyRUFBRjU1OTQwQUY0NDczNEMzRjJBQzdDMUE=").decode("utf-8")
|
782 |
location_link = "https"
|
783 |
location_api = "api.ip2location.io"
|
@@ -788,7 +740,9 @@ def whois_ip_address(ip_address: str=None):
|
|
788 |
)
|
789 |
response = requests.get(location_param)
|
790 |
if response.status_code != 200:
|
791 |
-
return
|
|
|
|
|
792 |
data_location = response.json()
|
793 |
try:
|
794 |
location_ip = data_location["ip"]
|
@@ -818,19 +772,24 @@ def whois_ip_address(ip_address: str=None):
|
|
818 |
"city_name": location_city,
|
819 |
"zip_code": location_zip,
|
820 |
"time_zone": location_zone,
|
821 |
-
"as": location_card
|
822 |
}
|
823 |
else:
|
824 |
return {"status": "false", "message": "Invalid ip address"}
|
825 |
|
|
|
826 |
@app.get("/ryuzaki/tiktok_douyin")
|
827 |
-
def tiktok_douyin(tiktok_url: str=None):
|
828 |
response = requests.get(f"{SOURCE_TIKTOK_WTF_URL}={tiktok_url}")
|
829 |
if response.status_code != 200:
|
830 |
return "Error request:"
|
831 |
try:
|
832 |
-
download_video = response.json()["aweme_list"][0]["video"]["play_addr"][
|
833 |
-
|
|
|
|
|
|
|
|
|
834 |
description = response.json()["aweme_list"][0]["desc"]
|
835 |
author = response.json()["aweme_list"][0]["author"]["nickname"]
|
836 |
request = response.json()["aweme_list"][0]["author"]["signature"]
|
@@ -841,14 +800,15 @@ def tiktok_douyin(tiktok_url: str=None):
|
|
841 |
"music_url": download_audio,
|
842 |
"description": description,
|
843 |
"author": author,
|
844 |
-
"request": request
|
845 |
-
}
|
846 |
}
|
847 |
-
except:
|
848 |
return {"status": "false", "message": "Error request"}
|
849 |
|
|
|
850 |
@app.get("/ryuzaki/tiktok")
|
851 |
-
def tiktok_downloader(tiktok_url: Union[str, None] = None, only_video: bool=None):
|
852 |
api_devs = SOURCE_TIKTOK_TECH_URL
|
853 |
parameter = f"tiktok?url={tiktok_url}"
|
854 |
api_url = f"{api_devs}/{parameter}"
|
@@ -862,209 +822,208 @@ def tiktok_downloader(tiktok_url: Union[str, None] = None, only_video: bool=None
|
|
862 |
if only_video:
|
863 |
video_url = results.get("result", {}).get("withoutWaterMarkVideo", "")
|
864 |
if video_url:
|
865 |
-
return {
|
866 |
-
"download_url": video_url,
|
867 |
-
"caption": caption
|
868 |
-
}
|
869 |
else:
|
870 |
music_mp3 = results.get("result", {}).get("music", "")
|
871 |
if music_mp3:
|
872 |
-
return {
|
873 |
-
"music_url": music_mp3,
|
874 |
-
"caption": caption
|
875 |
-
}
|
876 |
return "Error: TikTok data not found or unsupported format"
|
877 |
-
except:
|
878 |
return {"status": "false", "message": "Invalid Link"}
|
879 |
|
|
|
880 |
@app.get("/ryuzaki/mediafire")
|
881 |
def mediafire(link: Union[str, None] = None):
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
|
|
|
|
918 |
},
|
919 |
-
"DateAndTime": {
|
920 |
-
"time": time,
|
921 |
-
"date": date
|
922 |
-
}
|
923 |
-
}
|
924 |
}
|
925 |
-
}
|
926 |
-
}
|
927 |
|
928 |
-
|
929 |
-
|
930 |
|
931 |
|
932 |
@app.get("/ryuzaki/gdrive")
|
933 |
def gdrive(link: Union[str, None] = None):
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
972 |
},
|
973 |
-
"DateAndTime":
|
974 |
-
last_modified if last_modified else
|
975 |
-
'No last modified date provided by the server.',
|
976 |
-
}
|
977 |
}
|
978 |
-
}
|
979 |
-
}
|
980 |
|
981 |
-
|
982 |
-
|
|
|
983 |
|
984 |
@app.get("/ryuzaki/anonfiles")
|
985 |
def anonfiles(link: Union[str, None] = None):
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
|
1001 |
@app.get("/ryuzaki/filechan")
|
1002 |
def filechan(link: Union[str, None] = None):
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
|
1018 |
@app.get("/ryuzaki/letsupload")
|
1019 |
def letsupload(link: Union[str, None] = None):
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
|
1035 |
@app.get("/ryuzaki/megaupload")
|
1036 |
def megaupload(link: Union[str, None] = None):
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
|
1052 |
@app.get("/ryuzaki/myfile")
|
1053 |
def myfile(link: Union[str, None] = None):
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
|
1069 |
def custom_exception_handler(request: Request, exc: HTTPException) -> JSONResponse:
|
1070 |
error_detail = [{"error": str(exc.detail)}]
|
@@ -1076,5 +1035,6 @@ def custom_exception_handler(request: Request, exc: HTTPException) -> JSONRespon
|
|
1076 |
headers=exc.headers,
|
1077 |
)
|
1078 |
|
|
|
1079 |
# Add the custom exception handler to your FastAPI app
|
1080 |
-
app.add_exception_handler(HTTPException, custom_exception_handler)
|
|
|
17 |
# You should have received a copy of the GNU Affero General Public License
|
18 |
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
import base64
|
21 |
+
import json
|
22 |
+
import logging
|
23 |
+
import os
|
24 |
+
import random
|
25 |
+
import re
|
26 |
+
from base64 import b64decode
|
27 |
+
from base64 import b64decode as kc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
from datetime import datetime as dt
|
29 |
+
from io import BytesIO
|
30 |
+
from typing import *
|
31 |
+
from typing import Union
|
32 |
|
33 |
+
import g4f
|
34 |
+
import requests
|
|
|
35 |
from bardapi import Bard
|
36 |
+
from bs4 import BeautifulSoup
|
37 |
+
from dotenv import load_dotenv
|
38 |
+
from fastapi import Depends, FastAPI, Header, HTTPException, Query, Request
|
39 |
+
from fastapi.responses import JSONResponse, StreamingResponse
|
40 |
+
from gpytranslate import SyncTranslator
|
41 |
+
from httpx import AsyncClient
|
42 |
+
from pymongo import MongoClient
|
43 |
from RyuzakiLib.hackertools.chatgpt import RendyDevChat
|
44 |
+
from RyuzakiLib.hackertools.gemini import GeminiLatest
|
45 |
+
from RyuzakiLib.mental import BadWordsList
|
46 |
+
from serpapi import GoogleSearch
|
47 |
|
48 |
from models import *
|
49 |
|
|
|
75 |
ASSISTANT_GOOGLE_API_KEYS = os.environ["ASSISTANT_GOOGLE_API_KEYS"]
|
76 |
COOKIE_BARD_TOKEN = os.environ["COOKIE_BARD_TOKEN"]
|
77 |
|
78 |
+
# unlocks
|
79 |
ORACLE_TOKEN = os.environ["ORACLE_TOKEN"]
|
80 |
TruAI = os.environ["TruAI"]
|
81 |
|
|
|
97 |
"name": "🌀ʊʄ⊕ք🌀",
|
98 |
"url": "https://t.me/UFoPInfo",
|
99 |
},
|
100 |
+
docs_url="/",
|
101 |
)
|
102 |
|
103 |
timeout = 100
|
|
|
117 |
~ 🌀ʊʄ⊕ք🌀 Team
|
118 |
"""
|
119 |
|
120 |
+
|
121 |
def get_all_api_keys():
|
122 |
user = collection.find({})
|
123 |
api_keys = []
|
|
|
127 |
api_keys.append(api_key)
|
128 |
return api_keys
|
129 |
|
130 |
+
|
131 |
def validate_api_key(api_key: str = Header(...)):
|
132 |
USERS_API_KEYS = get_all_api_keys()
|
133 |
if api_key not in USERS_API_KEYS:
|
134 |
raise HTTPException(status_code=401, detail="Invalid API key")
|
135 |
|
136 |
+
|
137 |
def validate_api_key_only_devs(api_key: str = Header(...)):
|
138 |
if api_key not in ONLY_DEVELOPER_API_KEYS:
|
139 |
raise HTTPException(status_code=401, detail="Invalid API key")
|
140 |
|
141 |
+
|
142 |
RAMDOM_STATUS = [
|
143 |
"Spammer",
|
144 |
"wanted",
|
|
|
146 |
"rogue_agent",
|
147 |
"pornbot prolly",
|
148 |
"fugitive",
|
149 |
+
"simp",
|
150 |
]
|
151 |
|
152 |
+
|
153 |
def remove_sibyl_system_banned(user_id):
|
154 |
update_doc = {
|
155 |
"sibyl_ban": None,
|
156 |
"reason_sibyl": None,
|
157 |
"is_banned_sibly": None,
|
158 |
"date_joined_sib": None,
|
159 |
+
"sibyl_userid": None,
|
160 |
}
|
161 |
+
return collection.update_one(
|
162 |
+
{"user_id": user_id}, {"$unset": update_doc}, upsert=True
|
163 |
+
)
|
164 |
+
|
165 |
|
166 |
def new_sibyl_system_banned(user_id, name, reason, date_joined):
|
167 |
update_doc = {
|
|
|
169 |
"reason_sibyl": reason,
|
170 |
"is_banned_sibly": True,
|
171 |
"date_joined_sib": date_joined,
|
172 |
+
"sibyl_userid": user_id,
|
173 |
}
|
174 |
+
return collection.update_one(
|
175 |
+
{"user_id": user_id}, {"$set": update_doc}, upsert=True
|
176 |
+
)
|
177 |
+
|
178 |
|
179 |
def cybersecuritydb(user_id, mongo_url):
|
180 |
update_doc = {"mongodb": mongo_url}
|
181 |
+
return collection.update_one(
|
182 |
+
{"user_id": user_id}, {"$set": update_doc}, upsert=True
|
183 |
+
)
|
184 |
+
|
185 |
|
186 |
def get_sibyl_system_banned(user_id):
|
187 |
user = collection.find_one({"user_id": user_id})
|
|
|
195 |
else:
|
196 |
return None, None, False, None, None
|
197 |
|
198 |
+
|
199 |
def get_all_banned():
|
200 |
banned_users = []
|
201 |
|
|
|
207 |
banned_users.append({"user_id": user_id, "reason": reason})
|
208 |
return banned_users
|
209 |
|
210 |
+
|
211 |
@app.get("/UFoP/blacklist-words")
|
212 |
def blacklist_words():
|
213 |
try:
|
214 |
BLACKLIST_WORDS = BadWordsList()
|
215 |
+
results_all = BLACKLIST_WORDS.banned_by_google(
|
216 |
+
file_txt="banned_by_google.txt", storage=True
|
217 |
+
)
|
218 |
return {"status": "true", "results": results_all}
|
219 |
except Exception as e:
|
220 |
return {"status": "false", "message": f"Internal server error: {str(e)}"}
|
|
|
223 |
@app.get("/UFoP/getbanlist")
|
224 |
def sibyl_get_all_banlist():
|
225 |
banned_users = get_all_banned()
|
226 |
+
return {"status": "True", "sukuna": {"results": banned_users}}
|
227 |
+
|
|
|
|
|
|
|
|
|
228 |
|
229 |
+
@app.delete(
|
230 |
+
"/UFoP/bandel",
|
231 |
+
response_model=SuccessResponse,
|
232 |
+
responses={422: {"model": ErrorStatus}},
|
233 |
+
)
|
234 |
def sibyl_system_delete(
|
235 |
+
item: SibylSystemDel, api_key: None = Depends(validate_api_key_only_devs)
|
|
|
236 |
):
|
237 |
try:
|
238 |
_, _, _, _, sibyl_user_id = get_sibyl_system_banned(item.user_id)
|
|
|
241 |
remove_sibyl_system_banned(item.user_id)
|
242 |
return SuccessResponse(
|
243 |
status="True",
|
244 |
+
randydev={
|
245 |
+
"message": f"Successfully removed {item.user_id} from the Sibyl ban list"
|
246 |
+
},
|
247 |
)
|
248 |
else:
|
249 |
return SuccessResponse(
|
250 |
+
status="False", randydev={"message": "Not Found UserID"}
|
|
|
251 |
)
|
252 |
except Exception as e:
|
253 |
return ErrorStatus(status="false", message=f"Internal server error: {str(e)}")
|
254 |
|
255 |
+
|
256 |
+
@app.post(
|
257 |
+
"/UFoP/banner",
|
258 |
+
response_model=SuccessResponse,
|
259 |
+
responses={422: {"model": ErrorStatus}},
|
260 |
+
)
|
261 |
def sibyl_system_ban(
|
262 |
+
item: SibylSystemBan, api_key: None = Depends(validate_api_key_only_devs)
|
|
|
263 |
):
|
264 |
if item.user_id == DEVELOPER_ID:
|
265 |
return {"status": "false", "message": "Only Developer"}
|
|
|
271 |
|
272 |
if sibyl_user_id is not None and is_banned:
|
273 |
return SuccessResponse(
|
274 |
+
status="False", randydev={"message": "User is already banned"}
|
|
|
275 |
)
|
276 |
|
277 |
new_sibyl_system_banned(item.user_id, sibyl_ban, item.reason, date_joined)
|
|
|
282 |
"sibyl_name": sibyl_ban,
|
283 |
"reason": item.reason,
|
284 |
"date_joined": date_joined,
|
285 |
+
"message": f"Successfully banned {item.user_id} from the Sibyl ban list.",
|
286 |
+
},
|
287 |
)
|
288 |
except Exception as e:
|
289 |
return ErrorStatus(status="false", message=f"Internal server error: {str(e)}")
|
290 |
|
291 |
+
|
292 |
@app.get("/UFoP/bans")
|
293 |
def sibyl_system(
|
294 |
user_id: int = Query(..., description="User ID in query parameter"),
|
295 |
+
api_key: None = Depends(validate_api_key),
|
296 |
):
|
297 |
result = get_sibyl_system_banned(user_id)
|
298 |
if result is not None:
|
|
|
304 |
"reason": reason,
|
305 |
"is_banned": is_banned,
|
306 |
"date_joined": date_joined,
|
307 |
+
"sibyl_user_id": sibyl_user_id,
|
308 |
+
},
|
309 |
}
|
310 |
else:
|
311 |
return {"status": "false", "message": "Not Found User"}
|
312 |
|
313 |
+
|
314 |
+
@app.post(
|
315 |
+
"/UFoP/gemini-the-oracle",
|
316 |
+
response_model=SuccessResponse,
|
317 |
+
responses={422: {"model": ErrorStatus}},
|
318 |
+
)
|
319 |
+
async def gemini_oracle(item: GeminiOracle):
|
320 |
if item.is_multi_chat:
|
321 |
selected_api_key = ASSISTANT_GOOGLE_API_KEYS or item.gemini_api_key
|
322 |
oracle_base = ORACLE_TOKEN or item.oracle_base
|
|
|
326 |
mongo_url=item.mongo_url,
|
327 |
version=item.version,
|
328 |
user_id=item.user_id,
|
329 |
+
oracle_base=oracle_base,
|
330 |
)
|
331 |
cybersecuritydb(item.user_id, item.mongo_url)
|
332 |
if item.oracle_base == "Delete":
|
333 |
clearedhistory = await geni._clear_oracle_history_in_db()
|
334 |
+
return SuccessResponse(
|
335 |
+
status="True",
|
336 |
+
randydev={"message": f"Oracle Status: {clearedhistory}"},
|
337 |
+
)
|
338 |
else:
|
339 |
+
answer, oracle_chat = await geni._GeminiLatest__get_response_oracle(
|
340 |
+
item.query
|
341 |
+
)
|
342 |
return SuccessResponse(
|
343 |
+
status="True", randydev={"message": answer, "chat_history": oracle_chat}
|
|
|
|
|
|
|
|
|
344 |
)
|
345 |
except Exception as excep:
|
346 |
return SuccessResponse(status="False", randydev={"message": internal_error})
|
|
|
357 |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",
|
358 |
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
|
359 |
"Origin": "https://bard.google.com",
|
360 |
+
"Referer": "https://bard.google.com/",
|
361 |
}
|
362 |
session.cookies.set("__Secure-1PSID", token)
|
363 |
bard = Bard(token=token, session=session, timeout=30)
|
364 |
bard.get_answer(owner_base)["content"]
|
365 |
message = bard.get_answer(item.query)["content"]
|
366 |
return SuccessResponse(status="True", randydev={"message": message})
|
367 |
+
except BaseException:
|
368 |
+
return SuccessResponse(
|
369 |
+
status="False", randydev={"message": contact_support}
|
370 |
+
)
|
371 |
|
372 |
+
|
373 |
+
@app.post(
|
374 |
+
"/UFoP/G-AI",
|
375 |
+
response_model=SuccessResponse,
|
376 |
+
responses={422: {"model": ErrorStatus}},
|
377 |
+
)
|
378 |
+
def v1beta3_google_ai(item: ChatgptCustom, api_key: None = Depends(validate_api_key)):
|
379 |
api_url = f"{SOURCE_ASSISTANT_GOOGLE_AI}/models/text-bison-001:generateText?key={ASSISTANT_GOOGLE_API_KEYS}"
|
380 |
try:
|
381 |
headers = {"Content-Type": "application/json"}
|
382 |
+
data = {"prompt": {"text": item.query}}
|
|
|
|
|
|
|
|
|
383 |
response = requests.post(api_url, headers=headers, json=data)
|
384 |
response_str = response.json()
|
385 |
answer = response_str["candidates"]
|
386 |
for results in answer:
|
387 |
message = results.get("output")
|
388 |
+
return SuccessResponse(status="True", randydev={"message": message})
|
389 |
+
except BaseException:
|
|
|
|
|
|
|
|
|
|
|
390 |
return SuccessResponse(status="False", randydev={"message": internal_error})
|
391 |
|
392 |
+
|
393 |
+
@app.post(
|
394 |
+
"/UFoP/gemini-ai-pro",
|
395 |
+
response_model=SuccessResponse,
|
396 |
+
responses={422: {"model": ErrorStatus}},
|
397 |
+
)
|
398 |
def gemini_pro(item: GeminiPro):
|
399 |
owner_base = TruAI
|
400 |
if item.is_multi_chat:
|
|
|
404 |
api_key=selected_api_key,
|
405 |
mongo_url=item.mongo_url,
|
406 |
version=item.version,
|
407 |
+
user_id=item.user_id,
|
408 |
)
|
409 |
cybersecuritydb(item.user_id, item.mongo_url)
|
410 |
answer, gemini_chat = geni._GeminiLatest__get_response_gemini(item.query)
|
411 |
return SuccessResponse(
|
412 |
+
status="True", randydev={"message": answer, "chat_history": gemini_chat}
|
|
|
|
|
|
|
|
|
413 |
)
|
414 |
except Exception:
|
415 |
+
return SuccessResponse(
|
416 |
+
status="False", randydev={"message": contact_support}
|
417 |
+
)
|
418 |
else:
|
419 |
if item.is_login:
|
420 |
token = item.bard_api_key
|
|
|
428 |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",
|
429 |
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
|
430 |
"Origin": "https://bard.google.com",
|
431 |
+
"Referer": "https://bard.google.com/",
|
432 |
}
|
433 |
session.cookies.set("__Secure-1PSID", token)
|
434 |
bard = Bard(token=token, session=session, timeout=30)
|
435 |
bard.get_answer(owner_base)["content"]
|
436 |
message = bard.get_answer(item.query)["content"]
|
437 |
return SuccessResponse(status="True", randydev={"message": message})
|
438 |
+
except BaseException:
|
439 |
+
return SuccessResponse(
|
440 |
+
status="False", randydev={"message": contact_support}
|
441 |
+
)
|
442 |
+
|
443 |
|
444 |
@app.post("/UFoP/dalle3xl")
|
445 |
+
def dalle_3xl(item: Dalle3XL, api_key: None = Depends(validate_api_key)):
|
|
|
|
|
|
|
446 |
API_URL = SOURCE_DALLE3XL_URL
|
447 |
try:
|
448 |
payload = {"inputs": item.query}
|
|
|
450 |
"Authorization": f"Bearer {HUGGING_TOKEN}",
|
451 |
"Content-Type": "application/json",
|
452 |
}
|
453 |
+
response = requests.post(
|
454 |
+
API_URL, headers=headers, json=payload, timeout=timeout
|
455 |
+
)
|
456 |
response.raise_for_status()
|
457 |
except requests.exceptions.RequestException:
|
458 |
+
raise HTTPException(status_code=500, detail=internal_error)
|
|
|
|
|
|
|
459 |
|
460 |
try:
|
461 |
encoded_string = base64.b64encode(response.content).decode("utf-8")
|
462 |
except Exception:
|
463 |
+
raise HTTPException(status_code=500, detail=contact_support)
|
|
|
|
|
|
|
464 |
|
465 |
if encoded_string:
|
466 |
return SuccessResponse(status="True", randydev={"data": encoded_string})
|
|
|
469 |
|
470 |
|
471 |
@app.get("/ryuzaki/unsplash")
|
472 |
+
async def get_image_unsplash(query: str, size: str = "500x500"):
|
473 |
url = SOURCE_UNSPLASH_URL
|
474 |
image_url = f"{url}/?{query}/{size}"
|
475 |
|
|
|
481 |
|
482 |
return StreamingResponse(BytesIO(response.content), media_type="image/jpeg")
|
483 |
|
484 |
+
|
485 |
@app.get("/ryuzaki/reverse")
|
486 |
def google_reverse(
|
487 |
+
engine: str = "google_reverse_image",
|
488 |
+
image_url: str = None,
|
489 |
+
language: str = "en",
|
490 |
+
google_lang: str = "us",
|
491 |
+
api_key: None = Depends(validate_api_key),
|
492 |
):
|
493 |
params = {
|
494 |
"api_key": REVERSE_IMAGE_API,
|
495 |
"engine": engine,
|
496 |
"image_url": image_url,
|
497 |
"hl": language,
|
498 |
+
"gl": google_lang,
|
499 |
}
|
500 |
try:
|
501 |
search = GoogleSearch(params)
|
|
|
510 |
"link": link,
|
511 |
"total_time_taken": total_time_taken,
|
512 |
"create_at": create_at,
|
513 |
+
"processed_at": processed_at,
|
514 |
+
},
|
515 |
}
|
516 |
except Exception as e:
|
517 |
return {"status": "false", "message": f"Error {e}"}
|
518 |
|
519 |
+
|
520 |
@app.get("/ryuzaki/ocr")
|
521 |
def ocr_space_url(
|
522 |
url: str = Query(..., description="URL in query parameter"),
|
523 |
+
overlay: bool = False,
|
524 |
language: str = Query("eng", description="Language in query parameter"),
|
525 |
+
api_key: None = Depends(validate_api_key),
|
526 |
):
|
527 |
payload = {
|
528 |
"url": url,
|
529 |
"isOverlayRequired": overlay,
|
530 |
"apikey": OCR_API_KEY,
|
531 |
+
"language": language,
|
532 |
}
|
533 |
try:
|
534 |
response = requests.post(SOURCE_OCR_URL, data=payload)
|
|
|
538 |
return f"Error: {str(e)}"
|
539 |
try:
|
540 |
parsed_response = json.loads(test_url)
|
541 |
+
if (
|
542 |
+
"ParsedResults" in parsed_response
|
543 |
+
and len(parsed_response["ParsedResults"]) > 0
|
544 |
+
):
|
545 |
return {
|
546 |
"status": "true",
|
547 |
+
"sukuna": {"text": parsed_response["ParsedResults"][0]["ParsedText"]},
|
|
|
|
|
548 |
}
|
549 |
else:
|
550 |
return {"status": "false", "message": "Error response."}
|
551 |
except (json.JSONDecodeError, KeyError):
|
552 |
return "Error parsing the OCR response."
|
553 |
|
554 |
+
|
555 |
@app.get("/ryuzaki/chatgpt4")
|
556 |
+
def chatgpt4_support(query: str = None, api_key: None = Depends(validate_api_key)):
|
|
|
|
|
|
|
557 |
try:
|
558 |
response = g4f.ChatCompletion.create(
|
559 |
model=g4f.models.gpt_4,
|
560 |
messages=[{"role": "user", "content": query}],
|
561 |
)
|
562 |
+
return {"status": "true", "sukuna": {"message": response}}
|
563 |
+
except BaseException:
|
|
|
|
|
|
|
|
|
|
|
564 |
return {"status": "false", "message": "Error response."}
|
565 |
|
566 |
+
|
567 |
@app.post("/ryuzaki/chatgpt-model")
|
568 |
+
def chatgpt_model(query: str = None, model_id: int = 1, is_models: bool = True):
|
|
|
|
|
|
|
|
|
569 |
try:
|
570 |
+
response = RendyDevChat(query).get_response_model(
|
571 |
+
model_id=model_id, is_models=is_models
|
572 |
+
)
|
573 |
+
return {"status": "true", "sukuna": {"message": response}}
|
574 |
+
except BaseException:
|
|
|
|
|
|
|
575 |
return {"status": "false", "message": "Error response."}
|
576 |
|
577 |
+
|
578 |
async def get_data(username):
|
579 |
base_msg = ""
|
580 |
async with AsyncClient() as gpx:
|
581 |
req = (await gpx.get(f"https://api.github.com/users/{username}")).json()
|
582 |
try:
|
583 |
avatar = req["avatar_url"]
|
584 |
+
twitter = req["twitter_username"]
|
585 |
base_msg += "**❆ Gitub Information ❆** \n\n"
|
586 |
base_msg += f"**Profile Url:** {req['html_url']} \n"
|
587 |
base_msg += f"**Name:** `{req['name']}` \n"
|
|
|
603 |
base_msg += f"**An error occured while parsing the data!** \n\n**Traceback:** \n `{e}` \n\n`Make sure that you've sent the command with the correct username!`"
|
604 |
return [base_msg, "https://telegra.ph//file/32f69c18190666ea96553.jpg"]
|
605 |
|
606 |
+
|
607 |
@app.get("/ryuzaki/github")
|
608 |
+
async def github(username: str = None):
|
609 |
try:
|
610 |
details = await get_data(username)
|
611 |
return {
|
612 |
"status": "true",
|
613 |
+
"sukuna": {"avatar": details[1], "results": details[0]},
|
|
|
|
|
|
|
614 |
}
|
615 |
+
except BaseException:
|
616 |
return {"status": "false", "message": "Error response."}
|
617 |
|
618 |
+
|
619 |
@app.get("/ryuzaki/webshot")
|
620 |
def webshot(
|
621 |
+
url: str = None,
|
622 |
+
quality: str = "1920x1080",
|
623 |
+
type_mine: str = "JPEG",
|
624 |
+
pixels: str = "1024",
|
625 |
+
cast: str = "Z100",
|
626 |
):
|
627 |
try:
|
628 |
+
required_url = (
|
629 |
+
f"https://mini.s-shot.ru/{quality}/{type_mine}/{pixels}/{cast}/?{url}"
|
630 |
+
)
|
631 |
+
return {"status": "true", "sukuna": {"image_url": required_url}}
|
632 |
+
except BaseException:
|
|
|
|
|
|
|
633 |
return {"status": "false", "message": "Error response."}
|
634 |
|
635 |
+
|
636 |
@app.get("/ryuzaki/chatbot")
|
637 |
def chatbot(
|
638 |
+
query: str = None,
|
639 |
+
user_id: int = None,
|
640 |
+
bot_name: str = None,
|
641 |
+
bot_username: str = None,
|
642 |
):
|
643 |
api_url = b64decode("aHR0cHM6Ly9hcGkuc2Fmb25lLmRldi9jaGF0Ym90").decode("utf-8")
|
644 |
params = {
|
645 |
"query": query,
|
646 |
"user_id": user_id,
|
647 |
"bot_name": bot_name,
|
648 |
+
"bot_master": bot_username,
|
649 |
}
|
650 |
x = requests.get(f"{api_url}", params=params)
|
651 |
if x.status_code != 200:
|
|
|
653 |
try:
|
654 |
y = x.json()
|
655 |
response = y["response"]
|
656 |
+
return {"status": "true", "sukuna": {"message": response}}
|
657 |
+
except BaseException:
|
|
|
|
|
|
|
|
|
|
|
658 |
return {"status": "false", "message": "Error response."}
|
659 |
|
660 |
+
|
661 |
@app.get("/ryuzaki/waifu")
|
662 |
+
def waifu_pics(types: str = "sfw", category: str = "neko"):
|
|
|
|
|
|
|
663 |
waifu_api = f"{SOURCE_WAIFU_URL}/{types}"
|
664 |
waifu_param = f"{waifu_api}/{category}"
|
665 |
|
666 |
response = requests.get(waifu_param)
|
667 |
|
668 |
if response.status_code != 200:
|
669 |
+
return (
|
670 |
+
"Sorry, there was an error processing your request. Please try again later"
|
671 |
+
)
|
672 |
data_waifu = response.json()
|
673 |
try:
|
674 |
waifu_image_url = data_waifu["url"]
|
|
|
676 |
return f"Error request {e}"
|
677 |
if waifu_image_url:
|
678 |
try:
|
679 |
+
return {"status": "true", "sukuna": {"image_url": waifu_image_url}}
|
680 |
+
except BaseException:
|
|
|
|
|
|
|
|
|
|
|
681 |
return {"status": "false", "message": "Error response"}
|
682 |
else:
|
683 |
return {"status": "false", "message": "Error response."}
|
684 |
|
685 |
+
|
686 |
@app.get("/ryuzaki/rayso")
|
687 |
def make_rayso(
|
688 |
code=None,
|
689 |
+
title: str = "Ryuzaki Dev",
|
690 |
+
theme: str = None,
|
691 |
+
setlang: str = "en",
|
692 |
+
auto_translate: bool = None,
|
693 |
+
ryuzaki_dark: bool = None,
|
694 |
):
|
695 |
trans = SyncTranslator()
|
696 |
api_url = b64decode("aHR0cHM6Ly9hcGkuc2Fmb25lLm1lL3JheXNv").decode("utf-8")
|
|
|
703 |
if ryuzaki_dark:
|
704 |
x = requests.post(
|
705 |
f"{api_url}",
|
706 |
+
json={"code": code, "title": title, "theme": theme, "darkMode": True},
|
|
|
|
|
|
|
|
|
|
|
707 |
)
|
708 |
if x.status_code != 200:
|
709 |
return "Error api Gay"
|
710 |
data = x.json()
|
711 |
try:
|
712 |
image_data = base64.b64decode(data["image"])
|
713 |
+
return {"status": "true", "data": {"image": image_data}}
|
714 |
+
except BaseException:
|
|
|
|
|
|
|
|
|
|
|
715 |
return {"status": "false", "message": "Error response"}
|
716 |
else:
|
717 |
x = requests.post(
|
718 |
f"{api_url}",
|
719 |
+
json={"code": code, "title": title, "theme": theme, "darkMode": False},
|
|
|
|
|
|
|
|
|
|
|
720 |
)
|
721 |
if x.status_code != 200:
|
722 |
return "Error api Gay"
|
723 |
data = x.json()
|
724 |
try:
|
725 |
image_data = base64.b64decode(data["image"])
|
726 |
+
return {"status": "true", "data": {"image": image_data}}
|
727 |
+
except BaseException:
|
|
|
|
|
|
|
|
|
|
|
728 |
return {"status": "false", "message": "Error response"}
|
729 |
|
730 |
+
|
731 |
@app.get("/ryuzaki/ipcheck")
|
732 |
+
def whois_ip_address(ip_address: str = None):
|
733 |
apikey = kc("M0QwN0UyRUFBRjU1OTQwQUY0NDczNEMzRjJBQzdDMUE=").decode("utf-8")
|
734 |
location_link = "https"
|
735 |
location_api = "api.ip2location.io"
|
|
|
740 |
)
|
741 |
response = requests.get(location_param)
|
742 |
if response.status_code != 200:
|
743 |
+
return (
|
744 |
+
"Sorry, there was an error processing your request. Please try again later"
|
745 |
+
)
|
746 |
data_location = response.json()
|
747 |
try:
|
748 |
location_ip = data_location["ip"]
|
|
|
772 |
"city_name": location_city,
|
773 |
"zip_code": location_zip,
|
774 |
"time_zone": location_zone,
|
775 |
+
"as": location_card,
|
776 |
}
|
777 |
else:
|
778 |
return {"status": "false", "message": "Invalid ip address"}
|
779 |
|
780 |
+
|
781 |
@app.get("/ryuzaki/tiktok_douyin")
|
782 |
+
def tiktok_douyin(tiktok_url: str = None):
|
783 |
response = requests.get(f"{SOURCE_TIKTOK_WTF_URL}={tiktok_url}")
|
784 |
if response.status_code != 200:
|
785 |
return "Error request:"
|
786 |
try:
|
787 |
+
download_video = response.json()["aweme_list"][0]["video"]["play_addr"][
|
788 |
+
"url_list"
|
789 |
+
][0]
|
790 |
+
download_audio = response.json()["aweme_list"][0]["music"]["play_url"][
|
791 |
+
"url_list"
|
792 |
+
][0]
|
793 |
description = response.json()["aweme_list"][0]["desc"]
|
794 |
author = response.json()["aweme_list"][0]["author"]["nickname"]
|
795 |
request = response.json()["aweme_list"][0]["author"]["signature"]
|
|
|
800 |
"music_url": download_audio,
|
801 |
"description": description,
|
802 |
"author": author,
|
803 |
+
"request": request,
|
804 |
+
},
|
805 |
}
|
806 |
+
except BaseException:
|
807 |
return {"status": "false", "message": "Error request"}
|
808 |
|
809 |
+
|
810 |
@app.get("/ryuzaki/tiktok")
|
811 |
+
def tiktok_downloader(tiktok_url: Union[str, None] = None, only_video: bool = None):
|
812 |
api_devs = SOURCE_TIKTOK_TECH_URL
|
813 |
parameter = f"tiktok?url={tiktok_url}"
|
814 |
api_url = f"{api_devs}/{parameter}"
|
|
|
822 |
if only_video:
|
823 |
video_url = results.get("result", {}).get("withoutWaterMarkVideo", "")
|
824 |
if video_url:
|
825 |
+
return {"download_url": video_url, "caption": caption}
|
|
|
|
|
|
|
826 |
else:
|
827 |
music_mp3 = results.get("result", {}).get("music", "")
|
828 |
if music_mp3:
|
829 |
+
return {"music_url": music_mp3, "caption": caption}
|
|
|
|
|
|
|
830 |
return "Error: TikTok data not found or unsupported format"
|
831 |
+
except BaseException:
|
832 |
return {"status": "false", "message": "Invalid Link"}
|
833 |
|
834 |
+
|
835 |
@app.get("/ryuzaki/mediafire")
|
836 |
def mediafire(link: Union[str, None] = None):
|
837 |
+
try:
|
838 |
+
down_link = str(link)
|
839 |
+
mid = down_link.split("/", 5)
|
840 |
+
if mid[3] == "view":
|
841 |
+
mid[3] = "file"
|
842 |
+
down_link = "/".join(mid)
|
843 |
+
print(down_link)
|
844 |
+
r = requests.get(down_link)
|
845 |
+
soup = BeautifulSoup(r.content, "html.parser")
|
846 |
+
a_href = soup.find("a", {"class": "input popsok"}).get("href")
|
847 |
+
a = str(a_href)
|
848 |
+
id = link.split("/", 5)[4]
|
849 |
+
a_byte = soup.find("a", {"class": "input popsok"}).get_text()
|
850 |
+
a_name = soup.find("div", {"class": "dl-btn-label"}).get_text()
|
851 |
+
details = soup.find("ul", {"class": "details"})
|
852 |
+
li_items = details.find_all("li")[1]
|
853 |
+
some = li_items.find_all("span")[0].get_text().split()
|
854 |
+
dat = list(some)
|
855 |
+
down = a_byte.replace(" ", "").strip()
|
856 |
+
time = dat[1]
|
857 |
+
date = dat[0]
|
858 |
+
byte = down.split("(", 1)[1].split(")", 1)[0]
|
859 |
+
name = a_name.replace(" ", "").strip()
|
860 |
+
return {
|
861 |
+
"status": "true",
|
862 |
+
"data": {
|
863 |
+
"file": {
|
864 |
+
"url": {
|
865 |
+
"directDownload": a,
|
866 |
+
"original": link,
|
867 |
+
},
|
868 |
+
"metadata": {
|
869 |
+
"id": id,
|
870 |
+
"name": name,
|
871 |
+
"size": {"readable": byte},
|
872 |
+
"DateAndTime": {"time": time, "date": date},
|
873 |
+
},
|
874 |
+
}
|
875 |
},
|
|
|
|
|
|
|
|
|
|
|
876 |
}
|
|
|
|
|
877 |
|
878 |
+
except BaseException:
|
879 |
+
return "{'status': 'false', 'message': 'Invalid Link'}"
|
880 |
|
881 |
|
882 |
@app.get("/ryuzaki/gdrive")
|
883 |
def gdrive(link: Union[str, None] = None):
|
884 |
+
try:
|
885 |
+
down = link.split("/", 6)
|
886 |
+
url = f"https://drive.google.com/uc?export=download&id={down[5]}"
|
887 |
+
session = requests.Session()
|
888 |
+
|
889 |
+
response = session.get(url, stream=True)
|
890 |
+
headers = response.headers
|
891 |
+
content_disp = headers.get("content-disposition")
|
892 |
+
filename = None
|
893 |
+
if content_disp:
|
894 |
+
match = re.search(r'filename="(.+)"', content_disp)
|
895 |
+
if match:
|
896 |
+
filename = match.group(1)
|
897 |
+
|
898 |
+
content_length = headers.get("content-length")
|
899 |
+
last_modified = headers.get("last-modified")
|
900 |
+
content_type = headers.get("content-type")
|
901 |
+
|
902 |
+
return {
|
903 |
+
"status": "true",
|
904 |
+
"data": {
|
905 |
+
"file": {
|
906 |
+
"url": {
|
907 |
+
"directDownload": url,
|
908 |
+
"original": link,
|
909 |
+
},
|
910 |
+
"metadata": {
|
911 |
+
"id": down[5],
|
912 |
+
"name": (
|
913 |
+
filename
|
914 |
+
if filename
|
915 |
+
else "No filename provided by the server."
|
916 |
+
),
|
917 |
+
"size": {
|
918 |
+
"readable": (
|
919 |
+
f"{round(int(content_length) / (1024 * 1024), 2)} MB"
|
920 |
+
if content_length
|
921 |
+
else "No content length provided by the server."
|
922 |
+
),
|
923 |
+
"type": (
|
924 |
+
content_type
|
925 |
+
if content_type
|
926 |
+
else "No content type provided by the server."
|
927 |
+
),
|
928 |
+
},
|
929 |
+
"DateAndTime": (
|
930 |
+
last_modified
|
931 |
+
if last_modified
|
932 |
+
else "No last modified date provided by the server."
|
933 |
+
),
|
934 |
+
},
|
935 |
+
}
|
936 |
},
|
|
|
|
|
|
|
|
|
937 |
}
|
|
|
|
|
938 |
|
939 |
+
except BaseException:
|
940 |
+
return "{'status': 'false', 'message': 'Invalid Link'}"
|
941 |
+
|
942 |
|
943 |
@app.get("/ryuzaki/anonfiles")
|
944 |
def anonfiles(link: Union[str, None] = None):
|
945 |
+
try:
|
946 |
+
r = requests.get(link)
|
947 |
+
soup = BeautifulSoup(r.content, "html.parser")
|
948 |
+
a_href = soup.find("a", {"id": "download-url"}).get("href")
|
949 |
+
a = str(a_href)
|
950 |
+
id = link.split("/", 4)[3]
|
951 |
+
jsondata = requests.get(f"https://api.anonfiles.com/v2/file/{id}/info").json()
|
952 |
+
jsondata["data"]["file"]["url"]["directDownload"] = a
|
953 |
+
del jsondata["data"]["file"]["url"]["full"]
|
954 |
+
|
955 |
+
return jsondata
|
956 |
+
except BaseException:
|
957 |
+
return "{'status': 'false', 'message': 'Invalid Link'}"
|
958 |
+
|
959 |
|
960 |
@app.get("/ryuzaki/filechan")
|
961 |
def filechan(link: Union[str, None] = None):
|
962 |
+
try:
|
963 |
+
r = requests.get(link)
|
964 |
+
soup = BeautifulSoup(r.content, "html.parser")
|
965 |
+
a_href = soup.find("a", {"id": "download-url"}).get("href")
|
966 |
+
a = str(a_href)
|
967 |
+
id = link.split("/", 4)[3]
|
968 |
+
jsondata = requests.get(f"https://api.filechan.org/v2/file/{id}/info").json()
|
969 |
+
jsondata["data"]["file"]["url"]["directDownload"] = a
|
970 |
+
del jsondata["data"]["file"]["url"]["full"]
|
971 |
+
|
972 |
+
return jsondata
|
973 |
+
except BaseException:
|
974 |
+
return "{'status': 'false', 'message': 'Invalid Link'}"
|
975 |
+
|
976 |
|
977 |
@app.get("/ryuzaki/letsupload")
|
978 |
def letsupload(link: Union[str, None] = None):
|
979 |
+
try:
|
980 |
+
r = requests.get(link)
|
981 |
+
soup = BeautifulSoup(r.content, "html.parser")
|
982 |
+
a_href = soup.find("a", {"id": "download-url"}).get("href")
|
983 |
+
a = str(a_href)
|
984 |
+
id = link.split("/", 4)[3]
|
985 |
+
jsondata = requests.get(f"https://api.letsupload.cc/v2/file/{id}/info").json()
|
986 |
+
jsondata["data"]["file"]["url"]["directDownload"] = a
|
987 |
+
del jsondata["data"]["file"]["url"]["full"]
|
988 |
+
|
989 |
+
return jsondata
|
990 |
+
except BaseException:
|
991 |
+
return "{'status': 'false', 'message': 'Invalid Link'}"
|
992 |
+
|
993 |
|
994 |
@app.get("/ryuzaki/megaupload")
|
995 |
def megaupload(link: Union[str, None] = None):
|
996 |
+
try:
|
997 |
+
r = requests.get(link)
|
998 |
+
soup = BeautifulSoup(r.content, "html.parser")
|
999 |
+
a_href = soup.find("a", {"id": "download-url"}).get("href")
|
1000 |
+
a = str(a_href)
|
1001 |
+
id = link.split("/", 4)[3]
|
1002 |
+
jsondata = requests.get(f"https://api.megaupload.nz/v2/file/{id}/info").json()
|
1003 |
+
jsondata["data"]["file"]["url"]["directDownload"] = a
|
1004 |
+
del jsondata["data"]["file"]["url"]["full"]
|
1005 |
+
|
1006 |
+
return jsondata
|
1007 |
+
except BaseException:
|
1008 |
+
return "{'status': 'false', 'message': 'Invalid Link'}"
|
1009 |
+
|
1010 |
|
1011 |
@app.get("/ryuzaki/myfile")
|
1012 |
def myfile(link: Union[str, None] = None):
|
1013 |
+
try:
|
1014 |
+
r = requests.get(link)
|
1015 |
+
soup = BeautifulSoup(r.content, "html.parser")
|
1016 |
+
a_href = soup.find("a", {"id": "download-url"}).get("href")
|
1017 |
+
a = str(a_href)
|
1018 |
+
id = link.split("/", 4)[3]
|
1019 |
+
jsondata = requests.get(f"https://api.myfile.is/v2/file/{id}/info").json()
|
1020 |
+
jsondata["data"]["file"]["url"]["directDownload"] = a
|
1021 |
+
del jsondata["data"]["file"]["url"]["full"]
|
1022 |
+
|
1023 |
+
return jsondata
|
1024 |
+
except BaseException:
|
1025 |
+
return "{'status': 'false', 'message': 'Invalid Link'}"
|
1026 |
+
|
1027 |
|
1028 |
def custom_exception_handler(request: Request, exc: HTTPException) -> JSONResponse:
|
1029 |
error_detail = [{"error": str(exc.detail)}]
|
|
|
1035 |
headers=exc.headers,
|
1036 |
)
|
1037 |
|
1038 |
+
|
1039 |
# Add the custom exception handler to your FastAPI app
|
1040 |
+
app.add_exception_handler(HTTPException, custom_exception_handler)
|
models.py
CHANGED
@@ -1,23 +1,30 @@
|
|
1 |
import os
|
2 |
-
from typing import
|
|
|
3 |
from pydantic import BaseModel
|
|
|
4 |
ORACLE_TOKEN = os.environ["ORACLE_TOKEN"]
|
5 |
|
|
|
6 |
class CustomErrorResponseModel(BaseModel):
|
7 |
detail: List[Dict[str, Any]]
|
8 |
|
|
|
9 |
class SuccessResponse(BaseModel):
|
10 |
status: str
|
11 |
randydev: Dict[str, Any]
|
12 |
|
|
|
13 |
class ErrorResponse(BaseModel):
|
14 |
status: str
|
15 |
detail: str
|
16 |
|
|
|
17 |
class ErrorStatus(BaseModel):
|
18 |
status: str
|
19 |
message: str
|
20 |
|
|
|
21 |
class ProfileClone(BaseModel):
|
22 |
user_id: int
|
23 |
first_name: Optional[str] = None
|
@@ -25,22 +32,28 @@ class ProfileClone(BaseModel):
|
|
25 |
profile_id: Optional[str] = None
|
26 |
bio: Optional[str] = None
|
27 |
|
|
|
28 |
class GetProfileClone(BaseModel):
|
29 |
user_id: int
|
30 |
|
|
|
31 |
class SibylSystemDel(BaseModel):
|
32 |
user_id: int
|
33 |
|
|
|
34 |
class SibylSystemBan(BaseModel):
|
35 |
user_id: int
|
36 |
reason: str
|
37 |
|
|
|
38 |
class RyuzakiAi(BaseModel):
|
39 |
text: str
|
40 |
|
|
|
41 |
class SibylSystem(BaseModel):
|
42 |
user_id: int
|
43 |
|
|
|
44 |
class SibylSystemResponse(BaseModel):
|
45 |
sibyl_name: str
|
46 |
reason: str
|
@@ -48,29 +61,35 @@ class SibylSystemResponse(BaseModel):
|
|
48 |
date_joined: str
|
49 |
sibyl_user_id: int
|
50 |
|
|
|
51 |
class GoogleReverse(BaseModel):
|
52 |
-
engine: str="google_reverse_image"
|
53 |
image_url: str
|
54 |
-
language: str="en"
|
55 |
-
google_lang: str="us"
|
|
|
56 |
|
57 |
class GetImageUnsplash(BaseModel):
|
58 |
query: str
|
59 |
-
size: str="500x500"
|
|
|
60 |
|
61 |
class OrcSpaceUrl(BaseModel):
|
62 |
url: str
|
63 |
-
overlay: bool=False
|
64 |
-
language: str="eng"
|
|
|
65 |
|
66 |
class ChatgptModel(BaseModel):
|
67 |
query: str
|
68 |
model_id: Optional[int] = None
|
69 |
-
is_models: bool=False
|
|
|
70 |
|
71 |
class ChatgptCustom(BaseModel):
|
72 |
query: str
|
73 |
|
|
|
74 |
class GeminiPro(BaseModel):
|
75 |
query: str
|
76 |
bard_api_key: Optional[str] = None
|
@@ -81,6 +100,7 @@ class GeminiPro(BaseModel):
|
|
81 |
is_login: Optional[bool] = False
|
82 |
is_multi_chat: Optional[bool] = False
|
83 |
|
|
|
84 |
class GeminiOracle(BaseModel):
|
85 |
query: str
|
86 |
bard_api_key: Optional[str] = None
|
@@ -92,73 +112,89 @@ class GeminiOracle(BaseModel):
|
|
92 |
is_login: Optional[bool] = False
|
93 |
is_multi_chat: Optional[bool] = False
|
94 |
|
|
|
95 |
class WaifuPics(BaseModel):
|
96 |
-
types: str="sfw"
|
97 |
-
category: str="neko"
|
98 |
media_type: Optional[str] = None
|
99 |
-
is_bytes: bool=False
|
|
|
100 |
|
101 |
class MakeRayso(BaseModel):
|
102 |
code: str
|
103 |
-
title: str="Ryuzaki Dev"
|
104 |
theme: str
|
105 |
-
setlang: str="en"
|
106 |
auto_translate: Optional[bool] = None
|
107 |
-
ryuzaki_dark: bool=True
|
|
|
108 |
|
109 |
class Webshot(BaseModel):
|
110 |
url: str
|
111 |
-
quality: str="1920x1080"
|
112 |
-
type_mine: str="JPEG"
|
113 |
-
pixels: str="1024"
|
114 |
-
cast: str="Z100"
|
|
|
115 |
|
116 |
class GithubUsernames(BaseModel):
|
117 |
username: str
|
118 |
|
|
|
119 |
class ChatBots(BaseModel):
|
120 |
query: str
|
121 |
user_id: Optional[int] = None
|
122 |
bot_name: Optional[str] = None
|
123 |
bot_username: Optional[str] = None
|
124 |
|
|
|
125 |
class NewMonitor(BaseModel):
|
126 |
-
type: int=1
|
127 |
url: str
|
128 |
friendly_name: str
|
129 |
|
|
|
130 |
class TiktokBeta(BaseModel):
|
131 |
tiktok_url: str
|
132 |
only_video: Optional[bool] = None
|
133 |
|
|
|
134 |
class TiktokDownloader(BaseModel):
|
135 |
tiktok_url: str
|
136 |
|
|
|
137 |
class GetMonitorLogs(BaseModel):
|
138 |
logs: int
|
139 |
|
|
|
140 |
class DownloadLink(BaseModel):
|
141 |
link: str
|
142 |
|
|
|
143 |
class OpenDalle(BaseModel):
|
144 |
query: str
|
145 |
|
|
|
146 |
class Dalle3XL(BaseModel):
|
147 |
query: str
|
148 |
|
|
|
149 |
class TranslateCustom(BaseModel):
|
150 |
text: str
|
151 |
setlang: str
|
152 |
|
|
|
153 |
class AnimeStyled(BaseModel):
|
154 |
query: str
|
155 |
|
|
|
156 |
class OpenaiTexts(BaseModel):
|
157 |
query: str
|
158 |
api_key: Optional[str] = ""
|
159 |
model: Optional[str] = "gpt-4"
|
160 |
is_stream: Optional[bool] = False
|
161 |
|
|
|
162 |
class Chatgpt3Texts(BaseModel):
|
163 |
query: str
|
164 |
api_key: Optional[str] = ""
|
@@ -166,8 +202,10 @@ class Chatgpt3Texts(BaseModel):
|
|
166 |
is_stream: Optional[bool] = False
|
167 |
is_openai_original: Optional[bool] = False
|
168 |
|
|
|
169 |
class TextCustom(BaseModel):
|
170 |
query: str
|
171 |
|
|
|
172 |
class Picsart(BaseModel):
|
173 |
-
image_path: str
|
|
|
1 |
import os
|
2 |
+
from typing import Any, Dict, List, Optional
|
3 |
+
|
4 |
from pydantic import BaseModel
|
5 |
+
|
6 |
ORACLE_TOKEN = os.environ["ORACLE_TOKEN"]
|
7 |
|
8 |
+
|
9 |
class CustomErrorResponseModel(BaseModel):
|
10 |
detail: List[Dict[str, Any]]
|
11 |
|
12 |
+
|
13 |
class SuccessResponse(BaseModel):
|
14 |
status: str
|
15 |
randydev: Dict[str, Any]
|
16 |
|
17 |
+
|
18 |
class ErrorResponse(BaseModel):
|
19 |
status: str
|
20 |
detail: str
|
21 |
|
22 |
+
|
23 |
class ErrorStatus(BaseModel):
|
24 |
status: str
|
25 |
message: str
|
26 |
|
27 |
+
|
28 |
class ProfileClone(BaseModel):
|
29 |
user_id: int
|
30 |
first_name: Optional[str] = None
|
|
|
32 |
profile_id: Optional[str] = None
|
33 |
bio: Optional[str] = None
|
34 |
|
35 |
+
|
36 |
class GetProfileClone(BaseModel):
|
37 |
user_id: int
|
38 |
|
39 |
+
|
40 |
class SibylSystemDel(BaseModel):
|
41 |
user_id: int
|
42 |
|
43 |
+
|
44 |
class SibylSystemBan(BaseModel):
|
45 |
user_id: int
|
46 |
reason: str
|
47 |
|
48 |
+
|
49 |
class RyuzakiAi(BaseModel):
|
50 |
text: str
|
51 |
|
52 |
+
|
53 |
class SibylSystem(BaseModel):
|
54 |
user_id: int
|
55 |
|
56 |
+
|
57 |
class SibylSystemResponse(BaseModel):
|
58 |
sibyl_name: str
|
59 |
reason: str
|
|
|
61 |
date_joined: str
|
62 |
sibyl_user_id: int
|
63 |
|
64 |
+
|
65 |
class GoogleReverse(BaseModel):
|
66 |
+
engine: str = "google_reverse_image"
|
67 |
image_url: str
|
68 |
+
language: str = "en"
|
69 |
+
google_lang: str = "us"
|
70 |
+
|
71 |
|
72 |
class GetImageUnsplash(BaseModel):
|
73 |
query: str
|
74 |
+
size: str = "500x500"
|
75 |
+
|
76 |
|
77 |
class OrcSpaceUrl(BaseModel):
|
78 |
url: str
|
79 |
+
overlay: bool = False
|
80 |
+
language: str = "eng"
|
81 |
+
|
82 |
|
83 |
class ChatgptModel(BaseModel):
|
84 |
query: str
|
85 |
model_id: Optional[int] = None
|
86 |
+
is_models: bool = False
|
87 |
+
|
88 |
|
89 |
class ChatgptCustom(BaseModel):
|
90 |
query: str
|
91 |
|
92 |
+
|
93 |
class GeminiPro(BaseModel):
|
94 |
query: str
|
95 |
bard_api_key: Optional[str] = None
|
|
|
100 |
is_login: Optional[bool] = False
|
101 |
is_multi_chat: Optional[bool] = False
|
102 |
|
103 |
+
|
104 |
class GeminiOracle(BaseModel):
|
105 |
query: str
|
106 |
bard_api_key: Optional[str] = None
|
|
|
112 |
is_login: Optional[bool] = False
|
113 |
is_multi_chat: Optional[bool] = False
|
114 |
|
115 |
+
|
116 |
class WaifuPics(BaseModel):
|
117 |
+
types: str = "sfw"
|
118 |
+
category: str = "neko"
|
119 |
media_type: Optional[str] = None
|
120 |
+
is_bytes: bool = False
|
121 |
+
|
122 |
|
123 |
class MakeRayso(BaseModel):
|
124 |
code: str
|
125 |
+
title: str = "Ryuzaki Dev"
|
126 |
theme: str
|
127 |
+
setlang: str = "en"
|
128 |
auto_translate: Optional[bool] = None
|
129 |
+
ryuzaki_dark: bool = True
|
130 |
+
|
131 |
|
132 |
class Webshot(BaseModel):
|
133 |
url: str
|
134 |
+
quality: str = "1920x1080"
|
135 |
+
type_mine: str = "JPEG"
|
136 |
+
pixels: str = "1024"
|
137 |
+
cast: str = "Z100"
|
138 |
+
|
139 |
|
140 |
class GithubUsernames(BaseModel):
|
141 |
username: str
|
142 |
|
143 |
+
|
144 |
class ChatBots(BaseModel):
|
145 |
query: str
|
146 |
user_id: Optional[int] = None
|
147 |
bot_name: Optional[str] = None
|
148 |
bot_username: Optional[str] = None
|
149 |
|
150 |
+
|
151 |
class NewMonitor(BaseModel):
|
152 |
+
type: int = 1
|
153 |
url: str
|
154 |
friendly_name: str
|
155 |
|
156 |
+
|
157 |
class TiktokBeta(BaseModel):
|
158 |
tiktok_url: str
|
159 |
only_video: Optional[bool] = None
|
160 |
|
161 |
+
|
162 |
class TiktokDownloader(BaseModel):
|
163 |
tiktok_url: str
|
164 |
|
165 |
+
|
166 |
class GetMonitorLogs(BaseModel):
|
167 |
logs: int
|
168 |
|
169 |
+
|
170 |
class DownloadLink(BaseModel):
|
171 |
link: str
|
172 |
|
173 |
+
|
174 |
class OpenDalle(BaseModel):
|
175 |
query: str
|
176 |
|
177 |
+
|
178 |
class Dalle3XL(BaseModel):
|
179 |
query: str
|
180 |
|
181 |
+
|
182 |
class TranslateCustom(BaseModel):
|
183 |
text: str
|
184 |
setlang: str
|
185 |
|
186 |
+
|
187 |
class AnimeStyled(BaseModel):
|
188 |
query: str
|
189 |
|
190 |
+
|
191 |
class OpenaiTexts(BaseModel):
|
192 |
query: str
|
193 |
api_key: Optional[str] = ""
|
194 |
model: Optional[str] = "gpt-4"
|
195 |
is_stream: Optional[bool] = False
|
196 |
|
197 |
+
|
198 |
class Chatgpt3Texts(BaseModel):
|
199 |
query: str
|
200 |
api_key: Optional[str] = ""
|
|
|
202 |
is_stream: Optional[bool] = False
|
203 |
is_openai_original: Optional[bool] = False
|
204 |
|
205 |
+
|
206 |
class TextCustom(BaseModel):
|
207 |
query: str
|
208 |
|
209 |
+
|
210 |
class Picsart(BaseModel):
|
211 |
+
image_path: str
|
templates/config.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
TITLE="title template"
|
2 |
-
DESCRIPTION="description template"
|
3 |
-
VERSION="0.0.1"
|
4 |
-
TERMS_OF_SERVICE="terms template"
|
5 |
-
DOCS_URL="/"
|
6 |
-
API_KEYS=""
|
7 |
-
TELEGRAM_ID=0
|
|
|
1 |
+
TITLE = "title template"
|
2 |
+
DESCRIPTION = "description template"
|
3 |
+
VERSION = "0.0.1"
|
4 |
+
TERMS_OF_SERVICE = "terms template"
|
5 |
+
DOCS_URL = "/"
|
6 |
+
API_KEYS = "" # get api key from @randydev_bot use /token_api_key
|
7 |
+
TELEGRAM_ID = 0
|
templates/main.py
CHANGED
@@ -17,49 +17,10 @@
|
|
17 |
# You should have received a copy of the GNU Affero General Public License
|
18 |
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
19 |
|
20 |
-
import requests
|
21 |
-
import json
|
22 |
-
import base64
|
23 |
-
import re
|
24 |
import uvicorn
|
25 |
-
import
|
26 |
-
import shutil
|
27 |
-
import random
|
28 |
-
import g4f
|
29 |
-
import tempfile
|
30 |
-
import io
|
31 |
-
from io import BytesIO
|
32 |
-
from datetime import datetime as dt
|
33 |
-
from dotenv import load_dotenv
|
34 |
-
from bs4 import BeautifulSoup
|
35 |
-
|
36 |
-
from typing import Union
|
37 |
-
from typing_extensions import Annotated
|
38 |
-
from typing import Annotated, Union
|
39 |
-
|
40 |
-
from pydantic import BaseModel
|
41 |
-
from base64 import b64decode as kc
|
42 |
-
from base64 import b64decode
|
43 |
-
from random import choice
|
44 |
-
from gpytranslate import SyncTranslator
|
45 |
-
from httpx import AsyncClient
|
46 |
-
from telegraph import Telegraph, upload_file
|
47 |
-
from pathlib import Path
|
48 |
-
from serpapi import GoogleSearch
|
49 |
-
|
50 |
-
from fastapi import FastAPI, UploadFile, File
|
51 |
-
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
|
52 |
-
from fastapi import Depends, FastAPI, HTTPException, status
|
53 |
-
from fastapi.responses import StreamingResponse
|
54 |
-
from fastapi import HTTPException
|
55 |
-
from fastapi import FastAPI, Request, Header
|
56 |
-
from fastapi import Body, Query
|
57 |
-
from fastapi.staticfiles import StaticFiles
|
58 |
-
from fastapi.templating import Jinja2Templates
|
59 |
-
from fastapi.responses import FileResponse
|
60 |
|
61 |
from templates.config import *
|
62 |
-
from RyuzakiLib.spamwatch.clients import SibylBan
|
63 |
|
64 |
logging.basicConfig(level=logging.ERROR)
|
65 |
|
@@ -68,27 +29,32 @@ app = FastAPI(
|
|
68 |
description=DESCRIPTION,
|
69 |
version=VERSION,
|
70 |
terms_of_service=TERMS_OF_SERVICE,
|
71 |
-
docs_url=DOCS_URL
|
72 |
)
|
73 |
|
|
|
74 |
@app.get("/test")
|
75 |
def hello_world():
|
76 |
return {"message": "hello world"}
|
77 |
|
|
|
78 |
@app.get("/ryuzaki/blacklist-words")
|
79 |
def blacklist_words():
|
80 |
try:
|
81 |
BLACKLIST_WORDS = BadWordsList()
|
82 |
-
results_all = BLACKLIST_WORDS.banned_by_google(
|
|
|
|
|
83 |
return {"status": "true", "results": results_all}
|
84 |
except Exception as e:
|
85 |
return {"status": "false", "message": f"Internal server error: {str(e)}"}
|
86 |
|
|
|
87 |
@app.post("/ryuzaki/sibylban")
|
88 |
def sibyl_system_ban(
|
89 |
user_id: int = Query(..., description="User ID in query parameter"),
|
90 |
reason: str = Query(..., description="Reason in query parameter"),
|
91 |
-
api_key: str = Query(..., description="Api key in query parameter")
|
92 |
):
|
93 |
if user_id != TELEGRAM_ID:
|
94 |
return {"status": "false", "message": "Only Developer"}
|
@@ -101,15 +67,11 @@ def sibyl_system_ban(
|
|
101 |
return {"status": "false", "message": "User is already banned"}
|
102 |
|
103 |
response_str = clients.add_ban(user_id=user_id, reason=reason, is_banned=True)
|
104 |
-
return {
|
105 |
-
"status": "true",
|
106 |
-
"results": {
|
107 |
-
"message": response_str
|
108 |
-
}
|
109 |
-
}
|
110 |
except Exception as e:
|
111 |
logging.error(f"Error in sibyl_system_ban: {e}")
|
112 |
return {"status": "false", "message": "Internal server error"}
|
113 |
|
|
|
114 |
if __name__ == "__main__":
|
115 |
uvicorn.run(app, host="0.0.0.0")
|
|
|
17 |
# You should have received a copy of the GNU Affero General Public License
|
18 |
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
19 |
|
|
|
|
|
|
|
|
|
20 |
import uvicorn
|
21 |
+
from fastapi import FastAPI, Query
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
from templates.config import *
|
|
|
24 |
|
25 |
logging.basicConfig(level=logging.ERROR)
|
26 |
|
|
|
29 |
description=DESCRIPTION,
|
30 |
version=VERSION,
|
31 |
terms_of_service=TERMS_OF_SERVICE,
|
32 |
+
docs_url=DOCS_URL,
|
33 |
)
|
34 |
|
35 |
+
|
36 |
@app.get("/test")
|
37 |
def hello_world():
|
38 |
return {"message": "hello world"}
|
39 |
|
40 |
+
|
41 |
@app.get("/ryuzaki/blacklist-words")
|
42 |
def blacklist_words():
|
43 |
try:
|
44 |
BLACKLIST_WORDS = BadWordsList()
|
45 |
+
results_all = BLACKLIST_WORDS.banned_by_google(
|
46 |
+
file_txt="banned_by_google.txt", storage=True
|
47 |
+
)
|
48 |
return {"status": "true", "results": results_all}
|
49 |
except Exception as e:
|
50 |
return {"status": "false", "message": f"Internal server error: {str(e)}"}
|
51 |
|
52 |
+
|
53 |
@app.post("/ryuzaki/sibylban")
|
54 |
def sibyl_system_ban(
|
55 |
user_id: int = Query(..., description="User ID in query parameter"),
|
56 |
reason: str = Query(..., description="Reason in query parameter"),
|
57 |
+
api_key: str = Query(..., description="Api key in query parameter"),
|
58 |
):
|
59 |
if user_id != TELEGRAM_ID:
|
60 |
return {"status": "false", "message": "Only Developer"}
|
|
|
67 |
return {"status": "false", "message": "User is already banned"}
|
68 |
|
69 |
response_str = clients.add_ban(user_id=user_id, reason=reason, is_banned=True)
|
70 |
+
return {"status": "true", "results": {"message": response_str}}
|
|
|
|
|
|
|
|
|
|
|
71 |
except Exception as e:
|
72 |
logging.error(f"Error in sibyl_system_ban: {e}")
|
73 |
return {"status": "false", "message": "Internal server error"}
|
74 |
|
75 |
+
|
76 |
if __name__ == "__main__":
|
77 |
uvicorn.run(app, host="0.0.0.0")
|