randydev commited on
Commit
0559244
·
verified ·
1 Parent(s): 689a002

Update src/main.py

Browse files
Files changed (1) hide show
  1. src/main.py +8 -7
src/main.py CHANGED
@@ -16,6 +16,8 @@ from pyrogram.errors import *
16
 
17
  from config import API_ID, API_HASH, BOT_TOKEN, SESSION
18
 
 
 
19
  logger = logging.getLogger(__name__)
20
  LOGS = logging.getLogger("[akenox]")
21
  logger.setLevel(logging.DEBUG)
@@ -29,7 +31,6 @@ import uvloop
29
  uvloop.install()
30
 
31
  # from src.combo import router as combo_router
32
- from src.catergory import router as catergory_router
33
  # from src.recent_torrents import router as recent_torrents_router
34
  # from src.search_torrent_url import router as search_torrent_url_router
35
  # from src.search_torrents import router as search_torrents_router
@@ -47,7 +48,7 @@ fast_app.include_router(catergory_router)
47
  # fast_app.include_router(trending_torrents_router)
48
 
49
 
50
- client = create_pyrogram(
51
  name="fastapi-bot",
52
  api_id=API_ID,
53
  api_hash=API_HASH,
@@ -94,7 +95,7 @@ async def upload_to_catbox(dl_path: str) -> str:
94
 
95
  @fast_app.on_event("startup")
96
  async def startup_event():
97
- user = await client.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}")
@@ -103,8 +104,8 @@ async def startup_event():
103
  async def user_status_ban(username: str = None):
104
  username_ch = "RendyProjects"
105
  try:
106
- mention_user = await client.get_users(username)
107
- user = await client.get_chat_member(username_ch, username)
108
  if user.status == ChatMemberStatus.BANNED:
109
  return {
110
  "message": f"❌ you {mention_user.first_name} have been blocked from the RendyProjects",
@@ -183,7 +184,7 @@ async def get_author_chat_admin(username: str = None):
183
  async def get_chat_raw(username: str = None):
184
  try:
185
  user_id = None
186
- chat_raw = (await client.get_chat(username)).raw
187
  ok = await user_client.get_chat(username)
188
  if ok.pinned_message.from_user:
189
  user_id = ok.pinned_message.from_user.id if ok.pinned_message.from_user else None
@@ -256,7 +257,7 @@ async def get_chat_raw(username: str = None):
256
  @fast_app.get("/user/get_user")
257
  async def get_user(user_id=None):
258
  try:
259
- get_users = await client.get_users(user_id)
260
  response = await js.get_creation_date(
261
  user_id=get_users.id
262
  )
 
16
 
17
  from config import API_ID, API_HASH, BOT_TOKEN, SESSION
18
 
19
+ from src.catergory import router as catergory_router
20
+
21
  logger = logging.getLogger(__name__)
22
  LOGS = logging.getLogger("[akenox]")
23
  logger.setLevel(logging.DEBUG)
 
31
  uvloop.install()
32
 
33
  # from src.combo import router as combo_router
 
34
  # from src.recent_torrents import router as recent_torrents_router
35
  # from src.search_torrent_url import router as search_torrent_url_router
36
  # from src.search_torrents import router as search_torrents_router
 
48
  # fast_app.include_router(trending_torrents_router)
49
 
50
 
51
+ bot = create_pyrogram(
52
  name="fastapi-bot",
53
  api_id=API_ID,
54
  api_hash=API_HASH,
 
95
 
96
  @fast_app.on_event("startup")
97
  async def startup_event():
98
+ user = await bot.start()
99
  userbot = await user_client.start()
100
  LOGS.info(f"Started Bot: {user.me.first_name}")
101
  LOGS.info(f"Started UserBot: {userbot.me.first_name}")
 
104
  async def user_status_ban(username: str = None):
105
  username_ch = "RendyProjects"
106
  try:
107
+ mention_user = await bot.get_users(username)
108
+ user = await bot.get_chat_member(username_ch, username)
109
  if user.status == ChatMemberStatus.BANNED:
110
  return {
111
  "message": f"❌ you {mention_user.first_name} have been blocked from the RendyProjects",
 
184
  async def get_chat_raw(username: str = None):
185
  try:
186
  user_id = None
187
+ chat_raw = (await bot.get_chat(username)).raw
188
  ok = await user_client.get_chat(username)
189
  if ok.pinned_message.from_user:
190
  user_id = ok.pinned_message.from_user.id if ok.pinned_message.from_user else None
 
257
  @fast_app.get("/user/get_user")
258
  async def get_user(user_id=None):
259
  try:
260
+ get_users = await bot.get_users(user_id)
261
  response = await js.get_creation_date(
262
  user_id=get_users.id
263
  )