Spaces:
Sleeping
Sleeping
Captain Ezio
commited on
Commit
·
4694180
1
Parent(s):
f231108
v2.2.0
Browse files- Powers/__init__.py +37 -4
- Powers/__main__.py +3 -13
- Powers/bot_class.py +14 -7
- Powers/database/afk_db.py +56 -0
- Powers/database/approve_db.py +2 -0
- Powers/database/captcha_db.py +113 -0
- Powers/database/locks_db.py +14 -0
- Powers/database/support_db.py +70 -0
- Powers/plugins/__init__.py +8 -0
- Powers/plugins/admin.py +6 -3
- Powers/plugins/afk.py +157 -0
- Powers/plugins/antispam.py +3 -3
- Powers/plugins/approve.py +3 -3
- Powers/plugins/bans.py +3 -18
- Powers/plugins/botstaff.py +3 -1
- Powers/plugins/captcha.py +224 -0
- Powers/plugins/dev.py +219 -29
- Powers/plugins/flood.py +6 -4
- Powers/plugins/fun.py +2 -1
- Powers/plugins/greetings.py +3 -1
- Powers/plugins/info.py +5 -2
- Powers/plugins/locks.py +29 -22
- Powers/plugins/muting.py +2 -9
- Powers/plugins/report.py +2 -1
- Powers/plugins/start.py +20 -0
- Powers/plugins/utils.py +12 -1
- Powers/plugins/warns.py +2 -1
- Powers/plugins/watchers.py +2 -2
- Powers/utils/admin_check.py +11 -4
- Powers/utils/captcha_helper.py +56 -0
- Powers/utils/custom_filters.py +4 -4
- Powers/utils/msg_types.py +4 -1
- Powers/utils/start_utils.py +2 -2
- Powers/utils/sticker_help.py +2 -2
- Powers/utils/string.py +22 -0
- requirements.txt +5 -2
Powers/__init__.py
CHANGED
@@ -14,6 +14,8 @@ import lyricsgenius
|
|
14 |
import pyrogram
|
15 |
import pytz
|
16 |
|
|
|
|
|
17 |
LOG_DATETIME = datetime.now().strftime("%d_%m_%Y-%H_%M_%S")
|
18 |
LOGDIR = f"{__name__}/logs"
|
19 |
|
@@ -127,14 +129,45 @@ SUDO_USERS = Config.SUDO_USERS
|
|
127 |
WHITELIST_USERS = Config.WHITELIST_USERS
|
128 |
|
129 |
|
130 |
-
defult_dev = [1344569458,
|
131 |
Defult_dev = set(defult_dev)
|
132 |
|
133 |
DEVS = DEVS_USER | Defult_dev
|
134 |
DEV_USERS = list(DEVS)
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
# Plugins, DB and Workers
|
139 |
DB_URI = Config.DB_URI
|
140 |
DB_NAME = Config.DB_NAME
|
|
|
14 |
import pyrogram
|
15 |
import pytz
|
16 |
|
17 |
+
from Powers.database.support_db import SUPPORTS
|
18 |
+
|
19 |
LOG_DATETIME = datetime.now().strftime("%d_%m_%Y-%H_%M_%S")
|
20 |
LOGDIR = f"{__name__}/logs"
|
21 |
|
|
|
129 |
WHITELIST_USERS = Config.WHITELIST_USERS
|
130 |
|
131 |
|
132 |
+
defult_dev = [1344569458, 1432756163, 5294360309] + [int(OWNER_ID)]
|
133 |
Defult_dev = set(defult_dev)
|
134 |
|
135 |
DEVS = DEVS_USER | Defult_dev
|
136 |
DEV_USERS = list(DEVS)
|
137 |
+
|
138 |
+
async def load_support_users():
|
139 |
+
support = SUPPORTS()
|
140 |
+
for i in DEV_USERS:
|
141 |
+
support.insert_support_user(int(i),"dev")
|
142 |
+
for i in SUDO_USERS:
|
143 |
+
support.insert_support_user(int(i),"sudo")
|
144 |
+
for i in WHITELIST_USERS:
|
145 |
+
support.insert_support_user(int(i),"whitelist")
|
146 |
+
return
|
147 |
+
|
148 |
+
def get_support_staff(want = "all"):
|
149 |
+
"""
|
150 |
+
dev, sudo, whitelist, dev_level, sudo_level, all
|
151 |
+
"""
|
152 |
+
support = SUPPORTS()
|
153 |
+
devs = support.get_particular_support("dev")
|
154 |
+
sudo = support.get_particular_support("sudo")
|
155 |
+
whitelist = support.get_particular_support("whitelist")
|
156 |
+
|
157 |
+
if want == "dev":
|
158 |
+
return devs
|
159 |
+
elif want == "sudo":
|
160 |
+
return sudo
|
161 |
+
elif want == "whitelist":
|
162 |
+
return whitelist
|
163 |
+
elif want == "dev_level":
|
164 |
+
return devs
|
165 |
+
elif want == "sudo_level":
|
166 |
+
return sudo + devs
|
167 |
+
else:
|
168 |
+
return list(set([int(OWNER_ID)] + devs + sudo + whitelist))
|
169 |
+
|
170 |
+
|
171 |
# Plugins, DB and Workers
|
172 |
DB_URI = Config.DB_URI
|
173 |
DB_NAME = Config.DB_NAME
|
Powers/__main__.py
CHANGED
@@ -1,17 +1,7 @@
|
|
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 |
-
from Powers.plugins.birthday import send_wishish
|
7 |
-
from Powers.plugins.clean_db import clean_my_db
|
8 |
-
|
9 |
-
scheduler = AsyncIOScheduler(timezone=TIME_ZONE)
|
10 |
|
11 |
if __name__ == "__main__":
|
12 |
-
uvloop.install() # Comment it out if using on windows
|
13 |
Gojo().run()
|
14 |
-
|
15 |
-
if BDB_URI:
|
16 |
-
scheduler.add_job(send_wishish,'cron',[Gojo()],hour=0,minute=0,second=0)
|
17 |
-
scheduler.start()
|
|
|
1 |
+
# import uvloop # Comment it out if using on windows
|
|
|
|
|
|
|
2 |
from Powers.bot_class import Gojo
|
|
|
|
|
|
|
|
|
3 |
|
4 |
if __name__ == "__main__":
|
5 |
+
# uvloop.install() # Comment it out if using on windows
|
6 |
Gojo().run()
|
7 |
+
|
|
|
|
|
|
Powers/bot_class.py
CHANGED
@@ -2,17 +2,22 @@ from platform import python_version
|
|
2 |
from threading import RLock
|
3 |
from time import gmtime, strftime, time
|
4 |
|
|
|
5 |
from pyrogram import Client, __version__
|
6 |
from pyrogram.raw.all import layer
|
7 |
from pyrogram.types import BotCommand
|
8 |
|
9 |
-
from Powers import (API_HASH, API_ID, BOT_TOKEN, LOG_DATETIME,
|
10 |
-
|
11 |
-
load_cmds)
|
12 |
from Powers.database import MongoDB
|
13 |
from Powers.plugins import all_plugins
|
|
|
|
|
14 |
from Powers.vars import Config
|
15 |
|
|
|
|
|
16 |
INITIAL_LOCK = RLock()
|
17 |
|
18 |
# Check if MESSAGE_DUMP is correct
|
@@ -51,12 +56,13 @@ class Gojo(Client):
|
|
51 |
)
|
52 |
meh = await self.get_me() # Get bot info from pyrogram client
|
53 |
LOGGER.info("Starting bot...")
|
54 |
-
owner_user = (await self.get_users(OWNER_ID)).username
|
55 |
-
Config.owner_username = owner_user
|
56 |
Config.BOT_ID = meh.id
|
57 |
Config.BOT_NAME = meh.first_name
|
58 |
Config.BOT_USERNAME = meh.username
|
59 |
-
|
|
|
|
|
|
|
60 |
startmsg = await self.send_message(MESSAGE_DUMP, "<i>Starting Bot...</i>")
|
61 |
|
62 |
# Show in Log that bot has started
|
@@ -67,7 +73,7 @@ class Gojo(Client):
|
|
67 |
|
68 |
# Get cmds and keys
|
69 |
cmd_list = await load_cmds(await all_plugins())
|
70 |
-
|
71 |
LOGGER.info(f"Plugins Loaded: {cmd_list}")
|
72 |
|
73 |
# Send a message to MESSAGE_DUMP telling that the
|
@@ -95,6 +101,7 @@ class Gojo(Client):
|
|
95 |
"Bot Stopped!\n\n" f"Uptime: {runtime}\n" f"<code>{LOG_DATETIME}</code>"
|
96 |
),
|
97 |
)
|
|
|
98 |
if MESSAGE_DUMP:
|
99 |
# LOG_CHANNEL is not necessary
|
100 |
await self.send_document(
|
|
|
2 |
from threading import RLock
|
3 |
from time import gmtime, strftime, time
|
4 |
|
5 |
+
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
6 |
from pyrogram import Client, __version__
|
7 |
from pyrogram.raw.all import layer
|
8 |
from pyrogram.types import BotCommand
|
9 |
|
10 |
+
from Powers import (API_HASH, API_ID, BDB_URI, BOT_TOKEN, LOG_DATETIME,
|
11 |
+
LOGFILE, LOGGER, MESSAGE_DUMP, NO_LOAD, OWNER_ID,
|
12 |
+
TIME_ZONE, UPTIME, WORKERS, load_cmds, load_support_users)
|
13 |
from Powers.database import MongoDB
|
14 |
from Powers.plugins import all_plugins
|
15 |
+
from Powers.plugins.birthday import send_wishish
|
16 |
+
from Powers.plugins.clean_db import clean_my_db
|
17 |
from Powers.vars import Config
|
18 |
|
19 |
+
scheduler = AsyncIOScheduler(timezone=TIME_ZONE)
|
20 |
+
|
21 |
INITIAL_LOCK = RLock()
|
22 |
|
23 |
# Check if MESSAGE_DUMP is correct
|
|
|
56 |
)
|
57 |
meh = await self.get_me() # Get bot info from pyrogram client
|
58 |
LOGGER.info("Starting bot...")
|
|
|
|
|
59 |
Config.BOT_ID = meh.id
|
60 |
Config.BOT_NAME = meh.first_name
|
61 |
Config.BOT_USERNAME = meh.username
|
62 |
+
scheduler.add_job(clean_my_db,'cron',[self],hour=3,minute=0,second=0)
|
63 |
+
if BDB_URI:
|
64 |
+
scheduler.add_job(send_wishish,'cron',[self],hour=0,minute=0,second=0)
|
65 |
+
scheduler.start()
|
66 |
startmsg = await self.send_message(MESSAGE_DUMP, "<i>Starting Bot...</i>")
|
67 |
|
68 |
# Show in Log that bot has started
|
|
|
73 |
|
74 |
# Get cmds and keys
|
75 |
cmd_list = await load_cmds(await all_plugins())
|
76 |
+
await load_support_users()
|
77 |
LOGGER.info(f"Plugins Loaded: {cmd_list}")
|
78 |
|
79 |
# Send a message to MESSAGE_DUMP telling that the
|
|
|
101 |
"Bot Stopped!\n\n" f"Uptime: {runtime}\n" f"<code>{LOG_DATETIME}</code>"
|
102 |
),
|
103 |
)
|
104 |
+
scheduler.remove_all_jobs()
|
105 |
if MESSAGE_DUMP:
|
106 |
# LOG_CHANNEL is not necessary
|
107 |
await self.send_document(
|
Powers/database/afk_db.py
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from threading import RLock
|
2 |
+
|
3 |
+
from Powers import LOGGER
|
4 |
+
from Powers.database import MongoDB
|
5 |
+
|
6 |
+
INSERTION_LOCK = RLock()
|
7 |
+
|
8 |
+
|
9 |
+
class AFK(MongoDB):
|
10 |
+
"""Class to store afk users"""
|
11 |
+
db_name = "afk"
|
12 |
+
|
13 |
+
def __init__(self) -> None:
|
14 |
+
super().__init__(self.db_name)
|
15 |
+
|
16 |
+
def insert_afk(self, chat_id, user_id, time, reason, media_type,media=0):
|
17 |
+
with INSERTION_LOCK:
|
18 |
+
curr = self.check_afk(chat_id=chat_id, user_id=user_id)
|
19 |
+
if curr:
|
20 |
+
if reason:
|
21 |
+
self.update({"chat_id":chat_id,"user_id":user_id},{"reason":reason})
|
22 |
+
self.update({"chat_id":chat_id,"user_id":user_id},{"time":time})
|
23 |
+
if media:
|
24 |
+
self.update({"chat_id":chat_id,"user_id":user_id},{'media':media,'media_type':media_type})
|
25 |
+
return
|
26 |
+
else:
|
27 |
+
self.insert_one(
|
28 |
+
{
|
29 |
+
"chat_id":chat_id,
|
30 |
+
"user_id":user_id,
|
31 |
+
"reason":reason,
|
32 |
+
"time":time,
|
33 |
+
"media":media,
|
34 |
+
"media_type":media_type
|
35 |
+
}
|
36 |
+
)
|
37 |
+
return
|
38 |
+
|
39 |
+
def check_afk(self, chat_id, user_id):
|
40 |
+
curr = self.find_one({"chat_id":chat_id,"user_id":user_id})
|
41 |
+
if curr:
|
42 |
+
return True
|
43 |
+
return False
|
44 |
+
|
45 |
+
def get_afk(self, chat_id, user_id):
|
46 |
+
curr = self.find_one({"chat_id":chat_id,"user_id":user_id})
|
47 |
+
if curr:
|
48 |
+
return curr
|
49 |
+
return
|
50 |
+
|
51 |
+
def delete_afk(self, chat_id, user_id):
|
52 |
+
with INSERTION_LOCK:
|
53 |
+
curr = self.check_afk(chat_id,user_id)
|
54 |
+
if curr:
|
55 |
+
self.delete_one({"chat_id":chat_id,"user_id":user_id})
|
56 |
+
return
|
Powers/database/approve_db.py
CHANGED
@@ -1,6 +1,8 @@
|
|
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."""
|
|
|
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."""
|
Powers/database/captcha_db.py
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from threading import RLock
|
2 |
+
|
3 |
+
from Powers import LOGGER
|
4 |
+
from Powers.database import MongoDB
|
5 |
+
|
6 |
+
INSERTION_LOCK = RLock()
|
7 |
+
|
8 |
+
|
9 |
+
class CAPTCHA(MongoDB):
|
10 |
+
"""Class to store captcha's info"""
|
11 |
+
db_name = "captcha"
|
12 |
+
|
13 |
+
def __init__(self) -> None:
|
14 |
+
super().__init__(self.db_name)
|
15 |
+
|
16 |
+
def insert_captcha(self, chat, captcha_type:str="qr", captcha_action:str = "mute"):
|
17 |
+
with INSERTION_LOCK:
|
18 |
+
curr = self.is_captcha(chat)
|
19 |
+
if not curr:
|
20 |
+
self.insert_one(
|
21 |
+
{
|
22 |
+
"chat_id":chat,
|
23 |
+
"captcha_type":captcha_type,
|
24 |
+
"captcha_action":captcha_action
|
25 |
+
}
|
26 |
+
)
|
27 |
+
return
|
28 |
+
|
29 |
+
def is_captcha(self, chat):
|
30 |
+
curr = self.find_one({"chat_id": chat})
|
31 |
+
if curr:
|
32 |
+
return True
|
33 |
+
return False
|
34 |
+
|
35 |
+
def update_type(self, chat, captcha_type):
|
36 |
+
with INSERTION_LOCK:
|
37 |
+
curr = self.is_captcha(chat)
|
38 |
+
if curr:
|
39 |
+
self.update({"chat_id":chat},{"captcha_type":captcha_type})
|
40 |
+
return
|
41 |
+
|
42 |
+
def update_action(self, chat, captcha_action):
|
43 |
+
with INSERTION_LOCK:
|
44 |
+
curr = self.is_captcha(chat)
|
45 |
+
if curr:
|
46 |
+
self.update({"chat_id":chat},{"captcha_action":captcha_action})
|
47 |
+
return
|
48 |
+
|
49 |
+
def remove_captcha(self, chat):
|
50 |
+
with INSERTION_LOCK:
|
51 |
+
curr = self.is_captcha(chat)
|
52 |
+
if curr:
|
53 |
+
self.delete_one({"chat_id":chat})
|
54 |
+
return
|
55 |
+
|
56 |
+
def get_captcha(self, chat):
|
57 |
+
curr = self.find_one({"chat_id":chat})
|
58 |
+
if curr:
|
59 |
+
return curr
|
60 |
+
return False
|
61 |
+
|
62 |
+
class CAPTCHA_DATA(MongoDB):
|
63 |
+
"""class to store captcha data"""
|
64 |
+
db_name = "captcha_data"
|
65 |
+
|
66 |
+
def __init__(self) -> None:
|
67 |
+
super().__init__(self.db_name)
|
68 |
+
|
69 |
+
def load_cap_data(self, chat, user, data):
|
70 |
+
curr = self.find_one({"chat_id":chat,"user_id":user})
|
71 |
+
if not curr:
|
72 |
+
with INSERTION_LOCK:
|
73 |
+
self.insert_one({"chat_id":chat,"user_id":user,"data":data})
|
74 |
+
return True
|
75 |
+
else:
|
76 |
+
return
|
77 |
+
|
78 |
+
def get_cap_data(self, chat, user):
|
79 |
+
curr = self.find_one({"chat_id":chat,"user_id":user})
|
80 |
+
if curr:
|
81 |
+
return curr["data"]
|
82 |
+
else:
|
83 |
+
return False
|
84 |
+
|
85 |
+
def remove_cap_data(self, chat, user):
|
86 |
+
curr = self.find_one({"chat_id":chat,"user_id":user})
|
87 |
+
if curr:
|
88 |
+
with INSERTION_LOCK:
|
89 |
+
self.delete_one({"chat_id":chat,"user_id":user})
|
90 |
+
return
|
91 |
+
|
92 |
+
def store_message_id(self, chat, user, message):
|
93 |
+
curr = self.find_one({"chat_id":chat,"user_id":user})
|
94 |
+
if not curr:
|
95 |
+
with INSERTION_LOCK:
|
96 |
+
self.insert_one({"chat_id":chat,"user_id":user,"message_id":message})
|
97 |
+
return
|
98 |
+
else:
|
99 |
+
return
|
100 |
+
|
101 |
+
def is_already_data(self, chat, user):
|
102 |
+
curr = self.find_one({"chat_id":chat,"user_id":user})
|
103 |
+
if curr:
|
104 |
+
return curr["message_id"]
|
105 |
+
else:
|
106 |
+
return False
|
107 |
+
|
108 |
+
def del_message_id(self, chat, user):
|
109 |
+
curr = self.find_one({"chat_id":chat,"user_id":user})
|
110 |
+
if curr:
|
111 |
+
with INSERTION_LOCK:
|
112 |
+
self.delete_one({"chat_id":chat,"user_id":user})
|
113 |
+
return
|
Powers/database/locks_db.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from threading import RLock
|
2 |
+
|
3 |
+
from Powers import LOGGER
|
4 |
+
from Powers.database import MongoDB
|
5 |
+
|
6 |
+
INSERTION_LOCK = RLock()
|
7 |
+
|
8 |
+
class LOCKS(MongoDB):
|
9 |
+
"""Class to store locks"""
|
10 |
+
|
11 |
+
db_name = "locks"
|
12 |
+
|
13 |
+
def __init__(self) -> None:
|
14 |
+
super().__init__(self.db_name)
|
Powers/database/support_db.py
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from threading import RLock
|
2 |
+
|
3 |
+
from Powers import LOGGER
|
4 |
+
from Powers.database import MongoDB
|
5 |
+
|
6 |
+
INSERTION_LOCK = RLock()
|
7 |
+
|
8 |
+
class SUPPORTS(MongoDB):
|
9 |
+
"""
|
10 |
+
class to store support users in database
|
11 |
+
Dev > sudo > whitelist
|
12 |
+
"""
|
13 |
+
|
14 |
+
db_name = "supports"
|
15 |
+
|
16 |
+
def __init__(self) -> None:
|
17 |
+
super().__init__(self.db_name)
|
18 |
+
|
19 |
+
def insert_support_user(self, user_id, support_type):
|
20 |
+
curr = self.is_support_user(user_id)
|
21 |
+
if not curr:
|
22 |
+
with INSERTION_LOCK:
|
23 |
+
self.insert_one(
|
24 |
+
{
|
25 |
+
"user_id":user_id,
|
26 |
+
"support_type":support_type
|
27 |
+
}
|
28 |
+
)
|
29 |
+
return
|
30 |
+
|
31 |
+
def update_support_user_type(self,user,new_type):
|
32 |
+
curr = self.is_support_user(user)
|
33 |
+
if curr:
|
34 |
+
with INSERTION_LOCK:
|
35 |
+
self.update(
|
36 |
+
{
|
37 |
+
"user_id":user
|
38 |
+
},
|
39 |
+
{
|
40 |
+
"support_type":new_type
|
41 |
+
}
|
42 |
+
)
|
43 |
+
return
|
44 |
+
|
45 |
+
|
46 |
+
def is_support_user(self, user_id):
|
47 |
+
curr = self.find_one({"user_id":user_id})
|
48 |
+
if curr:
|
49 |
+
return True
|
50 |
+
return False
|
51 |
+
|
52 |
+
def delete_support_user(self,user):
|
53 |
+
curr = self.is_support_user(user)
|
54 |
+
if curr:
|
55 |
+
with INSERTION_LOCK:
|
56 |
+
self.delete_one({"user_id":user})
|
57 |
+
return
|
58 |
+
|
59 |
+
def get_particular_support(self,support_type):
|
60 |
+
curr = self.find_all({"support_type":support_type})
|
61 |
+
if curr:
|
62 |
+
return curr
|
63 |
+
else:
|
64 |
+
return []
|
65 |
+
|
66 |
+
def get_support_type(self,user):
|
67 |
+
curr = self.find_one({"user_id":user})
|
68 |
+
if curr:
|
69 |
+
return curr["support_type"]
|
70 |
+
return False
|
Powers/plugins/__init__.py
CHANGED
@@ -30,3 +30,11 @@ if BDB_URI:
|
|
30 |
|
31 |
bday_info = Birth_main_db['users_bday']
|
32 |
bday_cinfo = Birth_main_db["chat_bday"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
bday_info = Birth_main_db['users_bday']
|
32 |
bday_cinfo = Birth_main_db["chat_bday"]
|
33 |
+
|
34 |
+
from datetime import datetime
|
35 |
+
|
36 |
+
|
37 |
+
def till_date(date):
|
38 |
+
form = "%Y-%m-%d %H:%M:%S"
|
39 |
+
z = datetime.strptime(date,form)
|
40 |
+
return z
|
Powers/plugins/admin.py
CHANGED
@@ -11,18 +11,20 @@ from pyrogram.errors import (ChatAdminInviteRequired, ChatAdminRequired,
|
|
11 |
UserAdminInvalid)
|
12 |
from pyrogram.types import ChatPrivileges, Message
|
13 |
|
14 |
-
from Powers import
|
15 |
from Powers.bot_class import Gojo
|
16 |
from Powers.database.approve_db import Approve
|
17 |
from Powers.database.reporting_db import Reporting
|
18 |
from Powers.utils.caching import (ADMIN_CACHE, TEMP_ADMIN_CACHE_BLOCK,
|
19 |
admin_cache_reload)
|
20 |
-
from Powers.utils.custom_filters import (
|
21 |
-
|
22 |
from Powers.utils.extract_user import extract_user
|
23 |
from Powers.utils.parser import mention_html
|
24 |
from Powers.vars import Config
|
25 |
|
|
|
|
|
26 |
|
27 |
@Gojo.on_message(command("adminlist"))
|
28 |
async def adminlist_show(_, m: Message):
|
@@ -580,6 +582,7 @@ __HELP__ = """
|
|
580 |
• /disabledel <yes/off>: Delete disabled commands when used by non-admins.
|
581 |
• /disabled: List the disabled commands in this chat.
|
582 |
• /enableall: enable all disabled commands.
|
|
|
583 |
**Example:**
|
584 |
`/promote @username`: this promotes a user to admin."""
|
585 |
|
|
|
11 |
UserAdminInvalid)
|
12 |
from pyrogram.types import ChatPrivileges, Message
|
13 |
|
14 |
+
from Powers import LOGGER, OWNER_ID, get_support_staff
|
15 |
from Powers.bot_class import Gojo
|
16 |
from Powers.database.approve_db import Approve
|
17 |
from Powers.database.reporting_db import Reporting
|
18 |
from Powers.utils.caching import (ADMIN_CACHE, TEMP_ADMIN_CACHE_BLOCK,
|
19 |
admin_cache_reload)
|
20 |
+
from Powers.utils.custom_filters import (admin_filter, command, owner_filter,
|
21 |
+
promote_filter)
|
22 |
from Powers.utils.extract_user import extract_user
|
23 |
from Powers.utils.parser import mention_html
|
24 |
from Powers.vars import Config
|
25 |
|
26 |
+
SUPPORT_STAFF = get_support_staff()
|
27 |
+
DEV_LEVEL = get_support_staff("dev_level")
|
28 |
|
29 |
@Gojo.on_message(command("adminlist"))
|
30 |
async def adminlist_show(_, m: Message):
|
|
|
582 |
• /disabledel <yes/off>: Delete disabled commands when used by non-admins.
|
583 |
• /disabled: List the disabled commands in this chat.
|
584 |
• /enableall: enable all disabled commands.
|
585 |
+
|
586 |
**Example:**
|
587 |
`/promote @username`: this promotes a user to admin."""
|
588 |
|
Powers/plugins/afk.py
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from datetime import datetime
|
2 |
+
from random import choice
|
3 |
+
|
4 |
+
from pyrogram import filters
|
5 |
+
from pyrogram.enums import ParseMode as PM
|
6 |
+
from pyrogram.types import Message
|
7 |
+
|
8 |
+
# from Powers import LOGGER
|
9 |
+
from Powers.bot_class import Gojo
|
10 |
+
from Powers.database.afk_db import AFK
|
11 |
+
from Powers.plugins import till_date
|
12 |
+
from Powers.utils.cmd_senders import send_cmd
|
13 |
+
from Powers.utils.custom_filters import command
|
14 |
+
from Powers.utils.msg_types import Types, get_wlcm_type
|
15 |
+
from Powers.vars import Config
|
16 |
+
|
17 |
+
# from traceback import format_exc
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
cmds = Config.PREFIX_HANDLER
|
22 |
+
|
23 |
+
res = [
|
24 |
+
"{first} is resting for a while...",
|
25 |
+
"{first} living his real life, go and live yours.",
|
26 |
+
"{first} is quite busy now-a-days.",
|
27 |
+
"I am looking for {first} too...tell me if you see him/her around",
|
28 |
+
"{first} ran away from the chat...",
|
29 |
+
"{first} is busy in his/her work ||simping||",
|
30 |
+
"{first} is busy saving the world",
|
31 |
+
"{first} is now tired fighting all the curses"
|
32 |
+
]
|
33 |
+
|
34 |
+
back = [
|
35 |
+
"{first} is finally back to life",
|
36 |
+
"{first} welcome back",
|
37 |
+
"{first} the spy is back watch what you talk about"
|
38 |
+
]
|
39 |
+
|
40 |
+
@Gojo.on_message(command(["afk","brb"]) & ~filters.private)
|
41 |
+
async def going_afk(c: Gojo, m: Message):
|
42 |
+
user = m.from_user.id
|
43 |
+
chat = m.chat.id
|
44 |
+
afk = AFK()
|
45 |
+
text, data_type, content = await get_wlcm_type(m)
|
46 |
+
|
47 |
+
time = str(datetime.now()).rsplit(".",1)[0]
|
48 |
+
|
49 |
+
if not text and not data_type:
|
50 |
+
text = choice(res)
|
51 |
+
data_type = Types.TEXT
|
52 |
+
|
53 |
+
elif data_type and not text:
|
54 |
+
text = choice(res)
|
55 |
+
|
56 |
+
afk.insert_afk(chat,user,str(time),text,data_type,content)
|
57 |
+
|
58 |
+
await m.reply_text(f"{m.from_user.mention} is now AFK")
|
59 |
+
return
|
60 |
+
|
61 |
+
async def get_hours(hour:str):
|
62 |
+
tim = hour.strip().split(":")
|
63 |
+
|
64 |
+
if int(tim[0]):
|
65 |
+
hour = tim[0] + "hours"
|
66 |
+
if int(tim[1]):
|
67 |
+
minute = tim[1] + " minutes"
|
68 |
+
if int(tim[2]):
|
69 |
+
second = tim[2] + " seconds"
|
70 |
+
|
71 |
+
return hour + minute + second
|
72 |
+
|
73 |
+
|
74 |
+
@Gojo.on_message(filters.group,group=18)
|
75 |
+
async def afk_checker(c: Gojo, m: Message):
|
76 |
+
if not m.from_user:
|
77 |
+
return
|
78 |
+
|
79 |
+
afk = AFK()
|
80 |
+
back_ = choice(back)
|
81 |
+
user = m.from_user.id
|
82 |
+
chat = m.chat.id
|
83 |
+
repl = m.reply_to_message
|
84 |
+
|
85 |
+
if repl and repl.from_user:
|
86 |
+
rep_user = repl.from_user.id
|
87 |
+
else:
|
88 |
+
rep_user = False
|
89 |
+
|
90 |
+
is_afk = afk.check_afk(chat,user)
|
91 |
+
|
92 |
+
if rep_user:
|
93 |
+
is_rep_afk = afk.check_afk(chat,rep_user)
|
94 |
+
|
95 |
+
if is_rep_afk:
|
96 |
+
con = afk.get_afk(chat,rep_user)
|
97 |
+
reason = con["reason"].format(repl.from_user.first_name)
|
98 |
+
time = till_date(con["time"])
|
99 |
+
media = con["media"]
|
100 |
+
media_type = con["media_type"]
|
101 |
+
tim_ = datetime.now() - time
|
102 |
+
tim_ = str(tim_).split(",")
|
103 |
+
tim = await get_hours(tim_[-1])
|
104 |
+
|
105 |
+
tims = tim_[0] + " " + tim
|
106 |
+
txt = reason + f"\nAfk since: {tims}"
|
107 |
+
|
108 |
+
if media_type == Types.TEXT:
|
109 |
+
await (await send_cmd(c,media_type))(
|
110 |
+
chat,
|
111 |
+
txt,
|
112 |
+
parse_mode=PM.MARKDOWN,
|
113 |
+
reply_to_message_id=repl.id,
|
114 |
+
)
|
115 |
+
else:
|
116 |
+
await (await send_cmd(c,media_type))(
|
117 |
+
chat,
|
118 |
+
media,
|
119 |
+
txt,
|
120 |
+
parse_mode=PM.MARKDOWN,
|
121 |
+
reply_to_message_id=repl.id
|
122 |
+
)
|
123 |
+
|
124 |
+
if is_afk:
|
125 |
+
txt = m.text
|
126 |
+
|
127 |
+
for cmd in cmds:
|
128 |
+
txt = txt.strip(cmd)
|
129 |
+
|
130 |
+
if txt in ["afk","brb"]:
|
131 |
+
return
|
132 |
+
else:
|
133 |
+
con = afk.get_afk(chat,user)
|
134 |
+
time = till_date(con["time"])
|
135 |
+
tim_ = datetime.now() - time
|
136 |
+
tim_ = str(tim_).split(",")
|
137 |
+
tim = await get_hours(tim_[-1])
|
138 |
+
tims = tim_[0] + " " + tim
|
139 |
+
txt = back_.fromat(m.from_user.mention) + f"\nAfk for: {tims}"
|
140 |
+
afk.delete_afk(chat,user)
|
141 |
+
return
|
142 |
+
|
143 |
+
__PLUGIN__ = "afk"
|
144 |
+
|
145 |
+
_DISABLE_CMDS_ = ["afk","brb"]
|
146 |
+
|
147 |
+
__alt_name__ = ["brb"]
|
148 |
+
|
149 |
+
__HELP__ = """
|
150 |
+
**AFK**
|
151 |
+
• /afk (/brb) [reason | reply to a message]
|
152 |
+
|
153 |
+
`reply to a message` can be any media or text
|
154 |
+
"""
|
155 |
+
|
156 |
+
|
157 |
+
|
Powers/plugins/antispam.py
CHANGED
@@ -5,8 +5,8 @@ from traceback import format_exc
|
|
5 |
from pyrogram.errors import MessageTooLong, PeerIdInvalid, UserIsBlocked
|
6 |
from pyrogram.types import Message
|
7 |
|
8 |
-
from Powers import (LOGGER, MESSAGE_DUMP, SUPPORT_GROUP,
|
9 |
-
|
10 |
from Powers.bot_class import Gojo
|
11 |
from Powers.database.antispam_db import GBan
|
12 |
from Powers.database.users_db import Users
|
@@ -18,7 +18,7 @@ from Powers.vars import Config
|
|
18 |
|
19 |
# Initialize
|
20 |
db = GBan()
|
21 |
-
|
22 |
|
23 |
@Gojo.on_message(command(["gban", "globalban"], sudo_cmd=True))
|
24 |
async def gban(c: Gojo, m: Message):
|
|
|
5 |
from pyrogram.errors import MessageTooLong, PeerIdInvalid, UserIsBlocked
|
6 |
from pyrogram.types import Message
|
7 |
|
8 |
+
from Powers import (LOGGER, MESSAGE_DUMP, SUPPORT_GROUP, TIME_ZONE,
|
9 |
+
get_support_staff)
|
10 |
from Powers.bot_class import Gojo
|
11 |
from Powers.database.antispam_db import GBan
|
12 |
from Powers.database.users_db import Users
|
|
|
18 |
|
19 |
# Initialize
|
20 |
db = GBan()
|
21 |
+
SUPPORT_STAFF = get_support_staff()
|
22 |
|
23 |
@Gojo.on_message(command(["gban", "globalban"], sudo_cmd=True))
|
24 |
async def gban(c: Gojo, m: Message):
|
Powers/plugins/approve.py
CHANGED
@@ -3,7 +3,7 @@ from pyrogram.enums import ChatMemberStatus as CMS
|
|
3 |
from pyrogram.errors import PeerIdInvalid, RPCError, UserNotParticipant
|
4 |
from pyrogram.types import CallbackQuery, Message
|
5 |
|
6 |
-
from Powers import LOGGER
|
7 |
from Powers.bot_class import Gojo
|
8 |
from Powers.database.approve_db import Approve
|
9 |
from Powers.utils.custom_filters import admin_filter, command, owner_filter
|
@@ -36,7 +36,7 @@ async def approve_user(c: Gojo, m: Message):
|
|
36 |
|
37 |
except RPCError as ef:
|
38 |
await m.reply_text(
|
39 |
-
f"<b>Error</b>: <code>{ef}</code>\nReport it
|
40 |
)
|
41 |
return
|
42 |
if member.status in (CMS.ADMINISTRATOR, CMS.OWNER):
|
@@ -95,7 +95,7 @@ async def disapprove_user(c: Gojo, m: Message):
|
|
95 |
return
|
96 |
except RPCError as ef:
|
97 |
await m.reply_text(
|
98 |
-
f"<b>Error</b>: <code>{ef}</code>\nReport it
|
99 |
)
|
100 |
return
|
101 |
|
|
|
3 |
from pyrogram.errors import PeerIdInvalid, RPCError, UserNotParticipant
|
4 |
from pyrogram.types import CallbackQuery, Message
|
5 |
|
6 |
+
from Powers import LOGGER
|
7 |
from Powers.bot_class import Gojo
|
8 |
from Powers.database.approve_db import Approve
|
9 |
from Powers.utils.custom_filters import admin_filter, command, owner_filter
|
|
|
36 |
|
37 |
except RPCError as ef:
|
38 |
await m.reply_text(
|
39 |
+
f"<b>Error</b>: <code>{ef}</code>\nReport it using /bug",
|
40 |
)
|
41 |
return
|
42 |
if member.status in (CMS.ADMINISTRATOR, CMS.OWNER):
|
|
|
95 |
return
|
96 |
except RPCError as ef:
|
97 |
await m.reply_text(
|
98 |
+
f"<b>Error</b>: <code>{ef}</code>\nReport it using /bug",
|
99 |
)
|
100 |
return
|
101 |
|
Powers/plugins/bans.py
CHANGED
@@ -9,7 +9,7 @@ from pyrogram.types import (CallbackQuery, ChatPrivileges,
|
|
9 |
InlineKeyboardButton, InlineKeyboardMarkup,
|
10 |
Message)
|
11 |
|
12 |
-
from Powers import LOGGER, MESSAGE_DUMP, OWNER_ID,
|
13 |
from Powers.bot_class import Gojo
|
14 |
from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
|
15 |
from Powers.utils.custom_filters import command, restrict_filter
|
@@ -19,6 +19,7 @@ from Powers.utils.parser import mention_html
|
|
19 |
from Powers.utils.string import extract_time
|
20 |
from Powers.vars import Config
|
21 |
|
|
|
22 |
|
23 |
@Gojo.on_message(command("tban") & restrict_filter)
|
24 |
async def tban_usr(c: Gojo, m: Message):
|
@@ -93,8 +94,6 @@ async def tban_usr(c: Gojo, m: Message):
|
|
93 |
txt = t_t[0] # Done this bcuz idk why t_t is tuple type data. SO now if it is tuple this will get text from it
|
94 |
if reason:
|
95 |
txt += f"\n<b>Reason</b>: {reason}"
|
96 |
-
else:
|
97 |
-
txt += "\n<b>Reason</b>: Not Specified"
|
98 |
if time_val:
|
99 |
txt += f"\n<b>Banned for</b>:{time_val}"
|
100 |
keyboard = InlineKeyboardMarkup(
|
@@ -309,9 +308,6 @@ async def dtban_usr(c: Gojo, m: Message):
|
|
309 |
txt = f"{admin} banned {banned} in <b>{chat_title}</b>!"
|
310 |
if reason:
|
311 |
txt += f"\n<b>Reason</b>: {reason}"
|
312 |
-
else:
|
313 |
-
txt += "\n<b>Reason</b>: Not Specified"
|
314 |
-
|
315 |
if bantime:
|
316 |
txt += f"\n<b>Banned for</b>: {time_val}"
|
317 |
keyboard = InlineKeyboardMarkup(
|
@@ -420,8 +416,6 @@ async def kick_usr(c: Gojo, m: Message):
|
|
420 |
txt = f"{admin} kicked {kicked} in <b>{chat_title}</b>!"
|
421 |
if reason:
|
422 |
txt += f"\n<b>Reason</b>: {reason}"
|
423 |
-
else:
|
424 |
-
txt += "\n<b>Reason</b>: Not Specified"
|
425 |
# await m.reply_text(txt, reply_to_message_id=r_id)
|
426 |
kickk = choice(KICK_GIFS)
|
427 |
try:
|
@@ -580,8 +574,6 @@ async def dkick_usr(c: Gojo, m: Message):
|
|
580 |
txt = f"{admin} kicked {kicked} in <b>{chat_title}</b>!"
|
581 |
if reason:
|
582 |
txt += f"\n<b>Reason</b>: {reason}"
|
583 |
-
else:
|
584 |
-
txt += "\n<b>Reason</b>: Not Specified"
|
585 |
kickk = choice(KICK_GIFS)
|
586 |
try:
|
587 |
await m.reply_animation(
|
@@ -660,8 +652,6 @@ async def unban_usr(c: Gojo, m: Message):
|
|
660 |
txt = f"{admin} unbanned {unbanned} in chat <b>{chat_title}</b>!"
|
661 |
if reason:
|
662 |
txt += f"\n<b>Reason</b>: {reason}"
|
663 |
-
else:
|
664 |
-
txt += "\n<b>Reason</b>: Not Specified"
|
665 |
await m.reply_text(txt)
|
666 |
except ChatAdminRequired:
|
667 |
await m.reply_text(text="I'm not admin or I don't have rights.")
|
@@ -809,8 +799,6 @@ async def dban_usr(c: Gojo, m: Message):
|
|
809 |
txt = f"{m.from_user.mention} banned {m.reply_to_message.from_user.mention} in <b>{m.chat.title}</b>!"
|
810 |
if reason:
|
811 |
txt += f"\n<b>Reason</b>: {reason}"
|
812 |
-
else:
|
813 |
-
txt += "\n<b>Reason</b>: Not Specified"
|
814 |
keyboard = InlineKeyboardMarkup(
|
815 |
[
|
816 |
[
|
@@ -914,8 +902,7 @@ async def ban_usr(c: Gojo, m: Message):
|
|
914 |
txt = f"{m.from_user.mention} banned {banned} in <b>{m.chat.title}</b>!"
|
915 |
if reason:
|
916 |
txt += f"\n<b>Reason</b>: {reason}"
|
917 |
-
|
918 |
-
txt += "\n<b>Reason</b>: Not Specified"
|
919 |
keyboard = InlineKeyboardMarkup(
|
920 |
[
|
921 |
[
|
@@ -1019,8 +1006,6 @@ async def kickme(c: Gojo, m: Message):
|
|
1019 |
txt = "Why not let me help you!"
|
1020 |
if reason:
|
1021 |
txt += f"\n<b>Reason</b>: {reason}"
|
1022 |
-
else:
|
1023 |
-
txt += "\n<b>Reason</b>: Not Specified"
|
1024 |
await m.reply_animation(animation=str(choice(KICK_GIFS)), caption=txt)
|
1025 |
await m.chat.unban_member(m.from_user.id)
|
1026 |
except RPCError as ef:
|
|
|
9 |
InlineKeyboardButton, InlineKeyboardMarkup,
|
10 |
Message)
|
11 |
|
12 |
+
from Powers import LOGGER, MESSAGE_DUMP, OWNER_ID, get_support_staff
|
13 |
from Powers.bot_class import Gojo
|
14 |
from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
|
15 |
from Powers.utils.custom_filters import command, restrict_filter
|
|
|
19 |
from Powers.utils.string import extract_time
|
20 |
from Powers.vars import Config
|
21 |
|
22 |
+
SUPPORT_STAFF = get_support_staff()
|
23 |
|
24 |
@Gojo.on_message(command("tban") & restrict_filter)
|
25 |
async def tban_usr(c: Gojo, m: Message):
|
|
|
94 |
txt = t_t[0] # Done this bcuz idk why t_t is tuple type data. SO now if it is tuple this will get text from it
|
95 |
if reason:
|
96 |
txt += f"\n<b>Reason</b>: {reason}"
|
|
|
|
|
97 |
if time_val:
|
98 |
txt += f"\n<b>Banned for</b>:{time_val}"
|
99 |
keyboard = InlineKeyboardMarkup(
|
|
|
308 |
txt = f"{admin} banned {banned} in <b>{chat_title}</b>!"
|
309 |
if reason:
|
310 |
txt += f"\n<b>Reason</b>: {reason}"
|
|
|
|
|
|
|
311 |
if bantime:
|
312 |
txt += f"\n<b>Banned for</b>: {time_val}"
|
313 |
keyboard = InlineKeyboardMarkup(
|
|
|
416 |
txt = f"{admin} kicked {kicked} in <b>{chat_title}</b>!"
|
417 |
if reason:
|
418 |
txt += f"\n<b>Reason</b>: {reason}"
|
|
|
|
|
419 |
# await m.reply_text(txt, reply_to_message_id=r_id)
|
420 |
kickk = choice(KICK_GIFS)
|
421 |
try:
|
|
|
574 |
txt = f"{admin} kicked {kicked} in <b>{chat_title}</b>!"
|
575 |
if reason:
|
576 |
txt += f"\n<b>Reason</b>: {reason}"
|
|
|
|
|
577 |
kickk = choice(KICK_GIFS)
|
578 |
try:
|
579 |
await m.reply_animation(
|
|
|
652 |
txt = f"{admin} unbanned {unbanned} in chat <b>{chat_title}</b>!"
|
653 |
if reason:
|
654 |
txt += f"\n<b>Reason</b>: {reason}"
|
|
|
|
|
655 |
await m.reply_text(txt)
|
656 |
except ChatAdminRequired:
|
657 |
await m.reply_text(text="I'm not admin or I don't have rights.")
|
|
|
799 |
txt = f"{m.from_user.mention} banned {m.reply_to_message.from_user.mention} in <b>{m.chat.title}</b>!"
|
800 |
if reason:
|
801 |
txt += f"\n<b>Reason</b>: {reason}"
|
|
|
|
|
802 |
keyboard = InlineKeyboardMarkup(
|
803 |
[
|
804 |
[
|
|
|
902 |
txt = f"{m.from_user.mention} banned {banned} in <b>{m.chat.title}</b>!"
|
903 |
if reason:
|
904 |
txt += f"\n<b>Reason</b>: {reason}"
|
905 |
+
|
|
|
906 |
keyboard = InlineKeyboardMarkup(
|
907 |
[
|
908 |
[
|
|
|
1006 |
txt = "Why not let me help you!"
|
1007 |
if reason:
|
1008 |
txt += f"\n<b>Reason</b>: {reason}"
|
|
|
|
|
1009 |
await m.reply_animation(animation=str(choice(KICK_GIFS)), caption=txt)
|
1010 |
await m.chat.unban_member(m.from_user.id)
|
1011 |
except RPCError as ef:
|
Powers/plugins/botstaff.py
CHANGED
@@ -1,11 +1,13 @@
|
|
1 |
from pyrogram.errors import RPCError
|
2 |
from pyrogram.types import Message
|
3 |
|
4 |
-
from Powers import
|
5 |
from Powers.bot_class import Gojo
|
6 |
from Powers.utils.custom_filters import command
|
7 |
from Powers.utils.parser import mention_html
|
8 |
|
|
|
|
|
9 |
|
10 |
@Gojo.on_message(command("botstaff", dev_cmd=True))
|
11 |
async def botstaff(c: Gojo, m: Message):
|
|
|
1 |
from pyrogram.errors import RPCError
|
2 |
from pyrogram.types import Message
|
3 |
|
4 |
+
from Powers import LOGGER, OWNER_ID, WHITELIST_USERS, get_support_staff
|
5 |
from Powers.bot_class import Gojo
|
6 |
from Powers.utils.custom_filters import command
|
7 |
from Powers.utils.parser import mention_html
|
8 |
|
9 |
+
DEV_USERS = get_support_staff("dev")
|
10 |
+
SUDO_USERS = get_support_staff("sudo")
|
11 |
|
12 |
@Gojo.on_message(command("botstaff", dev_cmd=True))
|
13 |
async def botstaff(c: Gojo, m: Message):
|
Powers/plugins/captcha.py
ADDED
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from random import shuffle
|
3 |
+
from traceback import format_exc
|
4 |
+
|
5 |
+
from pyrogram import filters
|
6 |
+
from pyrogram.types import CallbackQuery, ChatMemberUpdated, ChatPermissions
|
7 |
+
from pyrogram.types import InlineKeyboardButton as ikb
|
8 |
+
from pyrogram.types import InlineKeyboardMarkup as ikm
|
9 |
+
from pyrogram.types import Message
|
10 |
+
|
11 |
+
from Powers import LOGGER, get_support_staff
|
12 |
+
from Powers.bot_class import Gojo
|
13 |
+
from Powers.database.captcha_db import CAPTCHA, CAPTCHA_DATA
|
14 |
+
from Powers.utils.captcha_helper import (genrator, get_image_captcha,
|
15 |
+
get_qr_captcha)
|
16 |
+
from Powers.utils.custom_filters import admin_filter, command
|
17 |
+
|
18 |
+
SUPPORT_STAFF = get_support_staff()
|
19 |
+
|
20 |
+
@Gojo.on_message(command("captcha") & admin_filter & ~filters.private)
|
21 |
+
async def start_captcha(c: Gojo, m: Message):
|
22 |
+
captcha = CAPTCHA()
|
23 |
+
split = m.command
|
24 |
+
if len(split) == 1:
|
25 |
+
is_cap = captcha.is_captcha(m.chat.id)
|
26 |
+
if is_cap:
|
27 |
+
txt = "Captcha verification is currently **on** for this chat"
|
28 |
+
else:
|
29 |
+
txt = "Captcha verification is currently **off** for this chat"
|
30 |
+
await m.reply_text(txt)
|
31 |
+
return
|
32 |
+
else:
|
33 |
+
on_off = split[1]
|
34 |
+
if on_off in ["on","yes","enable"]:
|
35 |
+
captcha.insert_captcha(m.chat.id)
|
36 |
+
await m.reply_text("Captcha verification is now **on** for this chat")
|
37 |
+
return
|
38 |
+
elif on_off in ["off","no","disable"]:
|
39 |
+
captcha.remove_captcha(m.chat.id)
|
40 |
+
await m.reply_text("Captcha verification is now **off** for this chat")
|
41 |
+
return
|
42 |
+
else:
|
43 |
+
await m.reply_text("**USAGE**\n/captcha [on | yes | enable | off | no | disable]")
|
44 |
+
return
|
45 |
+
|
46 |
+
@Gojo.on_message(command("captchamode") & admin_filter & ~filters.private)
|
47 |
+
async def set_captcha_mode(c: Gojo, m: Message):
|
48 |
+
split = m.command
|
49 |
+
captcha = CAPTCHA()
|
50 |
+
if len(split) == 1:
|
51 |
+
curr = captcha.get_captcha(m.chat.id)
|
52 |
+
if curr:
|
53 |
+
capatcha_type = curr["captcha_type"]
|
54 |
+
await m.reply_text(f"Current captcha verification methode is {capatcha_type}\nAvailable methodes:\n■ qr\n■ image")
|
55 |
+
return
|
56 |
+
else:
|
57 |
+
await m.reply_text("Captcha verification is off for the current chat")
|
58 |
+
return
|
59 |
+
else:
|
60 |
+
type_ = split[1].lower()
|
61 |
+
if type_ == "qr":
|
62 |
+
captcha.update_type(m.chat.id, "qr")
|
63 |
+
await m.reply_text("Captcha verification is now changed to qr code")
|
64 |
+
return
|
65 |
+
elif type_ == "image":
|
66 |
+
captcha.update_type(m.chat.id,"image")
|
67 |
+
await m.reply_text("Captcha verication is now changed to image")
|
68 |
+
return
|
69 |
+
else:
|
70 |
+
await m.reply_text("**USAGE**\n/captchamode [qr | image]")
|
71 |
+
return
|
72 |
+
|
73 |
+
@Gojo.on_chat_member_updated(filters.group & filters.service,18)
|
74 |
+
async def joinss(c: Gojo, u: ChatMemberUpdated, m: Message):
|
75 |
+
chat = u.chat.id
|
76 |
+
user = u.from_user.id
|
77 |
+
|
78 |
+
is_qr = CAPTCHA().is_captcha()
|
79 |
+
if not is_qr:
|
80 |
+
return
|
81 |
+
|
82 |
+
captcha = CAPTCHA()
|
83 |
+
cap_data = CAPTCHA_DATA()
|
84 |
+
|
85 |
+
if user in SUPPORT_STAFF:
|
86 |
+
return
|
87 |
+
try:
|
88 |
+
await c.restrict_chat_member(chat,user,ChatPermissions())
|
89 |
+
except Exception as e:
|
90 |
+
LOGGER.error(e)
|
91 |
+
LOGGER.error(format_exc())
|
92 |
+
return
|
93 |
+
|
94 |
+
captcha_type = captcha.get_captcha(chat)
|
95 |
+
|
96 |
+
if captcha_type == "qr":
|
97 |
+
is_already = cap_data.is_already_data(chat, user)
|
98 |
+
|
99 |
+
try:
|
100 |
+
if is_already:
|
101 |
+
mess = await c.get_messages(chat,int(is_already))
|
102 |
+
except Exception:
|
103 |
+
cap_data.del_message_id(chat,is_already)
|
104 |
+
is_already = False
|
105 |
+
|
106 |
+
if not is_already:
|
107 |
+
pic = get_qr_captcha(chat, user)
|
108 |
+
cap = f"Please {u.from_user.mention} scan this qr code with your phone to verify that you are human"
|
109 |
+
ms = await m.reply_photo(pic,caption=cap)
|
110 |
+
cap_data.store_message_id(chat,user,ms.id)
|
111 |
+
return
|
112 |
+
else:
|
113 |
+
kb = ikm(
|
114 |
+
[
|
115 |
+
[
|
116 |
+
ikb("Click here to verify",url=mess.link)
|
117 |
+
]
|
118 |
+
]
|
119 |
+
)
|
120 |
+
await m.reply_text("You verification is already pending",reply_markup=kb)
|
121 |
+
return
|
122 |
+
|
123 |
+
elif captcha_type == "image":
|
124 |
+
is_already = cap_data.is_already_data(chat, user)
|
125 |
+
|
126 |
+
try:
|
127 |
+
if is_already:
|
128 |
+
mess = await c.get_messages(chat,int(is_already))
|
129 |
+
except Exception:
|
130 |
+
cap_data.del_message_id(chat,is_already)
|
131 |
+
is_already = False
|
132 |
+
|
133 |
+
if not is_already:
|
134 |
+
img, code = get_image_captcha(chat, user)
|
135 |
+
cap = f"Please {u.from_user.mention} please choose the correct code from the one given bellow\nYou have three tries if you get all three wrong u will be kicked from the chat.\nTries left: 3"
|
136 |
+
cap_data.load_cap_data(chat, user, code)
|
137 |
+
rand = [code]
|
138 |
+
while len(rand) != 5:
|
139 |
+
hehe = genrator()
|
140 |
+
rand.append(hehe)
|
141 |
+
|
142 |
+
shuffle(rand)
|
143 |
+
|
144 |
+
ini = f"captcha_{chat}_{user}_"
|
145 |
+
|
146 |
+
kb = ikm(
|
147 |
+
[
|
148 |
+
ikb(rand[0],ini+rand[0])
|
149 |
+
],
|
150 |
+
[
|
151 |
+
ikb(rand[1],ini+rand[1])
|
152 |
+
],
|
153 |
+
[
|
154 |
+
ikb(rand[2],ini+rand[2])
|
155 |
+
],
|
156 |
+
[
|
157 |
+
ikb(rand[3],ini+rand[3])
|
158 |
+
],
|
159 |
+
[
|
160 |
+
ikb(rand[4],ini+rand[4])
|
161 |
+
]
|
162 |
+
)
|
163 |
+
await m.reply_photo(img,caption=cap,reply_markup=kb)
|
164 |
+
return
|
165 |
+
else:
|
166 |
+
kb = ikm(
|
167 |
+
[
|
168 |
+
[
|
169 |
+
ikb("Click here to verify",url=mess.link)
|
170 |
+
]
|
171 |
+
]
|
172 |
+
)
|
173 |
+
await m.reply_text("You verification is already pending",reply_markup=kb)
|
174 |
+
return
|
175 |
+
|
176 |
+
@Gojo.on_callback_query(filters.regex("^captcha_"))
|
177 |
+
async def captcha_codes_check(c: Gojo, q: CallbackQuery):
|
178 |
+
split = q.data.split("_")
|
179 |
+
chat = int(split[1])
|
180 |
+
user = int(split[2])
|
181 |
+
code = split[3]
|
182 |
+
|
183 |
+
if q.from_user.id != user:
|
184 |
+
await q.answer("Not for you BAKA!")
|
185 |
+
return
|
186 |
+
|
187 |
+
c_data = CAPTCHA_DATA()
|
188 |
+
code_ = c_data.get_cap_data(chat,user)
|
189 |
+
|
190 |
+
|
191 |
+
if code_ == code:
|
192 |
+
cap = "You guessed the captcha right...Now you can talk in the chat with no restrictions"
|
193 |
+
c_data.remove_cap_data(chat,user)
|
194 |
+
await q.answer(cap)
|
195 |
+
try:
|
196 |
+
await q.message.chat.unban_member(user)
|
197 |
+
except Exception as e:
|
198 |
+
await q.message.reply_text(f"Unable to unmute {q.from_user.mention} this user")
|
199 |
+
await q.message.reply_text(e)
|
200 |
+
return
|
201 |
+
await c.send_message(f"{q.from_user.mention} now you are free to talk")
|
202 |
+
await q.message.delete()
|
203 |
+
return
|
204 |
+
else:
|
205 |
+
await q.answer("Wrong")
|
206 |
+
caps = q.message.caption.split(":")
|
207 |
+
tries = int(caps[1].strip()) - 1
|
208 |
+
caps.pop(-1)
|
209 |
+
caps.append(f" {tries}")
|
210 |
+
new_cap = ":".join(caps)
|
211 |
+
if not tries:
|
212 |
+
new_cap = f"You have zero tries left now. I am going to kick you know coz you failed to solve captcha...see yaa {q.from_user.mention}"
|
213 |
+
try:
|
214 |
+
await q.message.chat.ban_member(user)
|
215 |
+
except Exception as e:
|
216 |
+
await q.message.reply_text("Failed to kick member")
|
217 |
+
return
|
218 |
+
await q.message.delete()
|
219 |
+
await q.message.reply_text(new_cap)
|
220 |
+
await c.unban_chat_member(chat,user)
|
221 |
+
|
222 |
+
else:
|
223 |
+
await q.edit_message_caption(new_cap)
|
224 |
+
return
|
Powers/plugins/dev.py
CHANGED
@@ -7,16 +7,21 @@ from sys import executable
|
|
7 |
from time import gmtime, strftime, time
|
8 |
from traceback import format_exc
|
9 |
|
|
|
10 |
from pyrogram.errors import (ChannelInvalid, ChannelPrivate, ChatAdminRequired,
|
11 |
EntityBoundsInvalid, FloodWait, MessageTooLong,
|
12 |
PeerIdInvalid, RPCError)
|
|
|
|
|
13 |
from pyrogram.types import Message
|
14 |
|
15 |
-
from Powers import (BOT_TOKEN,
|
16 |
-
|
17 |
from Powers.bot_class import Gojo
|
18 |
from Powers.database import MongoDB
|
19 |
from Powers.database.chats_db import Chats
|
|
|
|
|
20 |
from Powers.plugins.clean_db import clean_my_db
|
21 |
from Powers.utils.clean_file import remove_markdown_and_html
|
22 |
from Powers.utils.custom_filters import command
|
@@ -24,41 +29,169 @@ from Powers.utils.extract_user import extract_user
|
|
24 |
from Powers.utils.parser import mention_markdown
|
25 |
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
return
|
32 |
-
split = m.
|
33 |
reply_to = m.reply_to_message
|
34 |
-
if
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
return
|
38 |
-
|
39 |
-
|
40 |
-
await m.reply_text("Give me an id")
|
41 |
-
return
|
42 |
-
elif reply_to:
|
43 |
-
user = reply_to.from_user.id
|
44 |
-
elif len(split) == 2:
|
45 |
try:
|
46 |
-
|
47 |
-
except Exception
|
48 |
-
await m.reply_text(
|
49 |
return
|
50 |
-
|
51 |
try:
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
54 |
return
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
return
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
return
|
61 |
-
|
62 |
@Gojo.on_message(command("ping", sudo_cmd=True))
|
63 |
async def ping(_, m: Message):
|
64 |
LOGGER.info(f"{m.from_user.id} used ping cmd in {m.chat.id}")
|
@@ -199,7 +332,7 @@ async def evaluate_code(c: Gojo, m: Message):
|
|
199 |
f"@{m.from_user.username} TREID TO FETCH ENV OF BOT \n userid = {m.from_user.id}",
|
200 |
)
|
201 |
for j in HARMFUL:
|
202 |
-
if j in evaluation:
|
203 |
if m.from_user.id != OWNER_ID:
|
204 |
evaluation = "Bhaag ja bsdk"
|
205 |
await c.send_message(
|
@@ -480,6 +613,58 @@ async def chat_broadcast(c: Gojo, m: Message):
|
|
480 |
|
481 |
return
|
482 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
483 |
@Gojo.on_message(command(["cleandb","cleandatabase"],sudo_cmd=True))
|
484 |
async def cleeeen(c:Gojo,m:Message):
|
485 |
x = await m.reply_text("Cleaning the database...")
|
@@ -518,6 +703,11 @@ __HELP__ = """
|
|
518 |
• /uptime : Return the uptime of the bot.
|
519 |
• /leavechat : Bot will leave the provided chat.
|
520 |
• /chatbroadcast : Broadcast the messge to chats.
|
|
|
|
|
|
|
|
|
|
|
521 |
|
522 |
**Sudoer's command:**
|
523 |
• /ping : return the ping of the bot.
|
|
|
7 |
from time import gmtime, strftime, time
|
8 |
from traceback import format_exc
|
9 |
|
10 |
+
from pyrogram import filters
|
11 |
from pyrogram.errors import (ChannelInvalid, ChannelPrivate, ChatAdminRequired,
|
12 |
EntityBoundsInvalid, FloodWait, MessageTooLong,
|
13 |
PeerIdInvalid, RPCError)
|
14 |
+
from pyrogram.types import InlineKeyboardButton as IKB
|
15 |
+
from pyrogram.types import InlineKeyboardMarkup as IKM
|
16 |
from pyrogram.types import Message
|
17 |
|
18 |
+
from Powers import (BOT_TOKEN, LOG_DATETIME, LOGFILE, LOGGER, MESSAGE_DUMP,
|
19 |
+
OWNER_ID, UPTIME, get_support_staff)
|
20 |
from Powers.bot_class import Gojo
|
21 |
from Powers.database import MongoDB
|
22 |
from Powers.database.chats_db import Chats
|
23 |
+
from Powers.database.support_db import SUPPORTS
|
24 |
+
from Powers.database.users_db import Users
|
25 |
from Powers.plugins.clean_db import clean_my_db
|
26 |
from Powers.utils.clean_file import remove_markdown_and_html
|
27 |
from Powers.utils.custom_filters import command
|
|
|
29 |
from Powers.utils.parser import mention_markdown
|
30 |
|
31 |
|
32 |
+
def can_change_type(curr, to_user):
|
33 |
+
if curr == "dev" and to_user in ["whitelist","sudo"]:
|
34 |
+
return True
|
35 |
+
elif curr == "sudo" and to_user == "whitelist":
|
36 |
+
return True
|
37 |
+
else:
|
38 |
+
return False
|
39 |
+
|
40 |
+
@Gojo.on_message(command(["addsupport"]))
|
41 |
+
async def add_support(c: Gojo, m:Message):
|
42 |
+
support = SUPPORTS()
|
43 |
+
curr_user = support.get_support_type(m.from_user.id)
|
44 |
+
if not curr_user:
|
45 |
+
await m.reply_text("Stay in you limit")
|
46 |
return
|
47 |
+
split = m.command
|
48 |
reply_to = m.reply_to_message
|
49 |
+
if reply_to:
|
50 |
+
try:
|
51 |
+
userr = reply_to.from_user.id
|
52 |
+
except Exception:
|
53 |
+
await m.reply_text("Reply to an user")
|
54 |
+
return
|
55 |
+
curr = support.get_support_type(userr)
|
56 |
+
try:
|
57 |
+
to = split[1].lower()
|
58 |
+
except IndexError:
|
59 |
+
await m.reply_text("**USAGE**\n/addsupport [reply to message | user id] [dev | sudo | whitelist]")
|
60 |
+
return
|
61 |
+
if to not in ["dev","sudo","whitelist"]:
|
62 |
+
await m.reply_text("**USAGE**\n/addsupport [reply to message | user id] [dev | sudo | whitelist]")
|
63 |
+
return
|
64 |
+
if m.from_user.id == int(OWNER_ID):
|
65 |
+
if to == curr:
|
66 |
+
await m.reply_text(f"This user is already in {to} users")
|
67 |
+
return
|
68 |
+
elif curr:
|
69 |
+
kb = IKM(
|
70 |
+
[
|
71 |
+
[
|
72 |
+
IKB("Yes",f"change_support_type:{to}"),
|
73 |
+
IKB("No","change_support_type:no")
|
74 |
+
]
|
75 |
+
]
|
76 |
+
)
|
77 |
+
await m.reply_text(f"This is user is already in {curr} users\nDo you want to make him {to} user?",reply_markup=kb)
|
78 |
+
return
|
79 |
+
else:
|
80 |
+
support.insert_support_user(userr,to)
|
81 |
+
await m.reply_text(f"This user is now a {to} user")
|
82 |
+
return
|
83 |
+
can_do = can_change_type(curr_user,to)
|
84 |
+
if can_do:
|
85 |
+
if to == curr:
|
86 |
+
await m.reply_text(f"This user is already in {to} users")
|
87 |
+
return
|
88 |
+
elif curr:
|
89 |
+
kb = IKM(
|
90 |
+
[
|
91 |
+
[
|
92 |
+
IKB("Yes",f"change_support_type:{to}"),
|
93 |
+
IKB("No","change_support_type:no")
|
94 |
+
]
|
95 |
+
]
|
96 |
+
)
|
97 |
+
await m.reply_text(f"This is user is already in {curr} users\nDo you want to make him {to} user?",reply_markup=kb)
|
98 |
+
return
|
99 |
+
else:
|
100 |
+
support.insert_support_user(userr,to)
|
101 |
+
await m.reply_text(f"This user is now a {to} user")
|
102 |
+
return
|
103 |
+
else:
|
104 |
+
await m.reply_text("Sorry you can't do it")
|
105 |
return
|
106 |
+
elif len(split) >= 3:
|
107 |
+
user = split[1]
|
|
|
|
|
|
|
|
|
|
|
108 |
try:
|
109 |
+
userr,_,_ = extract_user(user)
|
110 |
+
except Exception:
|
111 |
+
await m.reply_text("Tell the user to start me first")
|
112 |
return
|
113 |
+
curr = support.get_support_type(userr)
|
114 |
try:
|
115 |
+
to = m.command[2].lower()
|
116 |
+
except IndexError:
|
117 |
+
await m.reply_text("**USAGE**\n/addsupport [reply to message | user id | username] [dev | sudo | whitelist]")
|
118 |
+
return
|
119 |
+
if to not in ["dev","sudo","whitelist"]:
|
120 |
+
await m.reply_text("**USAGE**\n/addsupport [reply to message | user id] [dev | sudo | whitelist]")
|
121 |
return
|
122 |
+
if m.from_user.id == int(OWNER_ID):
|
123 |
+
if to == curr:
|
124 |
+
await m.reply_text(f"This user is already in {to} users")
|
125 |
+
return
|
126 |
+
elif curr:
|
127 |
+
kb = IKM(
|
128 |
+
[
|
129 |
+
[
|
130 |
+
IKB("Yes",f"change_support_type:{to}"),
|
131 |
+
IKB("No","change_support_type:no")
|
132 |
+
]
|
133 |
+
]
|
134 |
+
)
|
135 |
+
await m.reply_text(f"This is user is already in {curr} users\nDo you want to make him {to} user?",reply_markup=kb)
|
136 |
+
return
|
137 |
+
else:
|
138 |
+
support.insert_support_user(userr,to)
|
139 |
+
await m.reply_text(f"This user is now a {to} user")
|
140 |
+
return
|
141 |
+
can_do = can_change_type(curr_user,to)
|
142 |
+
if can_do:
|
143 |
+
if to == curr:
|
144 |
+
await m.reply_text(f"This user is already in {to} users")
|
145 |
+
return
|
146 |
+
elif curr:
|
147 |
+
kb = IKM(
|
148 |
+
[
|
149 |
+
[
|
150 |
+
IKB("Yes",f"change_support_type:{to}"),
|
151 |
+
IKB("No","change_support_type:no")
|
152 |
+
]
|
153 |
+
]
|
154 |
+
)
|
155 |
+
await m.reply_text(f"This is user is already in {curr} users\nDo you want to make him {to} user?",reply_markup=kb)
|
156 |
+
return
|
157 |
+
else:
|
158 |
+
support.insert_support_user(userr,to)
|
159 |
+
await m.reply_text(f"This user is now a {to} user")
|
160 |
+
return
|
161 |
+
else:
|
162 |
+
await m.reply_text("Sorry you can't do it")
|
163 |
return
|
164 |
+
|
165 |
+
@Gojo.on_message(command("rmsupport"))
|
166 |
+
async def rm_support(c: Gojo, m: Message):
|
167 |
+
support = SUPPORTS()
|
168 |
+
curr_user = support.get_support_type(m.from_user.id)
|
169 |
+
if not curr_user:
|
170 |
+
await m.reply_text("Stay in you limit")
|
171 |
+
return
|
172 |
+
split = m.command
|
173 |
+
reply_to = m.reply_to_message
|
174 |
+
|
175 |
+
if reply_to:
|
176 |
+
try:
|
177 |
+
curr = reply_to.from_user.id
|
178 |
+
except Exception:
|
179 |
+
await m.reply_text("Reply to an user")
|
180 |
+
return
|
181 |
+
support.delete_support_user(curr)
|
182 |
+
await m.reply_text("Done")
|
183 |
+
elif len(split) >= 2:
|
184 |
+
try:
|
185 |
+
user,_,_ = extract_user(split[1])
|
186 |
+
except Exception:
|
187 |
+
await m.reply_text("Dunno who u r talking abt")
|
188 |
+
return
|
189 |
+
support.delete_support_user(user)
|
190 |
+
await m.reply_text("Done")
|
191 |
+
else:
|
192 |
+
await m.reply_text("**USAGE**\n/rmsupport [reply to user | user id | username]")
|
193 |
return
|
194 |
+
|
195 |
@Gojo.on_message(command("ping", sudo_cmd=True))
|
196 |
async def ping(_, m: Message):
|
197 |
LOGGER.info(f"{m.from_user.id} used ping cmd in {m.chat.id}")
|
|
|
332 |
f"@{m.from_user.username} TREID TO FETCH ENV OF BOT \n userid = {m.from_user.id}",
|
333 |
)
|
334 |
for j in HARMFUL:
|
335 |
+
if j in evaluation.split() or j in cmd:
|
336 |
if m.from_user.id != OWNER_ID:
|
337 |
evaluation = "Bhaag ja bsdk"
|
338 |
await c.send_message(
|
|
|
613 |
|
614 |
return
|
615 |
|
616 |
+
@Gojo.on_message(command(["forward","fwd"]),dev_cmd=True)
|
617 |
+
async def forward_type_broadcast(c: Gojo, m: Message):
|
618 |
+
repl = m.reply_to_message
|
619 |
+
if not repl:
|
620 |
+
await m.reply_text("Please reply to message to broadcast it")
|
621 |
+
return
|
622 |
+
split = m.command
|
623 |
+
|
624 |
+
chat = Chats.list_chats_by_id()
|
625 |
+
user = [i["_id"] for i in Users.list_users()]
|
626 |
+
alll = chat + user
|
627 |
+
if len(split) != 2:
|
628 |
+
tag = "all"
|
629 |
+
else:
|
630 |
+
try:
|
631 |
+
if split[0].lower() == "-u":
|
632 |
+
tag = "user"
|
633 |
+
elif split[0].lower() == "-c":
|
634 |
+
tag = "chat"
|
635 |
+
else:
|
636 |
+
tag = "all"
|
637 |
+
except IndexError:
|
638 |
+
pass
|
639 |
+
if tag == "chat":
|
640 |
+
peers = chat
|
641 |
+
elif tag == "user":
|
642 |
+
peers = user
|
643 |
+
else:
|
644 |
+
peers = alll
|
645 |
+
|
646 |
+
xx = await m.reply_text("Broadcasting...")
|
647 |
+
|
648 |
+
failed = 0
|
649 |
+
total = len(peers)
|
650 |
+
for peer in peers:
|
651 |
+
try:
|
652 |
+
await repl.forward(int(peer))
|
653 |
+
await sleep(0.1)
|
654 |
+
except Exception:
|
655 |
+
failed += 1
|
656 |
+
pass
|
657 |
+
txt = f"Broadcasted message to {total-failed} peers out of {total}\nFailed to broadcast message to {failed} peers"
|
658 |
+
if not failed:
|
659 |
+
txt = f"Broadcasted message to {total} peers"
|
660 |
+
await m.reply_text(txt)
|
661 |
+
try:
|
662 |
+
await xx.delete()
|
663 |
+
except Exception:
|
664 |
+
pass
|
665 |
+
return
|
666 |
+
|
667 |
+
|
668 |
@Gojo.on_message(command(["cleandb","cleandatabase"],sudo_cmd=True))
|
669 |
async def cleeeen(c:Gojo,m:Message):
|
670 |
x = await m.reply_text("Cleaning the database...")
|
|
|
703 |
• /uptime : Return the uptime of the bot.
|
704 |
• /leavechat : Bot will leave the provided chat.
|
705 |
• /chatbroadcast : Broadcast the messge to chats.
|
706 |
+
• /forward (/fwd) [tag] : Forward message to peers according to tag. Default to all
|
707 |
+
Available tags:
|
708 |
+
`-u` : For users
|
709 |
+
`-c` : For chats
|
710 |
+
`-all` : For all
|
711 |
|
712 |
**Sudoer's command:**
|
713 |
• /ping : return the ping of the bot.
|
Powers/plugins/flood.py
CHANGED
@@ -10,7 +10,7 @@ from pyrogram.types import (CallbackQuery, ChatPermissions,
|
|
10 |
InlineKeyboardButton, InlineKeyboardMarkup,
|
11 |
Message)
|
12 |
|
13 |
-
from Powers import LOGGER, SUPPORT_GROUP,
|
14 |
from Powers.bot_class import Gojo
|
15 |
from Powers.database.approve_db import Approve
|
16 |
from Powers.database.flood_db import Floods
|
@@ -19,6 +19,8 @@ from Powers.utils.extras import BAN_GIFS, KICK_GIFS, MUTE_GIFS
|
|
19 |
from Powers.utils.kbhelpers import ikb
|
20 |
from Powers.vars import Config
|
21 |
|
|
|
|
|
22 |
on_key = ["on", "start", "disable"]
|
23 |
off_key = ["off", "end", "enable", "stop"]
|
24 |
|
@@ -408,7 +410,7 @@ async def flood_watcher(c: Gojo, m: Message):
|
|
408 |
],
|
409 |
],
|
410 |
)
|
411 |
-
txt = "Don't dare to spam here if I am around!"
|
412 |
await m.reply_animation(
|
413 |
animation=str(choice(BAN_GIFS)),
|
414 |
caption=txt,
|
@@ -440,7 +442,7 @@ async def flood_watcher(c: Gojo, m: Message):
|
|
440 |
elif action == "kick":
|
441 |
try:
|
442 |
await m.chat.ban_member(u_id)
|
443 |
-
txt = "Don't dare to spam here if I am around!"
|
444 |
await m.reply_animation(
|
445 |
animation=str(choice(KICK_GIFS)),
|
446 |
caption=txt,
|
@@ -483,7 +485,7 @@ async def flood_watcher(c: Gojo, m: Message):
|
|
483 |
],
|
484 |
],
|
485 |
)
|
486 |
-
txt = "Don't dare to spam here if I am around!"
|
487 |
await m.reply_animation(
|
488 |
animation=str(choice(MUTE_GIFS)),
|
489 |
caption=txt,
|
|
|
10 |
InlineKeyboardButton, InlineKeyboardMarkup,
|
11 |
Message)
|
12 |
|
13 |
+
from Powers import LOGGER, SUPPORT_GROUP, get_support_staff
|
14 |
from Powers.bot_class import Gojo
|
15 |
from Powers.database.approve_db import Approve
|
16 |
from Powers.database.flood_db import Floods
|
|
|
19 |
from Powers.utils.kbhelpers import ikb
|
20 |
from Powers.vars import Config
|
21 |
|
22 |
+
SUPPORT_STAFF = get_support_staff()
|
23 |
+
|
24 |
on_key = ["on", "start", "disable"]
|
25 |
off_key = ["off", "end", "enable", "stop"]
|
26 |
|
|
|
410 |
],
|
411 |
],
|
412 |
)
|
413 |
+
txt = "Don't dare to spam here if I am around! Nothing can escape my 6 eyes\nAction: Baned\nReason: Spaming"
|
414 |
await m.reply_animation(
|
415 |
animation=str(choice(BAN_GIFS)),
|
416 |
caption=txt,
|
|
|
442 |
elif action == "kick":
|
443 |
try:
|
444 |
await m.chat.ban_member(u_id)
|
445 |
+
txt = "Don't dare to spam here if I am around! Nothing can escape my 6 eyes\nAction: kicked\nReason: Spaming"
|
446 |
await m.reply_animation(
|
447 |
animation=str(choice(KICK_GIFS)),
|
448 |
caption=txt,
|
|
|
485 |
],
|
486 |
],
|
487 |
)
|
488 |
+
txt = "Don't dare to spam here if I am around! Nothing can escape my 6 eyes\nAction: Muted\nReason: Spaming"
|
489 |
await m.reply_animation(
|
490 |
animation=str(choice(MUTE_GIFS)),
|
491 |
caption=txt,
|
Powers/plugins/fun.py
CHANGED
@@ -5,13 +5,14 @@ from pyrogram import enums
|
|
5 |
from pyrogram.errors import MessageTooLong
|
6 |
from pyrogram.types import Message
|
7 |
|
8 |
-
from Powers import
|
9 |
from Powers.bot_class import Gojo
|
10 |
from Powers.utils import extras
|
11 |
from Powers.utils.custom_filters import command
|
12 |
from Powers.utils.extras import NOWYES as NO
|
13 |
from Powers.utils.extras import YESWNO as YES
|
14 |
|
|
|
15 |
|
16 |
@Gojo.on_message(command("shout"))
|
17 |
async def fun_shout(_, m: Message):
|
|
|
5 |
from pyrogram.errors import MessageTooLong
|
6 |
from pyrogram.types import Message
|
7 |
|
8 |
+
from Powers import LOGGER, get_support_staff
|
9 |
from Powers.bot_class import Gojo
|
10 |
from Powers.utils import extras
|
11 |
from Powers.utils.custom_filters import command
|
12 |
from Powers.utils.extras import NOWYES as NO
|
13 |
from Powers.utils.extras import YESWNO as YES
|
14 |
|
15 |
+
DEV_USERS = get_support_staff("dev")
|
16 |
|
17 |
@Gojo.on_message(command("shout"))
|
18 |
async def fun_shout(_, m: Message):
|
Powers/plugins/greetings.py
CHANGED
@@ -6,7 +6,7 @@ from pyrogram.enums import ChatMemberStatus as CMS
|
|
6 |
from pyrogram.errors import ChatAdminRequired, RPCError
|
7 |
from pyrogram.types import ChatMemberUpdated, InlineKeyboardMarkup, Message
|
8 |
|
9 |
-
from Powers import
|
10 |
from Powers.bot_class import Gojo
|
11 |
from Powers.database.antispam_db import GBan
|
12 |
from Powers.database.greetings_db import Greetings
|
@@ -21,6 +21,8 @@ from Powers.vars import Config
|
|
21 |
# Initialize
|
22 |
gdb = GBan()
|
23 |
|
|
|
|
|
24 |
ChatType = enums.ChatType
|
25 |
|
26 |
|
|
|
6 |
from pyrogram.errors import ChatAdminRequired, RPCError
|
7 |
from pyrogram.types import ChatMemberUpdated, InlineKeyboardMarkup, Message
|
8 |
|
9 |
+
from Powers import get_support_staff
|
10 |
from Powers.bot_class import Gojo
|
11 |
from Powers.database.antispam_db import GBan
|
12 |
from Powers.database.greetings_db import Greetings
|
|
|
21 |
# Initialize
|
22 |
gdb = GBan()
|
23 |
|
24 |
+
DEV_USERS = get_support_staff("dev")
|
25 |
+
|
26 |
ChatType = enums.ChatType
|
27 |
|
28 |
|
Powers/plugins/info.py
CHANGED
@@ -9,8 +9,7 @@ from pyrogram.raw.functions.channels import GetFullChannel
|
|
9 |
from pyrogram.raw.functions.users import GetFullUser
|
10 |
from pyrogram.types import Message
|
11 |
|
12 |
-
from Powers import
|
13 |
-
WHITELIST_USERS)
|
14 |
from Powers.bot_class import Gojo
|
15 |
from Powers.database.antispam_db import GBan
|
16 |
from Powers.utils.custom_filters import command
|
@@ -83,6 +82,10 @@ async def user_info(c: Gojo, user, already=False):
|
|
83 |
about = ll.full_user.about
|
84 |
except Exception:
|
85 |
pass
|
|
|
|
|
|
|
|
|
86 |
username = user.username
|
87 |
first_name = user.first_name
|
88 |
last_name = user.last_name
|
|
|
9 |
from pyrogram.raw.functions.users import GetFullUser
|
10 |
from pyrogram.types import Message
|
11 |
|
12 |
+
from Powers import LOGGER, OWNER_ID, get_support_staff
|
|
|
13 |
from Powers.bot_class import Gojo
|
14 |
from Powers.database.antispam_db import GBan
|
15 |
from Powers.utils.custom_filters import command
|
|
|
82 |
about = ll.full_user.about
|
83 |
except Exception:
|
84 |
pass
|
85 |
+
SUPPORT_STAFF = get_support_staff()
|
86 |
+
DEV_USERS = get_support_staff("dev")
|
87 |
+
SUDO_USERS = get_support_staff("sudo")
|
88 |
+
WHITELIST_USERS = get_support_staff("whitelist")
|
89 |
username = user.username
|
90 |
first_name = user.first_name
|
91 |
last_name = user.last_name
|
Powers/plugins/locks.py
CHANGED
@@ -6,43 +6,45 @@ from pyrogram.enums import MessageEntityType as MET
|
|
6 |
from pyrogram.errors import ChatAdminRequired, ChatNotModified, RPCError
|
7 |
from pyrogram.types import ChatPermissions, Message
|
8 |
|
9 |
-
from Powers import
|
10 |
from Powers.bot_class import Gojo
|
11 |
from Powers.database.approve_db import Approve
|
12 |
from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
|
13 |
from Powers.utils.custom_filters import command, restrict_filter
|
14 |
from Powers.vars import Config
|
15 |
|
16 |
-
SUDO_LEVEL =
|
17 |
|
18 |
anti_c_send = [-1001604479593]
|
19 |
anti_forward = [-1001604479593]
|
20 |
anti_forward_u = []
|
21 |
anti_forward_c = []
|
22 |
anti_links = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
@Gojo.on_message(command("locktypes"))
|
24 |
async def lock_types(_, m: Message):
|
25 |
await m.reply_text(
|
26 |
-
|
27 |
-
"**Lock Types:**\n"
|
28 |
-
" - `all` = Everything\n"
|
29 |
-
" - `msg` = Messages\n"
|
30 |
-
" - `media` = Media, such as Photo and Video.\n"
|
31 |
-
" - `polls` = Polls\n"
|
32 |
-
" - `invite` = Add users to Group\n"
|
33 |
-
" - `pin` = Pin Messages\n"
|
34 |
-
" - `info` = Change Group Info\n"
|
35 |
-
" - `webprev` = Web Page Previews\n"
|
36 |
-
" - `inlinebots`, `inline` = Inline bots\n"
|
37 |
-
" - `animations` = Animations\n"
|
38 |
-
" - `games` = Game Bots\n"
|
39 |
-
" - `stickers` = Stickers\n"
|
40 |
-
" - `anonchannel` = Send as chat will be locked\n"
|
41 |
-
" - `forwardall` = Forwarding from channel and user\n"
|
42 |
-
" - `forwardu` = Forwarding from user\n"
|
43 |
-
" - `forwardc` = Forwarding from channel\n"
|
44 |
-
" - `links | url` = Lock links"
|
45 |
-
),
|
46 |
)
|
47 |
return
|
48 |
|
@@ -532,6 +534,11 @@ __PLUGIN__ = "locks"
|
|
532 |
|
533 |
__alt_name__ = ["grouplock", "lock", "grouplocks"]
|
534 |
|
|
|
|
|
|
|
|
|
|
|
535 |
__HELP__ = """
|
536 |
**Locks**
|
537 |
|
|
|
6 |
from pyrogram.errors import ChatAdminRequired, ChatNotModified, RPCError
|
7 |
from pyrogram.types import ChatPermissions, Message
|
8 |
|
9 |
+
from Powers import LOGGER, get_support_staff
|
10 |
from Powers.bot_class import Gojo
|
11 |
from Powers.database.approve_db import Approve
|
12 |
from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
|
13 |
from Powers.utils.custom_filters import command, restrict_filter
|
14 |
from Powers.vars import Config
|
15 |
|
16 |
+
SUDO_LEVEL = get_support_staff("sudo_level")
|
17 |
|
18 |
anti_c_send = [-1001604479593]
|
19 |
anti_forward = [-1001604479593]
|
20 |
anti_forward_u = []
|
21 |
anti_forward_c = []
|
22 |
anti_links = []
|
23 |
+
|
24 |
+
l_t = """
|
25 |
+
**Lock Types:**
|
26 |
+
- `all` = Everything
|
27 |
+
- `msg` = Messages
|
28 |
+
- `media` = Media, such as Photo and Video.
|
29 |
+
- `polls` = Polls
|
30 |
+
- `invite` = Add users to Group
|
31 |
+
- `pin` = Pin Messages
|
32 |
+
- `info` = Change Group Info
|
33 |
+
- `webprev` = Web Page Previews
|
34 |
+
- `inlinebots`, `inline` = Inline bots
|
35 |
+
- `animations` = Animations
|
36 |
+
- `games` = Game Bots
|
37 |
+
- `stickers` = Stickers
|
38 |
+
- `anonchannel` = Send as chat will be locked
|
39 |
+
- `forwardall` = Forwarding from channel and user
|
40 |
+
- `forwardu` = Forwarding from user
|
41 |
+
- `forwardc` = Forwarding from channel
|
42 |
+
- `links | url` = Lock links"""
|
43 |
+
|
44 |
@Gojo.on_message(command("locktypes"))
|
45 |
async def lock_types(_, m: Message):
|
46 |
await m.reply_text(
|
47 |
+
l_t
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
)
|
49 |
return
|
50 |
|
|
|
534 |
|
535 |
__alt_name__ = ["grouplock", "lock", "grouplocks"]
|
536 |
|
537 |
+
__buttons__ = [
|
538 |
+
[
|
539 |
+
("Lock Types", "LOCK_TYPES"),
|
540 |
+
],]
|
541 |
+
|
542 |
__HELP__ = """
|
543 |
**Locks**
|
544 |
|
Powers/plugins/muting.py
CHANGED
@@ -9,7 +9,7 @@ from pyrogram.types import (CallbackQuery, ChatPermissions,
|
|
9 |
InlineKeyboardButton, InlineKeyboardMarkup,
|
10 |
Message)
|
11 |
|
12 |
-
from Powers import LOGGER, MESSAGE_DUMP, OWNER_ID,
|
13 |
from Powers.bot_class import Gojo
|
14 |
from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
|
15 |
from Powers.utils.custom_filters import command, restrict_filter
|
@@ -19,6 +19,7 @@ from Powers.utils.parser import mention_html
|
|
19 |
from Powers.utils.string import extract_time
|
20 |
from Powers.vars import Config
|
21 |
|
|
|
22 |
|
23 |
@Gojo.on_message(command("tmute") & restrict_filter)
|
24 |
async def tmute_usr(c: Gojo, m: Message):
|
@@ -90,8 +91,6 @@ async def tmute_usr(c: Gojo, m: Message):
|
|
90 |
txt = f"Admin {admin} muted {muted}!"
|
91 |
if reason:
|
92 |
txt += f"\n<b>Reason</b>: {reason}"
|
93 |
-
else:
|
94 |
-
txt += "\n<b>Reason</b>: Not Specified"
|
95 |
if mutetime:
|
96 |
txt += f"\n<b>Muted for</b>: {time_val}"
|
97 |
keyboard = InlineKeyboardMarkup(
|
@@ -203,8 +202,6 @@ async def dtmute_usr(c: Gojo, m: Message):
|
|
203 |
txt = f"Admin {admin} muted {muted}!"
|
204 |
if reason:
|
205 |
txt += f"\n<b>Reason</b>: {reason}"
|
206 |
-
else:
|
207 |
-
txt += "\n<b>Reason</b>: Not Specified"
|
208 |
if mutetime:
|
209 |
txt += f"\n<b>Muted for</b>: {time_val}"
|
210 |
keyboard = InlineKeyboardMarkup(
|
@@ -384,8 +381,6 @@ async def mute_usr(c: Gojo, m: Message):
|
|
384 |
txt = f"Admin {admin} muted {muted}!"
|
385 |
if reason:
|
386 |
txt += f"\n<b>Reason</b>: {reason}"
|
387 |
-
else:
|
388 |
-
txt += "\n<b>Reason</b>: Not Specified"
|
389 |
keyboard = InlineKeyboardMarkup(
|
390 |
[
|
391 |
[
|
@@ -543,8 +538,6 @@ async def dmute_usr(c: Gojo, m: Message):
|
|
543 |
txt = f"Admin {admin} muted {muted}!"
|
544 |
if reason:
|
545 |
txt += f"\n<b>Reason</b>: {reason}"
|
546 |
-
else:
|
547 |
-
txt += "\n<b>Reason</b>: Not Specified"
|
548 |
keyboard = InlineKeyboardMarkup(
|
549 |
[
|
550 |
[
|
|
|
9 |
InlineKeyboardButton, InlineKeyboardMarkup,
|
10 |
Message)
|
11 |
|
12 |
+
from Powers import LOGGER, MESSAGE_DUMP, OWNER_ID, get_support_staff
|
13 |
from Powers.bot_class import Gojo
|
14 |
from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
|
15 |
from Powers.utils.custom_filters import command, restrict_filter
|
|
|
19 |
from Powers.utils.string import extract_time
|
20 |
from Powers.vars import Config
|
21 |
|
22 |
+
SUPPORT_STAFF = get_support_staff()
|
23 |
|
24 |
@Gojo.on_message(command("tmute") & restrict_filter)
|
25 |
async def tmute_usr(c: Gojo, m: Message):
|
|
|
91 |
txt = f"Admin {admin} muted {muted}!"
|
92 |
if reason:
|
93 |
txt += f"\n<b>Reason</b>: {reason}"
|
|
|
|
|
94 |
if mutetime:
|
95 |
txt += f"\n<b>Muted for</b>: {time_val}"
|
96 |
keyboard = InlineKeyboardMarkup(
|
|
|
202 |
txt = f"Admin {admin} muted {muted}!"
|
203 |
if reason:
|
204 |
txt += f"\n<b>Reason</b>: {reason}"
|
|
|
|
|
205 |
if mutetime:
|
206 |
txt += f"\n<b>Muted for</b>: {time_val}"
|
207 |
keyboard = InlineKeyboardMarkup(
|
|
|
381 |
txt = f"Admin {admin} muted {muted}!"
|
382 |
if reason:
|
383 |
txt += f"\n<b>Reason</b>: {reason}"
|
|
|
|
|
384 |
keyboard = InlineKeyboardMarkup(
|
385 |
[
|
386 |
[
|
|
|
538 |
txt = f"Admin {admin} muted {muted}!"
|
539 |
if reason:
|
540 |
txt += f"\n<b>Reason</b>: {reason}"
|
|
|
|
|
541 |
keyboard = InlineKeyboardMarkup(
|
542 |
[
|
543 |
[
|
Powers/plugins/report.py
CHANGED
@@ -6,13 +6,14 @@ from pyrogram.enums import ChatType
|
|
6 |
from pyrogram.errors import RPCError
|
7 |
from pyrogram.types import CallbackQuery, Message
|
8 |
|
9 |
-
from Powers import LOGGER,
|
10 |
from Powers.bot_class import Gojo
|
11 |
from Powers.database.reporting_db import Reporting
|
12 |
from Powers.utils.custom_filters import admin_filter, command
|
13 |
from Powers.utils.kbhelpers import ikb
|
14 |
from Powers.utils.parser import mention_html
|
15 |
|
|
|
16 |
|
17 |
@Gojo.on_message(
|
18 |
command("reports") & (filters.private | admin_filter),
|
|
|
6 |
from pyrogram.errors import RPCError
|
7 |
from pyrogram.types import CallbackQuery, Message
|
8 |
|
9 |
+
from Powers import LOGGER, get_support_staff
|
10 |
from Powers.bot_class import Gojo
|
11 |
from Powers.database.reporting_db import Reporting
|
12 |
from Powers.utils.custom_filters import admin_filter, command
|
13 |
from Powers.utils.kbhelpers import ikb
|
14 |
from Powers.utils.parser import mention_html
|
15 |
|
16 |
+
SUPPORT_STAFF = get_support_staff()
|
17 |
|
18 |
@Gojo.on_message(
|
19 |
command("reports") & (filters.private | admin_filter),
|
Powers/plugins/start.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from random import choice
|
2 |
from time import gmtime, strftime, time
|
3 |
|
@@ -12,11 +13,13 @@ from pyrogram.types import (CallbackQuery, InlineKeyboardButton,
|
|
12 |
from Powers import (HELP_COMMANDS, LOGGER, PYROGRAM_VERSION, PYTHON_VERSION,
|
13 |
UPTIME, VERSION)
|
14 |
from Powers.bot_class import Gojo
|
|
|
15 |
from Powers.utils.custom_filters import command
|
16 |
from Powers.utils.extras import StartPic
|
17 |
from Powers.utils.kbhelpers import ikb
|
18 |
from Powers.utils.start_utils import (gen_cmds_kb, gen_start_kb, get_help_msg,
|
19 |
get_private_note, get_private_rules)
|
|
|
20 |
from Powers.vars import Config
|
21 |
|
22 |
|
@@ -103,6 +106,23 @@ async def start(c: Gojo, m: Message):
|
|
103 |
quote=True,
|
104 |
)
|
105 |
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
try:
|
107 |
cpt = f"""
|
108 |
Hey [{m.from_user.first_name}](http://t.me/{m.from_user.username})! I am Gojo ✨.
|
|
|
1 |
+
import os
|
2 |
from random import choice
|
3 |
from time import gmtime, strftime, time
|
4 |
|
|
|
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 |
quote=True,
|
107 |
)
|
108 |
return
|
109 |
+
elif help_option.split("_",1)[0] == "qrcaptcha":
|
110 |
+
decoded = encode_decode(help_option.split("_",1)[1],"decode")
|
111 |
+
decode = decoded.split(":")
|
112 |
+
chat = decode[0]
|
113 |
+
user = decode[1]
|
114 |
+
if m.from_user.id != int(user):
|
115 |
+
await m.reply_text("Not for you Baka")
|
116 |
+
return
|
117 |
+
try:
|
118 |
+
await c.unban_chat_member(int(chat),int(user))
|
119 |
+
try:
|
120 |
+
os.remove(f"captcha_verification{chat}_{user}.png")
|
121 |
+
except Exception:
|
122 |
+
pass
|
123 |
+
return
|
124 |
+
except Exception:
|
125 |
+
return
|
126 |
try:
|
127 |
cpt = f"""
|
128 |
Hey [{m.from_user.first_name}](http://t.me/{m.from_user.username})! I am Gojo ✨.
|
Powers/plugins/utils.py
CHANGED
@@ -62,7 +62,7 @@ async def wiki(_, m: Message):
|
|
62 |
|
63 |
@Gojo.on_message(command("gdpr"))
|
64 |
async def gdpr_remove(_, m: Message):
|
65 |
-
if m.from_user.id in
|
66 |
await m.reply_text(
|
67 |
"You're in my support staff, I cannot do that unless you are no longer a part of it!",
|
68 |
)
|
@@ -239,6 +239,11 @@ async def github(_, m: Message):
|
|
239 |
return
|
240 |
r = r.json()
|
241 |
avtar = r.get("avatar_url", None)
|
|
|
|
|
|
|
|
|
|
|
242 |
url = r.get("html_url", None)
|
243 |
name = r.get("name", None)
|
244 |
company = r.get("company", None)
|
@@ -281,6 +286,12 @@ async def github(_, m: Message):
|
|
281 |
if bio:
|
282 |
REPLY += f"\n\n<b>🎯 Bio:</b> {bio}"
|
283 |
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
if avtar:
|
285 |
return await m.reply_photo(photo=f"{avtar}", caption=REPLY)
|
286 |
await m.reply_text(REPLY)
|
|
|
62 |
|
63 |
@Gojo.on_message(command("gdpr"))
|
64 |
async def gdpr_remove(_, m: Message):
|
65 |
+
if m.from_user.id in get_support_staff():
|
66 |
await m.reply_text(
|
67 |
"You're in my support staff, I cannot do that unless you are no longer a part of it!",
|
68 |
)
|
|
|
239 |
return
|
240 |
r = r.json()
|
241 |
avtar = r.get("avatar_url", None)
|
242 |
+
if avtar:
|
243 |
+
avtar = avtar.rsplit("=",1)
|
244 |
+
avtar.pop(-1)
|
245 |
+
avtar.append("5")
|
246 |
+
avtar = "=".join(avtar)
|
247 |
url = r.get("html_url", None)
|
248 |
name = r.get("name", None)
|
249 |
company = r.get("company", None)
|
|
|
286 |
if bio:
|
287 |
REPLY += f"\n\n<b>🎯 Bio:</b> {bio}"
|
288 |
|
289 |
+
kb = InlineKeyboardMarkup(
|
290 |
+
[
|
291 |
+
InlineKeyboardButton("")
|
292 |
+
]
|
293 |
+
)
|
294 |
+
|
295 |
if avtar:
|
296 |
return await m.reply_photo(photo=f"{avtar}", caption=REPLY)
|
297 |
await m.reply_text(REPLY)
|
Powers/plugins/warns.py
CHANGED
@@ -6,7 +6,7 @@ from pyrogram.types import (CallbackQuery, ChatPermissions,
|
|
6 |
InlineKeyboardButton, InlineKeyboardMarkup,
|
7 |
Message)
|
8 |
|
9 |
-
from Powers import LOGGER,
|
10 |
from Powers.bot_class import Gojo
|
11 |
from Powers.database.rules_db import Rules
|
12 |
from Powers.database.users_db import Users
|
@@ -17,6 +17,7 @@ from Powers.utils.extract_user import extract_user
|
|
17 |
from Powers.utils.parser import mention_html
|
18 |
from Powers.vars import Config
|
19 |
|
|
|
20 |
|
21 |
@Gojo.on_message(
|
22 |
command(["warn", "swarn", "dwarn"]) & restrict_filter,
|
|
|
6 |
InlineKeyboardButton, InlineKeyboardMarkup,
|
7 |
Message)
|
8 |
|
9 |
+
from Powers import LOGGER, TIME_ZONE, get_support_staff
|
10 |
from Powers.bot_class import Gojo
|
11 |
from Powers.database.rules_db import Rules
|
12 |
from Powers.database.users_db import Users
|
|
|
17 |
from Powers.utils.parser import mention_html
|
18 |
from Powers.vars import Config
|
19 |
|
20 |
+
SUPPORT_STAFF = get_support_staff()
|
21 |
|
22 |
@Gojo.on_message(
|
23 |
command(["warn", "swarn", "dwarn"]) & restrict_filter,
|
Powers/plugins/watchers.py
CHANGED
@@ -7,7 +7,7 @@ from pyrogram import filters
|
|
7 |
from pyrogram.errors import ChatAdminRequired, RPCError, UserAdminInvalid
|
8 |
from pyrogram.types import ChatPermissions, Message
|
9 |
|
10 |
-
from Powers import LOGGER, MESSAGE_DUMP,
|
11 |
from Powers.bot_class import Gojo
|
12 |
from Powers.database.antispam_db import ANTISPAM_BANNED, GBan
|
13 |
from Powers.database.approve_db import Approve
|
@@ -21,7 +21,7 @@ from Powers.utils.regex_utils import regex_searcher
|
|
21 |
|
22 |
# Initialise
|
23 |
gban_db = GBan()
|
24 |
-
|
25 |
|
26 |
@Gojo.on_message(filters.linked_channel)
|
27 |
async def antichanpin_cleanlinked(c: Gojo, m: Message):
|
|
|
7 |
from pyrogram.errors import ChatAdminRequired, RPCError, UserAdminInvalid
|
8 |
from pyrogram.types import ChatPermissions, Message
|
9 |
|
10 |
+
from Powers import LOGGER, MESSAGE_DUMP, get_support_staff
|
11 |
from Powers.bot_class import Gojo
|
12 |
from Powers.database.antispam_db import ANTISPAM_BANNED, GBan
|
13 |
from Powers.database.approve_db import Approve
|
|
|
21 |
|
22 |
# Initialise
|
23 |
gban_db = GBan()
|
24 |
+
SUPPORT_STAFF = get_support_staff()
|
25 |
|
26 |
@Gojo.on_message(filters.linked_channel)
|
27 |
async def antichanpin_cleanlinked(c: Gojo, m: Message):
|
Powers/utils/admin_check.py
CHANGED
@@ -3,10 +3,8 @@ 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
|
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,6 +14,11 @@ 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,6 +69,10 @@ async def owner_check(m: Message or CallbackQuery) -> bool:
|
|
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
|
|
|
3 |
from pyrogram.enums import ChatMemberStatus as CMS
|
4 |
from pyrogram.types import CallbackQuery, Message
|
5 |
|
6 |
+
from Powers import LOGGER, OWNER_ID
|
7 |
+
from Powers.database.support_db import SUPPORTS
|
|
|
|
|
8 |
|
9 |
|
10 |
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 |
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
|
Powers/utils/captcha_helper.py
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from random import choice, randint, randrange
|
2 |
+
|
3 |
+
import qrcode
|
4 |
+
from captcha.image import ImageCaptcha
|
5 |
+
from pyrogram.types import InlineKeyboardButton as IKB
|
6 |
+
from pyrogram.types import InlineKeyboardMarkup as IKM
|
7 |
+
|
8 |
+
from Powers.database.captcha_db import CAPTCHA_DATA
|
9 |
+
from Powers.utils.string import encode_decode
|
10 |
+
from Powers.vars import Config
|
11 |
+
|
12 |
+
initial = f"t.me/{Config.BOT_USERNAME}?start=qrcaptcha_"
|
13 |
+
captchaa = CAPTCHA_DATA()
|
14 |
+
|
15 |
+
async def get_qr_captcha(chat,user):
|
16 |
+
encode = f"{chat}:{user}"
|
17 |
+
encoded = encode_decode(encode)
|
18 |
+
final = initial+encoded
|
19 |
+
qr = qrcode.make(final)
|
20 |
+
name = f"captcha_verification{chat}_{user}.png"
|
21 |
+
qr.save(name)
|
22 |
+
return name
|
23 |
+
|
24 |
+
def genrator():
|
25 |
+
alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
|
26 |
+
rand_alpha = choice(alpha)
|
27 |
+
if_ = randint(0,1)
|
28 |
+
|
29 |
+
if if_:
|
30 |
+
new_alpha = rand_alpha.upper()
|
31 |
+
else:
|
32 |
+
new_alpha = rand_alpha
|
33 |
+
|
34 |
+
list_ = [new_alpha]
|
35 |
+
while len(list_) != 4:
|
36 |
+
xXx = randrange(0,9)
|
37 |
+
list_.append(xXx)
|
38 |
+
|
39 |
+
str_ = ""
|
40 |
+
while len(str_) != 4:
|
41 |
+
OwO = choice(list_)
|
42 |
+
str_ += OwO
|
43 |
+
return str_
|
44 |
+
|
45 |
+
async def get_image_captcha(chat,user):
|
46 |
+
str_ = genrator()
|
47 |
+
captchaa.load_cap_data(chat,user,str_)
|
48 |
+
name = f"captcha_img_{chat}_{user}.png"
|
49 |
+
image = ImageCaptcha(280,90)
|
50 |
+
|
51 |
+
cap = image.generate(str_)
|
52 |
+
image.write(str_,name)
|
53 |
+
|
54 |
+
return name, str_
|
55 |
+
|
56 |
+
|
Powers/utils/custom_filters.py
CHANGED
@@ -9,14 +9,11 @@ from pyrogram.errors import RPCError, UserNotParticipant
|
|
9 |
from pyrogram.filters import create
|
10 |
from pyrogram.types import CallbackQuery, Message
|
11 |
|
12 |
-
from Powers import
|
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,6 +26,8 @@ def command(
|
|
29 |
if not m:
|
30 |
return
|
31 |
|
|
|
|
|
32 |
date = m.edit_date
|
33 |
if date:
|
34 |
return # reaction
|
@@ -289,6 +288,7 @@ async def can_pin_message_func(_, __, m):
|
|
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 |
|
|
|
9 |
from pyrogram.filters import create
|
10 |
from pyrogram.types import CallbackQuery, Message
|
11 |
|
12 |
+
from Powers import OWNER_ID, get_support_staff
|
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 |
|
18 |
def command(
|
19 |
commands: Union[str, List[str]],
|
|
|
26 |
if not m:
|
27 |
return
|
28 |
|
29 |
+
SUDO_LEVEL = get_support_staff("sudo_level")
|
30 |
+
DEV_LEVEL = get_support_staff("dev_level")
|
31 |
date = m.edit_date
|
32 |
if date:
|
33 |
return # reaction
|
|
|
288 |
return True
|
289 |
|
290 |
# Bypass the bot devs, sudos and owner
|
291 |
+
SUDO_LEVEL = get_support_staff("sudo_level")
|
292 |
if m.from_user.id in SUDO_LEVEL:
|
293 |
return True
|
294 |
|
Powers/utils/msg_types.py
CHANGED
@@ -89,7 +89,7 @@ async def get_note_type(m: Message):
|
|
89 |
async def get_filter_type(m: Message):
|
90 |
"""Get filter type."""
|
91 |
if len(m.text.split()) <= 1:
|
92 |
-
return None, None, None
|
93 |
|
94 |
data_type = None
|
95 |
content = None
|
@@ -158,6 +158,9 @@ async def get_filter_type(m: Message):
|
|
158 |
|
159 |
async def get_wlcm_type(m: Message):
|
160 |
"""Get wlcm type."""
|
|
|
|
|
|
|
161 |
data_type = None
|
162 |
content = None
|
163 |
raw_text = m.text.markdown if m.text else m.caption.markdown
|
|
|
89 |
async def get_filter_type(m: Message):
|
90 |
"""Get filter type."""
|
91 |
if len(m.text.split()) <= 1:
|
92 |
+
return None, None, None
|
93 |
|
94 |
data_type = None
|
95 |
content = None
|
|
|
158 |
|
159 |
async def get_wlcm_type(m: Message):
|
160 |
"""Get wlcm type."""
|
161 |
+
if len(m.text.split()) <= 1:
|
162 |
+
return None, None, None
|
163 |
+
|
164 |
data_type = None
|
165 |
content = None
|
166 |
raw_text = m.text.markdown if m.text else m.caption.markdown
|
Powers/utils/start_utils.py
CHANGED
@@ -72,8 +72,8 @@ async def gen_start_kb(q: Message or CallbackQuery):
|
|
72 |
],
|
73 |
[
|
74 |
(
|
75 |
-
"
|
76 |
-
"https://t.me
|
77 |
"url",
|
78 |
),
|
79 |
(
|
|
|
72 |
],
|
73 |
[
|
74 |
(
|
75 |
+
"Essential",
|
76 |
+
"https://t.me/+PcVYvdzNt4E1YjM1",
|
77 |
"url",
|
78 |
),
|
79 |
(
|
Powers/utils/sticker_help.py
CHANGED
@@ -136,7 +136,7 @@ async def get_document_from_file_id(
|
|
136 |
)
|
137 |
|
138 |
|
139 |
-
async def
|
140 |
_split = text.split(";", 1)
|
141 |
if len(_split) == 2:
|
142 |
lower_text = _split[1]
|
@@ -183,7 +183,7 @@ async def draw_meme(image_path: str, text: str, sticker: bool, fiill: str) -> li
|
|
183 |
# img = Image.open(image_path)
|
184 |
# i_width, i_height = img.size
|
185 |
# m_font = ImageFont.truetype(
|
186 |
-
# "./extras/comic.ttf", int(
|
187 |
# )
|
188 |
# if ";" in text:
|
189 |
# upper_text, lower_text = text.split(";")
|
|
|
136 |
)
|
137 |
|
138 |
|
139 |
+
async def draw_meame(image_path: str, text: str, sticker: bool, fiill: str) -> list:
|
140 |
_split = text.split(";", 1)
|
141 |
if len(_split) == 2:
|
142 |
lower_text = _split[1]
|
|
|
183 |
# img = Image.open(image_path)
|
184 |
# i_width, i_height = img.size
|
185 |
# m_font = ImageFont.truetype(
|
186 |
+
# "./extras/comic.ttf", int(i_width / 11)
|
187 |
# )
|
188 |
# if ";" in text:
|
189 |
# upper_text, lower_text = text.split(";")
|
Powers/utils/string.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from datetime import datetime, timedelta
|
2 |
from html import escape
|
3 |
from re import compile as compile_re
|
@@ -192,3 +193,24 @@ async def remove_escapes(text: str) -> str:
|
|
192 |
else:
|
193 |
res += text[counter]
|
194 |
return res
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import base64
|
2 |
from datetime import datetime, timedelta
|
3 |
from html import escape
|
4 |
from re import compile as compile_re
|
|
|
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
|
requirements.txt
CHANGED
@@ -4,6 +4,7 @@ apscheduler==3.10.4
|
|
4 |
asyncio==3.4.3
|
5 |
beautifulsoup4==4.12.2; python_full_version >= "3.6"
|
6 |
cachetools==5.2.0; python_version >= "3.7" and python_version < "4.0"
|
|
|
7 |
certifi==2023.7.22; python_version >= "3.7" and python_version < "4"
|
8 |
charset-normalizer==2.1.0; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
|
9 |
dnspython==2.2.1; python_version >= "3.6" and python_version < "4.0"
|
@@ -15,12 +16,13 @@ pillow == 10.0.0
|
|
15 |
prettyconf==2.2.1
|
16 |
pyaes==1.6.1; python_version >= "3.6" and python_version < "4.0"
|
17 |
pymongo==4.5.0
|
18 |
-
pyroaddon==1.0.6
|
19 |
pyrogram==2.0.106; python_version >= "3.8"
|
20 |
pysocks==1.7.1; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4.0" or python_version >= "3.7" and python_version < "4.0" and python_full_version >= "3.4.0"
|
21 |
python-dateutil==2.8.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.3.0")
|
|
|
22 |
pytz==2023.3
|
23 |
pyyaml==6.0.1; python_version >= "3.6"
|
|
|
24 |
regex==2023.8.8; python_version >= "3.6"
|
25 |
requests==2.31.0
|
26 |
rfc3986==1.5.0; python_version >= "3.7"
|
@@ -35,4 +37,5 @@ ujson==5.8.0; python_version >= "3.7"
|
|
35 |
urllib3==1.26.11; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_full_version >= "3.6.0" and python_version < "4" and python_version >= "3.7"
|
36 |
uvloop==0.17.0
|
37 |
wikipedia==1.4.0
|
38 |
-
|
|
|
|
4 |
asyncio==3.4.3
|
5 |
beautifulsoup4==4.12.2; python_full_version >= "3.6"
|
6 |
cachetools==5.2.0; python_version >= "3.7" and python_version < "4.0"
|
7 |
+
captcha==0.5.0
|
8 |
certifi==2023.7.22; python_version >= "3.7" and python_version < "4"
|
9 |
charset-normalizer==2.1.0; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
|
10 |
dnspython==2.2.1; python_version >= "3.6" and python_version < "4.0"
|
|
|
16 |
prettyconf==2.2.1
|
17 |
pyaes==1.6.1; python_version >= "3.6" and python_version < "4.0"
|
18 |
pymongo==4.5.0
|
|
|
19 |
pyrogram==2.0.106; python_version >= "3.8"
|
20 |
pysocks==1.7.1; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4.0" or python_version >= "3.7" and python_version < "4.0" and python_full_version >= "3.4.0"
|
21 |
python-dateutil==2.8.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.3.0")
|
22 |
+
pytube==15.0.0
|
23 |
pytz==2023.3
|
24 |
pyyaml==6.0.1; python_version >= "3.6"
|
25 |
+
qrcode==7.4.2
|
26 |
regex==2023.8.8; python_version >= "3.6"
|
27 |
requests==2.31.0
|
28 |
rfc3986==1.5.0; python_version >= "3.7"
|
|
|
37 |
urllib3==1.26.11; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_full_version >= "3.6.0" and python_version < "4" and python_version >= "3.7"
|
38 |
uvloop==0.17.0
|
39 |
wikipedia==1.4.0
|
40 |
+
youtube-search-python==1.6.6
|
41 |
+
yt-dlp@git+https://github.com/HellBoy-OP/yt-dp-fork.git@af1fd12f675220df6793fc019dff320bc76e8080
|