TheHamkerCat 5 gadi atpakaļ
vecāks
revīzija
6203171337

+ 1 - 2
wbb/__init__.py

@@ -10,7 +10,7 @@ from Python_ARQ import ARQ
 import time
 
 SUDOERS = SUDO_USERS_ID
-
+MAIN_CHATS = MAIN_CHATS
 GBAN_LOG_GROUP_ID = GBAN_LOG_GROUP_ID
 FERNET_ENCRYPTION_KEY = FERNET_ENCRYPTION_KEY
 WELCOME_DELAY_KICK_SEC = WELCOME_DELAY_KICK_SEC
@@ -22,7 +22,6 @@ mongo_client = MongoClient(MONGO_DB_URI)
 db = mongo_client.wbb
 
 
-
 app2 = Client(
     "userbot",
     phone_number=PHONE_NUMBER,

+ 2 - 1
wbb/__main__.py

@@ -4,7 +4,7 @@ import importlib
 import uvloop
 from pyrogram import filters, idle
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
-from wbb import app, app2, BOT_NAME, BOT_USERNAME
+from wbb import app, BOT_NAME, BOT_USERNAME
 from wbb.utils import paginate_modules
 from wbb.modules.sudoers import bot_sys_stats
 from wbb.modules import ALL_MODULES
@@ -47,6 +47,7 @@ async def start_bot():
     print("Bot Started Successfully as {}!".format(BOT_NAME))
     await idle()
 
+
 @app.on_message(filters.command(["help", "start"]))
 async def help_command(_, message):
     if message.chat.type != "private":

+ 5 - 5
wbb/modules/admin.py

@@ -126,7 +126,7 @@ async def kick(_, message):
                 await message.chat.kick_member(username)
                 await asyncio.sleep(2)
                 await message.chat.unban_member(username)
-                await message.reply_text(f"Kicked")
+                await message.reply_text("Kicked")
         elif len(message.command) == 1 and message.reply_to_message:
             user_id = message.reply_to_message.from_user.id
             if user_id in SUDOERS:
@@ -161,7 +161,7 @@ async def ban(_, message):
                 await message.reply_text("You Wanna Ban The Elevated One?")
             else:
                 await message.chat.kick_member(username)
-                await message.reply_text(f"Banned!")
+                await message.reply_text("Banned!")
 
         elif len(message.command) == 1 and message.reply_to_message:
             user_id = message.reply_to_message.from_user.id
@@ -192,7 +192,7 @@ async def unban(_, message):
         if len(message.command) == 2:
             username = message.text.split(None, 1)[1]
             await message.chat.unban_member(username)
-            await message.reply_text(f"Unbanned!")
+            await message.reply_text("Unbanned!")
         elif len(message.command) == 1 and message.reply_to_message:
             user_id = message.reply_to_message.from_user.id
             await message.chat.unban_member(user_id)
@@ -317,7 +317,7 @@ async def mute(_, message):
                     user_id,
                     permissions=ChatPermissions()
                 )
-                await message.reply_text(f"Muted!")
+                await message.reply_text("Muted!")
 
         elif len(message.command) == 1 and message.reply_to_message:
             user_id = message.reply_to_message.from_user.id
@@ -350,7 +350,7 @@ async def unmute(_, message):
         if len(message.command) == 2:
             username = message.text.split(None, 1)[1]
             await message.chat.unban_member(username)
-            await message.reply_text(f"Unmuted!")
+            await message.reply_text("Unmuted!")
         elif len(message.command) == 1 and message.reply_to_message:
             user_id = message.reply_to_message.from_user.id
             await message.chat.unban_member(user_id)

+ 2 - 2
wbb/modules/global_stats.py

@@ -18,6 +18,7 @@ from pyrogram import filters
 
 import asyncio
 
+
 @app.on_message(filters.text, group=global_stats_group)
 @capture_err
 async def chat_watcher(_, message):
