randydev commited on
Commit
f4176dd
·
verified ·
1 Parent(s): 851e695

Rename src/main.py to main.py

Browse files
Files changed (1) hide show
  1. src/main.py → main.py +12 -12
src/main.py → main.py RENAMED
@@ -22,7 +22,7 @@ LOGS = logging.getLogger("[akenox]")
22
  logger.setLevel(logging.DEBUG)
23
 
24
  js = AkenoXToJs()
25
- app = js.get_app()
26
  js.add_cors_middleware()
27
 
28
  import uvloop
@@ -38,7 +38,7 @@ uvloop.install()
38
 
39
  # torrent router
40
  # fast_app.include_router(combo_router)
41
- app.include_router(catergory_router)
42
  # fast_app.include_router(recent_torrents_router)
43
  # fast_app.include_router(search_torrent_url_router)
44
  # fast_app.include_router(search_torrents_router)
@@ -92,14 +92,14 @@ async def upload_to_catbox(dl_path: str) -> str:
92
  response.raise_for_status()
93
  return (await response.text()).strip()
94
 
95
- @app.on_event("startup")
96
  async def startup_event():
97
  user = await bot.start()
98
  userbot = await user_client.start()
99
  LOGS.info(f"Started Bot: {user.me.first_name}")
100
  LOGS.info(f"Started UserBot: {userbot.me.first_name}")
101
 
102
- @app.get("/user/status/ban")
103
  async def user_status_ban(username: str = None):
104
  username_ch = "RendyProjects"
105
  try:
@@ -124,7 +124,7 @@ async def user_status_ban(username: str = None):
124
  async def hello():
125
  return {"success": "hello world!"}
126
 
127
- @app.get("/user/get_story")
128
  async def get_user_story(link: str = None):
129
  username, random_id = get_random_from_channel(link)
130
  try:
@@ -154,7 +154,7 @@ async def get_user_story(link: str = None):
154
  "caption": None
155
  }
156
 
157
- @app.get("/user/media-dl/file_id")
158
  async def get_download_media_file(file_id: str = None):
159
  try:
160
  image_path = await user_client.download_media(file_id)
@@ -166,7 +166,7 @@ async def get_download_media_file(file_id: str = None):
166
  "download": base64_image,
167
  }
168
 
169
- @app.get("/user/author/admin")
170
  async def get_author_chat_admin(username: str = None):
171
  same_user = {}
172
  async for m in user_client.get_chat_members(username, filter=ChatMembersFilter.ADMINISTRATORS):
@@ -179,7 +179,7 @@ async def get_author_chat_admin(username: str = None):
179
  "admin_list": same_user
180
  }
181
 
182
- @app.get("/user/raw/getchat")
183
  async def get_chat_raw(username: str = None):
184
  try:
185
  user_id = None
@@ -253,7 +253,7 @@ async def get_chat_raw(username: str = None):
253
  },
254
  }
255
 
256
- @app.get("/user/get_user")
257
  async def get_user(user_id=None):
258
  try:
259
  get_users = await bot.get_users(user_id)
@@ -296,12 +296,12 @@ async def get_user(user_id=None):
296
  }
297
 
298
  js.custom_openapi(
299
- app=app,
300
  title="AkenoX Beta AI API",
301
  version="1.0.0",
302
  summary="Use It Only For Personal Project",
303
  description="Free API By akenoai-lib",
304
- routes=app.routes,
305
  )
306
 
307
- # run_fast(build=fast_app, port=7860)
 
22
  logger.setLevel(logging.DEBUG)
23
 
24
  js = AkenoXToJs()
25
+ fast_app = js.get_app()
26
  js.add_cors_middleware()
27
 
28
  import uvloop
 
38
 
39
  # torrent router
40
  # fast_app.include_router(combo_router)
41
+ fast_app.include_router(catergory_router)
42
  # fast_app.include_router(recent_torrents_router)
43
  # fast_app.include_router(search_torrent_url_router)
44
  # fast_app.include_router(search_torrents_router)
 
92
  response.raise_for_status()
93
  return (await response.text()).strip()
94
 
95
+ @fast_app.on_event("startup")
96
  async def startup_event():
97
  user = await bot.start()
98
  userbot = await user_client.start()
99
  LOGS.info(f"Started Bot: {user.me.first_name}")
100
  LOGS.info(f"Started UserBot: {userbot.me.first_name}")
101
 
102
+ @fast_app.get("/user/status/ban")
103
  async def user_status_ban(username: str = None):
104
  username_ch = "RendyProjects"
105
  try:
 
124
  async def hello():
125
  return {"success": "hello world!"}
126
 
127
+ @fast_app.get("/user/get_story")
128
  async def get_user_story(link: str = None):
129
  username, random_id = get_random_from_channel(link)
130
  try:
 
154
  "caption": None
155
  }
156
 
157
+ @fast_app.get("/user/media-dl/file_id")
158
  async def get_download_media_file(file_id: str = None):
159
  try:
160
  image_path = await user_client.download_media(file_id)
 
166
  "download": base64_image,
167
  }
168
 
169
+ @fast_app.get("/user/author/admin")
170
  async def get_author_chat_admin(username: str = None):
171
  same_user = {}
172
  async for m in user_client.get_chat_members(username, filter=ChatMembersFilter.ADMINISTRATORS):
 
179
  "admin_list": same_user
180
  }
181
 
182
+ @fast_app.get("/user/raw/getchat")
183
  async def get_chat_raw(username: str = None):
184
  try:
185
  user_id = None
 
253
  },
254
  }
255
 
256
+ @fast_app.get("/user/get_user")
257
  async def get_user(user_id=None):
258
  try:
259
  get_users = await bot.get_users(user_id)
 
296
  }
297
 
298
  js.custom_openapi(
299
+ app=fast_app,
300
  title="AkenoX Beta AI API",
301
  version="1.0.0",
302
  summary="Use It Only For Personal Project",
303
  description="Free API By akenoai-lib",
304
+ routes=fast_app.routes,
305
  )
306
 
307
+ run_fast(build=fast_app, port=7860)