TheHamkerCat hace 5 años
padre
commit
4ecee05b77
Se han modificado 4 ficheros con 8 adiciones y 87 borrados
  1. 0 7
      docker-compose.yaml
  2. 0 76
      wbb/modules/advanced.py
  3. 7 4
      wbb/modules/global_stats.py
  4. 1 0
      wbb/utils/botinfo.py

+ 0 - 7
docker-compose.yaml

@@ -1,7 +0,0 @@
-version: '3.1'
-
-services:
-  app:
-    build: .
-    volumes:
-      - ./:/app

+ 0 - 76
wbb/modules/advanced.py

@@ -1,76 +0,0 @@
-from wbb import app, LOG_GROUP_ID
-from wbb.utils.json_prettify import json_object_prettify
-from wbb.utils.errors import capture_err
-from pyrogram.errors.exceptions.bad_request_400 import ChannelInvalid, PeerIdInvalid
-from pyrogram import filters
-
-
-__MODULE__ = "Advanced"
-__HELP__ = """**NOTE** - Some of these commands are only supported in BOT_LOG_GROUP [OWNER]
-/get_chat [CHAT_ID] - Get Info of A Chat.
-/get_user [USER_ID] - Get Info of A User.
-/leave_chat [CHAT_ID] - Leave The Chat.
-/send_message [CHAT_ID] [TEXT] - Send A Message To A Chat."""
-
-
-@app.on_message(filters.command("get_chat") & ~filters.edited)
-@capture_err
-async def get_chat_data(_, message):
-    if len(message.command) != 2:
-        await message.reply_text("/get_chat [CHAT_ID]")
-        return
-    try:
-        chat_id = message.text.split(None, 1)[1]
-        chat_data = await app.get_chat(chat_id)
-        data = await json_object_prettify(chat_data)
-        await app.send_message(message.chat.id, data)
-    except (PeerIdInvalid, ChannelInvalid) as e:
-        await message.reply_text("PEER_ID_INVALID")
-        print(str(e))
-
-
-@app.on_message(filters.command("get_user") & ~filters.edited)
-@capture_err
-async def get_user_data(_, message):
-    if len(message.command) != 2:
-        await message.reply_text("/get_user [USER_ID]")
-        return
-    try:
-        user_id = message.text.split(None, 1)[1]
-        user_data = await app.get_users(user_id)
-        data = await json_object_prettify(user_data)
-        await app.send_message(message.chat.id, data)
-    except (PeerIdInvalid, ChannelInvalid) as e:
-        await message.reply_text("PEER_ID_INVALID")
-        print(str(e))
-
-
-@app.on_message(filters.command("leave_chat") & ~filters.edited & filters.chat(LOG_GROUP_ID))
-@capture_err
-async def leave_chat(_, message):
-    if len(message.command) != 2:
-        await message.reply_text("/leave_chat [CHAT_ID]")
-        return
-    try:
-        chat_id = message.text.split(None, 1)[1]
-        await app.leave_chat(chat_id)
-        await message.reply_text("Left The Chat!")
-    except Exception as e:
-        await message.reply_text(str(e))
-        print(str(e))
-
-
-@app.on_message(filters.command("send_message") & ~filters.edited & filters.chat(LOG_GROUP_ID))
-@capture_err
-async def send_message(_, message):
-    if len(message.command) < 3:
-        await message.reply_text("/send_message [CHAT_ID] [TEXT]")
-        return
-    try:
-        chat_id = message.text.split(None, 2)[1]
-        text = message.text.split(None, 2)[2]
-        await app.send_message(chat_id, text=text)
-        await message.reply_text("Message Sent!")
-    except Exception as e:
-        await message.reply_text(str(e))
-        print(str(e))

+ 7 - 4
wbb/modules/global_stats.py

@@ -36,7 +36,7 @@ async def chat_watcher(_, message):
 async def global_stats(_, message):
     m = await app.send_message(
         message.chat.id,
-        text="__**Analysing Stats, Might Take 5-10 Minutes.**__",
+        text="__**Analysing Stats**__",
         disable_web_page_preview=True
     )
 
@@ -46,17 +46,21 @@ async def global_stats(_, message):
     chats = await get_served_chats()
     for chat in chats:
         served_chats.append(int(chat["chat_id"]))
+    await m.edit(
+            f"__**Analysing Stats Might Take {len(served_chats)*6}+ Seconds.**__",
+            disable_web_page_preview=True
+            )
     for served_chat in served_chats:
         try:
             await app.get_chat_members(served_chat, BOT_ID)
-            await asyncio.sleep(2)
+            await asyncio.sleep(3)
         except Exception as e:
-            print(f"{e} - {served_chat} in global_stats.py")
             await remove_served_chat(served_chat)
             served_chats.remove(served_chat)
             pass
     for i in served_chats:
         mc = (await app.get_chat(i)).members_count
+        await asyncio.sleep(3)
         total_users += int(mc)
 
     # Gbans count
@@ -94,7 +98,6 @@ async def global_stats(_, message):
     modules_count = len(ALL_MODULES)
 
     msg = f"""
-
 **Global Stats of {BOT_NAME}**:
 **{modules_count}** Modules Loaded
 **{gbans}** Globally banned users.

+ 1 - 0
wbb/utils/botinfo.py

@@ -10,6 +10,7 @@ USERBOT_DC_ID = 0
 
 async def get_info(app):
     global BOT_ID, BOT_NAME, BOT_USERNAME, BOT_DC_ID
+    global USERBOT_ID, USERBOT_NAME, USERBOT_USERNAME, USERBOT_DC_ID
     getme = await app.get_me()
     getme2 = await app2.get_me()
     BOT_ID = getme.id