@@ -54,7 +55,7 @@ async def global_stats(_, message):
         try:
             await app.get_chat_members(served_chat, BOT_ID)
             await asyncio.sleep(3)
-        except Exception as e:
+        except Exception:
             await remove_served_chat(served_chat)
             served_chats.remove(served_chat)
             pass
@@ -66,7 +67,6 @@ async def global_stats(_, message):
             await remove_served_chat(served_chat)
             pass
         await asyncio.sleep(3)
-        
 
     # Gbans count
     gbans = await get_gbans_count()

+ 2 - 3
wbb/modules/greetings.py

@@ -18,7 +18,7 @@ from pyrogram.types import (
 from pyrogram.errors.exceptions.bad_request_400 import UserNotParticipant, ChatAdminRequired
 from pyrogram import emoji
 from pyrogram import filters
-from random import randint, shuffle
+from random import shuffle
 from datetime import datetime
 
 __MODULE__ = "Captcha"
@@ -83,7 +83,7 @@ async def callback_query_welcome_button(client, callback_query):
     pending_user = await app.get_users(int(data.split(None, 2)[2]))
     pressed_user_id = callback_query.from_user.id
     pending_user_id = pending_user.id
-    button_message = callback_query.message 
+    button_message = callback_query.message
     answer = data.split(None, 2)[1]
     if pending_user_id == pressed_user_id:
         if answer != emoji.CHECK_MARK_BUTTON:
@@ -180,4 +180,3 @@ async def captcha_state(_, message):
         await message.reply_text("Disabled Captcha For New Users.")
     else:
         await message.reply_text(usage)
-

+ 2 - 2
wbb/modules/inline.py

@@ -1,4 +1,3 @@
-import sys
 from wbb import app
 from wbb.utils.inlinefuncs import (
         google_search_func, urban_func, translate_func,
@@ -18,6 +17,7 @@ bitly [URL] - Shorten A Link"""
 
 """ Inspiration From https://github.com/pokurt/Nana-Remix/blob/master/nana/plugins/assistant/inline_mod/alive.py """
 
+
 @app.on_message(filters.command("inline"))
 async def inline_help(_, message):
     await app.send_message(message.chat.id, text=__HELP__)
@@ -85,5 +85,5 @@ async def inline_query_handler(client, query):
                 cache_time=2
             )
 
-    except (IndexError, TypeError) as e:
+    except (IndexError, TypeError):
         return

+ 0 - 3
wbb/modules/paste.py

@@ -1,11 +1,8 @@
 import os
-import aiofiles
 from pyrogram import filters
 from wbb.utils.pastebin import paste
 from wbb import app
 from wbb.utils.errors import capture_err
-from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, InputMediaPhoto
-from random import randint
 
 __MODULE__ = "Paste"
 __HELP__ = "/paste - To Paste Replied Text Or Document To Nekobin"

+ 7 - 6
wbb/modules/sudoers.py

@@ -7,9 +7,9 @@ import psutil
 import asyncio
 from sys import version as pyver
 from wbb import (
-        app, SUDOERS, bot_start_time, BOT_ID,
-        USERBOT_USERNAME, GBAN_LOG_GROUP_ID
-        )
+    app, SUDOERS, bot_start_time, BOT_ID,
+    USERBOT_USERNAME, GBAN_LOG_GROUP_ID
+)
 from wbb.utils import formatter
 from wbb.utils.errors import capture_err
 from wbb.utils.dbfunctions import (
@@ -132,7 +132,7 @@ __**New Global Ban**__
 **Banned User:** {user.mention}
 **Banned User ID:** `{user.id}`
 **Reason:** __{reason}__
-**Chats: `{number_of_chats}`"""
+**Chats:** `{number_of_chats}`"""
             try:
                 await app.send_message(GBAN_LOG_GROUP_ID, text=ban_text)
             except Exception:
@@ -183,7 +183,7 @@ __**New Global Ban**__
 **Banned User:** {user.mention}
 **Banned User ID:** `{user.id}`
 **Reason:** __{reason}__
-**Chats: `{number_of_chats}`"""
+**Chats:** `{number_of_chats}`"""
             try:
                 await app.send_message(GBAN_LOG_GROUP_ID, text=ban_text)
             except Exception:
@@ -271,4 +271,5 @@ async def broadcast_message(_, message):
 @app.on_message(filters.command("update") & filters.user(SUDOERS))
 async def update_restart(_, message):
     await message.reply_text(f'```{subprocess.check_output(["git", "pull"]).decode("UTF-8")}```')
-    os.execvp(f"python{str(pyver.split(' ')[0])[:3]}", [f"python{str(pyver.split(' ')[0])[:3]}", "-m", "wbb"])
+    os.execvp(f"python{str(pyver.split(' ')[0])[:3]}", [
+              f"python{str(pyver.split(' ')[0])[:3]}", "-m", "wbb"])

+ 0 - 25
wbb/utils/dbfunctions.py

@@ -10,7 +10,6 @@ chatsdb = db.chats
 gbansdb = db.gban
 coupledb = db.couple
 captchadb = db.captcha
-antiflooddb = db.antiflood
 
 """ Notes functions """
 
@@ -423,27 +422,3 @@ async def captcha_off(chat_id: int):
     if not is_captcha:
         return
     return await captchadb.insert_one({"chat_id": chat_id})
-
-
-# antiflood
-
-
-async def is_antiflood_on(chat_id: int) -> bool:
-    chat = await antiflooddb.find_one({"chat_id": chat_id})
-    if not chat:
-        return True
-    return False
-
-
-async def antiflood_on(chat_id: int):
-    is_antiflood = await is_antiflood_on(chat_id)
-    if is_antiflood:
-        return
-    return await antiflooddb.delete_one({"chat_id": chat_id})
-
-
-async def antiflood_off(chat_id: int):
-    is_antiflood = await is_antiflood_on(chat_id)
-    if not is_captcha:
-        return
-    return await antiflooddb.insert_one({"chat_id": chat_id})

+ 1 - 0
wbb/utils/errors.py

@@ -4,6 +4,7 @@ from functools import wraps
 from wbb import app, LOG_GROUP_ID
 from pyrogram.errors.exceptions.forbidden_403 import ChatWriteForbidden
 
+
 def split_limits(text):
     if len(text) < 2048:
         return [text]

+ 4 - 3
wbb/utils/inlinefuncs.py

@@ -1,6 +1,6 @@
 from wbb import (
         arq, app, app2, USERBOT_USERNAME,
-        BOT_USERNAME, LOG_GROUP_ID )
+        BOT_USERNAME, LOG_GROUP_ID)
 from pyrogram.types import (
     InlineQueryResultArticle,
     InputTextMessageContent,
@@ -19,6 +19,7 @@ from pyrogram import __version__ as pyrover
 import aiohttp
 import json
 
+
 async def alive_function(answers):
     buttons = InlineKeyboard(row_width=1)
     bot_state = 'Dead' if not await app.get_me() else 'Alive'
@@ -77,7 +78,7 @@ async def urban_func(answers, text):
 **Definition:** __{results[i].definition}__
 
 **Example:** __{results[i].example}__"""
-        
+
         answers.append(
             InlineQueryResultArticle(
                 title=results[i].word,
@@ -94,7 +95,7 @@ async def google_search_func(answers, text):
             msg = f"""
 [{i['titles']}]({i['links']})
 {i['descriptions']}"""
-            
+
             answers.append(
                 InlineQueryResultArticle(
                     title=i['titles'],

+ 2 - 0
wbb/utils/pastebin.py

@@ -1,5 +1,6 @@
 import socket
 
+
 async def _netcat(host, port, content):
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     s.connect((host, int(port)))
@@ -12,6 +13,7 @@ async def _netcat(host, port, content):
         return data
     s.close()
 
+
 async def paste(content):
     link = await _netcat('ezup.dev', 9999, content)
     return link