randydev commited on
Commit
eb70033
·
verified ·
1 Parent(s): f979266

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +12 -0
main.py CHANGED
@@ -5,6 +5,7 @@ from bs4 import BeautifulSoup
5
  from contextlib import asynccontextmanager
6
  from akenoai import AkenoXToJs as js
7
  from akenoai.runner import run_fast
 
8
  from config import API_ID, API_HASH, BOT_TOKEN, SESSION
9
  from pyrogram.enums import ChatMembersFilter
10
 
@@ -13,6 +14,17 @@ LOGS = logging.getLogger("[akenox]")
13
  logger.setLevel(logging.DEBUG)
14
 
15
  fast_app = js.get_app()
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  client = js.create_pyrogram(
18
  name="fastapi-bot",
 
5
  from contextlib import asynccontextmanager
6
  from akenoai import AkenoXToJs as js
7
  from akenoai.runner import run_fast
8
+ from fastapi.middleware.cors import CORSMiddleware
9
  from config import API_ID, API_HASH, BOT_TOKEN, SESSION
10
  from pyrogram.enums import ChatMembersFilter
11
 
 
14
  logger.setLevel(logging.DEBUG)
15
 
16
  fast_app = js.get_app()
17
+ fast_app.add_middleware(
18
+ CORSMiddleware,
19
+ allow_origins=["*"],
20
+ allow_credentials=True,
21
+ allow_methods=["*"],
22
+ allow_headers=["*"],
23
+ )
24
+
25
+ @app.get("/")
26
+ async def root():
27
+ return {"message": "Hello, World!"}
28
 
29
  client = js.create_pyrogram(
30
  name="fastapi-bot",