Skip to content

Commit

Permalink
....
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgojoof6eyes committed Oct 4, 2023
1 parent ee9acf7 commit b88e416
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 46 deletions.
3 changes: 0 additions & 3 deletions Powers/__main__.py
Original file line number Diff line number Diff line change
@@ -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__":
Expand Down
2 changes: 0 additions & 2 deletions Powers/database/approve_db.py
Original file line number Diff line number Diff line change
@@ -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."""
Expand Down
3 changes: 1 addition & 2 deletions Powers/plugins/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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 ✨.
Expand Down
15 changes: 4 additions & 11 deletions Powers/utils/admin_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions Powers/utils/custom_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]],
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down
22 changes: 0 additions & 22 deletions Powers/utils/string.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import base64
from datetime import datetime, timedelta
from html import escape
from re import compile as compile_re
Expand Down Expand Up @@ -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

0 comments on commit b88e416

Please sign in to comment.