Spaces:
Paused
Paused
Captain Ezio
commited on
Commit
·
6933899
1
Parent(s):
adee216
....
Browse files- Powers/__main__.py +0 -3
- Powers/database/approve_db.py +0 -2
- Powers/plugins/start.py +1 -2
- Powers/utils/admin_check.py +4 -11
- Powers/utils/custom_filters.py +5 -6
- Powers/utils/string.py +0 -22
Powers/__main__.py
CHANGED
|
@@ -1,7 +1,4 @@
|
|
| 1 |
import uvloop # Comment it out if using on windows
|
| 2 |
-
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
| 3 |
-
|
| 4 |
-
from Powers import BDB_URI, TIME_ZONE
|
| 5 |
from Powers.bot_class import Gojo
|
| 6 |
|
| 7 |
if __name__ == "__main__":
|
|
|
|
| 1 |
import uvloop # Comment it out if using on windows
|
|
|
|
|
|
|
|
|
|
| 2 |
from Powers.bot_class import Gojo
|
| 3 |
|
| 4 |
if __name__ == "__main__":
|
Powers/database/approve_db.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
| 1 |
from threading import RLock
|
| 2 |
-
|
| 3 |
from Powers import LOGGER
|
| 4 |
from Powers.database import MongoDB
|
| 5 |
-
|
| 6 |
INSERTION_LOCK = RLock()
|
| 7 |
class Approve(MongoDB):
|
| 8 |
"""Class for managing Approves in Chats in Bot."""
|
|
|
|
| 1 |
from threading import RLock
|
|
|
|
| 2 |
from Powers import LOGGER
|
| 3 |
from Powers.database import MongoDB
|
|
|
|
| 4 |
INSERTION_LOCK = RLock()
|
| 5 |
class Approve(MongoDB):
|
| 6 |
"""Class for managing Approves in Chats in Bot."""
|
Powers/plugins/start.py
CHANGED
|
@@ -13,13 +13,11 @@ from pyrogram.types import (CallbackQuery, InlineKeyboardButton,
|
|
| 13 |
from Powers import (HELP_COMMANDS, LOGGER, PYROGRAM_VERSION, PYTHON_VERSION,
|
| 14 |
UPTIME, VERSION)
|
| 15 |
from Powers.bot_class import Gojo
|
| 16 |
-
# from Powers.database.captcha_db import CAPTCHA_DATA
|
| 17 |
from Powers.utils.custom_filters import command
|
| 18 |
from Powers.utils.extras import StartPic
|
| 19 |
from Powers.utils.kbhelpers import ikb
|
| 20 |
from Powers.utils.start_utils import (gen_cmds_kb, gen_start_kb, get_help_msg,
|
| 21 |
get_private_note, get_private_rules)
|
| 22 |
-
# from Powers.utils.string import encode_decode
|
| 23 |
from Powers.vars import Config
|
| 24 |
|
| 25 |
|
|
@@ -106,6 +104,7 @@ async def start(c: Gojo, m: Message):
|
|
| 106 |
quote=True,
|
| 107 |
)
|
| 108 |
return
|
|
|
|
| 109 |
try:
|
| 110 |
cpt = f"""
|
| 111 |
Hey [{m.from_user.first_name}](http://t.me/{m.from_user.username})! I am Gojo ✨.
|
|
|
|
| 13 |
from Powers import (HELP_COMMANDS, LOGGER, PYROGRAM_VERSION, PYTHON_VERSION,
|
| 14 |
UPTIME, VERSION)
|
| 15 |
from Powers.bot_class import Gojo
|
|
|
|
| 16 |
from Powers.utils.custom_filters import command
|
| 17 |
from Powers.utils.extras import StartPic
|
| 18 |
from Powers.utils.kbhelpers import ikb
|
| 19 |
from Powers.utils.start_utils import (gen_cmds_kb, gen_start_kb, get_help_msg,
|
| 20 |
get_private_note, get_private_rules)
|
|
|
|
| 21 |
from Powers.vars import Config
|
| 22 |
|
| 23 |
|
|
|
|
| 104 |
quote=True,
|
| 105 |
)
|
| 106 |
return
|
| 107 |
+
|
| 108 |
try:
|
| 109 |
cpt = f"""
|
| 110 |
Hey [{m.from_user.first_name}](http://t.me/{m.from_user.username})! I am Gojo ✨.
|
Powers/utils/admin_check.py
CHANGED
|
@@ -3,8 +3,10 @@ from traceback import format_exc
|
|
| 3 |
from pyrogram.enums import ChatMemberStatus as CMS
|
| 4 |
from pyrogram.types import CallbackQuery, Message
|
| 5 |
|
| 6 |
-
from Powers import LOGGER, OWNER_ID
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
async def admin_check(m: Message or CallbackQuery) -> bool:
|
|
@@ -14,11 +16,6 @@ async def admin_check(m: Message or CallbackQuery) -> bool:
|
|
| 14 |
if isinstance(m, CallbackQuery):
|
| 15 |
user_id = m.message.from_user.id
|
| 16 |
|
| 17 |
-
support = SUPPORTS()
|
| 18 |
-
|
| 19 |
-
SUDO_LEVEL = support.get_particular_support("sudo") + support.get_particular_support("dev") + [int(OWNER_ID)]
|
| 20 |
-
DEV_LEVEL = support.get_particular_support("dev") + [int(OWNER_ID)]
|
| 21 |
-
|
| 22 |
try:
|
| 23 |
if user_id in SUDO_LEVEL:
|
| 24 |
return True
|
|
@@ -69,10 +66,6 @@ async def owner_check(m: Message or CallbackQuery) -> bool:
|
|
| 69 |
user_id = m.message.from_user.id
|
| 70 |
m = m.message
|
| 71 |
|
| 72 |
-
support = SUPPORTS()
|
| 73 |
-
|
| 74 |
-
SUDO_LEVEL = support.get_particular_support("sudo") + support.get_particular_support("dev") + [int(OWNER_ID)]
|
| 75 |
-
|
| 76 |
try:
|
| 77 |
if user_id in SUDO_LEVEL:
|
| 78 |
return True
|
|
|
|
| 3 |
from pyrogram.enums import ChatMemberStatus as CMS
|
| 4 |
from pyrogram.types import CallbackQuery, Message
|
| 5 |
|
| 6 |
+
from Powers import DEV_USERS, LOGGER, OWNER_ID, SUDO_USERS
|
| 7 |
+
|
| 8 |
+
SUDO_LEVEL = SUDO_USERS + DEV_USERS + [int(OWNER_ID)]
|
| 9 |
+
DEV_LEVEL = DEV_USERS + [int(OWNER_ID)]
|
| 10 |
|
| 11 |
|
| 12 |
async def admin_check(m: Message or CallbackQuery) -> bool:
|
|
|
|
| 16 |
if isinstance(m, CallbackQuery):
|
| 17 |
user_id = m.message.from_user.id
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
try:
|
| 20 |
if user_id in SUDO_LEVEL:
|
| 21 |
return True
|
|
|
|
| 66 |
user_id = m.message.from_user.id
|
| 67 |
m = m.message
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
try:
|
| 70 |
if user_id in SUDO_LEVEL:
|
| 71 |
return True
|
Powers/utils/custom_filters.py
CHANGED
|
@@ -9,12 +9,14 @@ from pyrogram.errors import RPCError, UserNotParticipant
|
|
| 9 |
from pyrogram.filters import create
|
| 10 |
from pyrogram.types import CallbackQuery, Message
|
| 11 |
|
| 12 |
-
from Powers import OWNER_ID,
|
| 13 |
from Powers.database.disable_db import Disabling
|
| 14 |
-
from Powers.supports import get_support_staff
|
| 15 |
from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
|
| 16 |
from Powers.vars import Config
|
| 17 |
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
def command(
|
| 20 |
commands: Union[str, List[str]],
|
|
@@ -27,8 +29,6 @@ def command(
|
|
| 27 |
if not m:
|
| 28 |
return
|
| 29 |
|
| 30 |
-
SUDO_LEVEL = get_support_staff("sudo_level")
|
| 31 |
-
DEV_LEVEL = get_support_staff("dev_level")
|
| 32 |
date = m.edit_date
|
| 33 |
if date:
|
| 34 |
return # reaction
|
|
@@ -61,7 +61,7 @@ def command(
|
|
| 61 |
if not text:
|
| 62 |
return False
|
| 63 |
regex = r"^[{prefix}](\w+)(@{bot_name})?(?: |$)(.*)".format(
|
| 64 |
-
prefix="|".join(escape(x) for x in PREFIX_HANDLER),
|
| 65 |
bot_name=Config.BOT_USERNAME,
|
| 66 |
)
|
| 67 |
matches = compile_re(regex).search(text)
|
|
@@ -289,7 +289,6 @@ async def can_pin_message_func(_, __, m):
|
|
| 289 |
return True
|
| 290 |
|
| 291 |
# Bypass the bot devs, sudos and owner
|
| 292 |
-
SUDO_LEVEL = get_support_staff("sudo_level")
|
| 293 |
if m.from_user.id in SUDO_LEVEL:
|
| 294 |
return True
|
| 295 |
|
|
|
|
| 9 |
from pyrogram.filters import create
|
| 10 |
from pyrogram.types import CallbackQuery, Message
|
| 11 |
|
| 12 |
+
from Powers import DEV_USERS, OWNER_ID, SUDO_USERS
|
| 13 |
from Powers.database.disable_db import Disabling
|
|
|
|
| 14 |
from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
|
| 15 |
from Powers.vars import Config
|
| 16 |
|
| 17 |
+
SUDO_LEVEL = set(SUDO_USERS + DEV_USERS + [int(OWNER_ID)])
|
| 18 |
+
DEV_LEVEL = set(DEV_USERS + [int(OWNER_ID)])
|
| 19 |
+
|
| 20 |
|
| 21 |
def command(
|
| 22 |
commands: Union[str, List[str]],
|
|
|
|
| 29 |
if not m:
|
| 30 |
return
|
| 31 |
|
|
|
|
|
|
|
| 32 |
date = m.edit_date
|
| 33 |
if date:
|
| 34 |
return # reaction
|
|
|
|
| 61 |
if not text:
|
| 62 |
return False
|
| 63 |
regex = r"^[{prefix}](\w+)(@{bot_name})?(?: |$)(.*)".format(
|
| 64 |
+
prefix="|".join(escape(x) for x in Config.PREFIX_HANDLER),
|
| 65 |
bot_name=Config.BOT_USERNAME,
|
| 66 |
)
|
| 67 |
matches = compile_re(regex).search(text)
|
|
|
|
| 289 |
return True
|
| 290 |
|
| 291 |
# Bypass the bot devs, sudos and owner
|
|
|
|
| 292 |
if m.from_user.id in SUDO_LEVEL:
|
| 293 |
return True
|
| 294 |
|
Powers/utils/string.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
import base64
|
| 2 |
from datetime import datetime, timedelta
|
| 3 |
from html import escape
|
| 4 |
from re import compile as compile_re
|
|
@@ -193,24 +192,3 @@ async def remove_escapes(text: str) -> str:
|
|
| 193 |
else:
|
| 194 |
res += text[counter]
|
| 195 |
return res
|
| 196 |
-
|
| 197 |
-
async def encode_decode(string: str,to_do="encode"):
|
| 198 |
-
"""
|
| 199 |
-
Function to encode or decode strings
|
| 200 |
-
string: string to be decoded or encoded
|
| 201 |
-
to_do: encode to encode the string or decode to decode the string
|
| 202 |
-
"""
|
| 203 |
-
if to_do.lower() == "encode":
|
| 204 |
-
encodee = string.encode("ascii")
|
| 205 |
-
base64_ = base64.b64encode(encodee)
|
| 206 |
-
B64 = base64_.decode("ascii")
|
| 207 |
-
|
| 208 |
-
elif to_do.lower() == "decode":
|
| 209 |
-
decodee = string.encode("ascii")
|
| 210 |
-
base64_ = base64.b64decode(decodee)
|
| 211 |
-
B64 = base64_.decode("ascii")
|
| 212 |
-
|
| 213 |
-
else:
|
| 214 |
-
B64 = None
|
| 215 |
-
|
| 216 |
-
return B64
|
|
|
|
|
|
|
| 1 |
from datetime import datetime, timedelta
|
| 2 |
from html import escape
|
| 3 |
from re import compile as compile_re
|
|
|
|
| 192 |
else:
|
| 193 |
res += text[counter]
|
| 194 |
return res
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|