diff --git a/Powers/__main__.py b/Powers/__main__.py index e05cac87..98a7dec8 100644 --- a/Powers/__main__.py +++ b/Powers/__main__.py @@ -1,7 +1,4 @@ import uvloop # Comment it out if using on windows -from apscheduler.schedulers.asyncio import AsyncIOScheduler - -from Powers import BDB_URI, TIME_ZONE from Powers.bot_class import Gojo if __name__ == "__main__": diff --git a/Powers/database/approve_db.py b/Powers/database/approve_db.py index 8ba0b3ba..3cef38a3 100644 --- a/Powers/database/approve_db.py +++ b/Powers/database/approve_db.py @@ -1,8 +1,6 @@ from threading import RLock - from Powers import LOGGER from Powers.database import MongoDB - INSERTION_LOCK = RLock() class Approve(MongoDB): """Class for managing Approves in Chats in Bot.""" diff --git a/Powers/plugins/start.py b/Powers/plugins/start.py index e8f9d138..620fdbf1 100644 --- a/Powers/plugins/start.py +++ b/Powers/plugins/start.py @@ -13,13 +13,11 @@ from Powers import (HELP_COMMANDS, LOGGER, PYROGRAM_VERSION, PYTHON_VERSION, UPTIME, VERSION) from Powers.bot_class import Gojo -# from Powers.database.captcha_db import CAPTCHA_DATA from Powers.utils.custom_filters import command from Powers.utils.extras import StartPic from Powers.utils.kbhelpers import ikb from Powers.utils.start_utils import (gen_cmds_kb, gen_start_kb, get_help_msg, get_private_note, get_private_rules) -# from Powers.utils.string import encode_decode from Powers.vars import Config @@ -106,6 +104,7 @@ async def start(c: Gojo, m: Message): quote=True, ) return + try: cpt = f""" Hey [{m.from_user.first_name}](http://t.me/{m.from_user.username})! I am Gojo ✨. diff --git a/Powers/utils/admin_check.py b/Powers/utils/admin_check.py index e83e5456..d5a14c43 100644 --- a/Powers/utils/admin_check.py +++ b/Powers/utils/admin_check.py @@ -3,8 +3,10 @@ from pyrogram.enums import ChatMemberStatus as CMS from pyrogram.types import CallbackQuery, Message -from Powers import LOGGER, OWNER_ID -from Powers.database.support_db import SUPPORTS +from Powers import DEV_USERS, LOGGER, OWNER_ID, SUDO_USERS + +SUDO_LEVEL = SUDO_USERS + DEV_USERS + [int(OWNER_ID)] +DEV_LEVEL = DEV_USERS + [int(OWNER_ID)] async def admin_check(m: Message or CallbackQuery) -> bool: @@ -14,11 +16,6 @@ async def admin_check(m: Message or CallbackQuery) -> bool: if isinstance(m, CallbackQuery): user_id = m.message.from_user.id - support = SUPPORTS() - - SUDO_LEVEL = support.get_particular_support("sudo") + support.get_particular_support("dev") + [int(OWNER_ID)] - DEV_LEVEL = support.get_particular_support("dev") + [int(OWNER_ID)] - try: if user_id in SUDO_LEVEL: return True @@ -69,10 +66,6 @@ async def owner_check(m: Message or CallbackQuery) -> bool: user_id = m.message.from_user.id m = m.message - support = SUPPORTS() - - SUDO_LEVEL = support.get_particular_support("sudo") + support.get_particular_support("dev") + [int(OWNER_ID)] - try: if user_id in SUDO_LEVEL: return True diff --git a/Powers/utils/custom_filters.py b/Powers/utils/custom_filters.py index 5e9fc3a5..570a1477 100644 --- a/Powers/utils/custom_filters.py +++ b/Powers/utils/custom_filters.py @@ -9,12 +9,14 @@ from pyrogram.filters import create from pyrogram.types import CallbackQuery, Message -from Powers import OWNER_ID, PREFIX_HANDLER +from Powers import DEV_USERS, OWNER_ID, SUDO_USERS from Powers.database.disable_db import Disabling -from Powers.supports import get_support_staff from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload from Powers.vars import Config +SUDO_LEVEL = set(SUDO_USERS + DEV_USERS + [int(OWNER_ID)]) +DEV_LEVEL = set(DEV_USERS + [int(OWNER_ID)]) + def command( commands: Union[str, List[str]], @@ -27,8 +29,6 @@ async def func(flt, _, m: Message): if not m: return - SUDO_LEVEL = get_support_staff("sudo_level") - DEV_LEVEL = get_support_staff("dev_level") date = m.edit_date if date: return # reaction @@ -61,7 +61,7 @@ async def func(flt, _, m: Message): if not text: return False regex = r"^[{prefix}](\w+)(@{bot_name})?(?: |$)(.*)".format( - prefix="|".join(escape(x) for x in PREFIX_HANDLER), + prefix="|".join(escape(x) for x in Config.PREFIX_HANDLER), bot_name=Config.BOT_USERNAME, ) matches = compile_re(regex).search(text) @@ -289,7 +289,6 @@ async def can_pin_message_func(_, __, m): return True # Bypass the bot devs, sudos and owner - SUDO_LEVEL = get_support_staff("sudo_level") if m.from_user.id in SUDO_LEVEL: return True diff --git a/Powers/utils/string.py b/Powers/utils/string.py index 28932c8b..487f408a 100644 --- a/Powers/utils/string.py +++ b/Powers/utils/string.py @@ -1,4 +1,3 @@ -import base64 from datetime import datetime, timedelta from html import escape from re import compile as compile_re @@ -193,24 +192,3 @@ async def remove_escapes(text: str) -> str: else: res += text[counter] return res - -async def encode_decode(string: str,to_do="encode"): - """ - Function to encode or decode strings - string: string to be decoded or encoded - to_do: encode to encode the string or decode to decode the string - """ - if to_do.lower() == "encode": - encodee = string.encode("ascii") - base64_ = base64.b64encode(encodee) - B64 = base64_.decode("ascii") - - elif to_do.lower() == "decode": - decodee = string.encode("ascii") - base64_ = base64.b64decode(decodee) - B64 = base64_.decode("ascii") - - else: - B64 = None - - return B64 \ No newline at end of file