Spaces:
Sleeping
Sleeping
Captain Ezio
commited on
Commit
·
518de8c
1
Parent(s):
bb1bfd1
progress...
Browse files- Powers/database/locks_db.py +23 -12
- Powers/plugins/auto_join.py +34 -8
- Powers/plugins/birthday.py +1 -1
- Powers/plugins/flood.py +0 -1
- Powers/plugins/locks.py +59 -33
Powers/database/locks_db.py
CHANGED
@@ -5,7 +5,7 @@ from Powers.database import MongoDB
|
|
5 |
|
6 |
INSERTION_LOCK = RLock()
|
7 |
|
8 |
-
lock_t = ["anti_c_send", "anti_fwd", "anti_fwd_u", "anti_fwd_c", "anti_links"]
|
9 |
class LOCKS(MongoDB):
|
10 |
"""Class to store locks"""
|
11 |
|
@@ -16,7 +16,7 @@ class LOCKS(MongoDB):
|
|
16 |
|
17 |
def insert_lock_channel(self, chat: int, locktype: str):
|
18 |
"""
|
19 |
-
locktypes: all, anti_c_send, anti_fwd, anti_fwd_u, anti_fwd_c, anti_links
|
20 |
"""
|
21 |
if locktype == "all":
|
22 |
for i in lock_t:
|
@@ -39,7 +39,7 @@ class LOCKS(MongoDB):
|
|
39 |
|
40 |
def remove_lock_channel(self, chat: int, locktype: str):
|
41 |
"""
|
42 |
-
locktypes: all, anti_c_send, anti_fwd, anti_fwd_u, anti_fwd_c, anti_links
|
43 |
"""
|
44 |
if locktype == "all":
|
45 |
for i in lock_t:
|
@@ -55,23 +55,34 @@ class LOCKS(MongoDB):
|
|
55 |
else:
|
56 |
return False
|
57 |
|
58 |
-
def get_lock_channel(self, locktype: str="all"):
|
59 |
"""
|
60 |
-
locktypes: anti_c_send, anti_fwd, anti_fwd_u, anti_fwd_c, anti_links
|
61 |
"""
|
62 |
-
if locktype not in ["anti_c_send","anti_fwd","anti_fwd_u","anti_fwd_c","anti_links", "all"]:
|
63 |
return False
|
64 |
else:
|
65 |
if locktype == "all":
|
66 |
find = {}
|
67 |
else:
|
68 |
find = {"locktype":locktype}
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
def merge_u_and_c(self, chat: int, locktype: str):
|
77 |
if locktype == "anti_fwd_u":
|
|
|
5 |
|
6 |
INSERTION_LOCK = RLock()
|
7 |
|
8 |
+
lock_t = ["bot", "anti_c_send", "anti_fwd", "anti_fwd_u", "anti_fwd_c", "anti_links"]
|
9 |
class LOCKS(MongoDB):
|
10 |
"""Class to store locks"""
|
11 |
|
|
|
16 |
|
17 |
def insert_lock_channel(self, chat: int, locktype: str):
|
18 |
"""
|
19 |
+
locktypes: all, bot, anti_c_send, anti_fwd, anti_fwd_u, anti_fwd_c, anti_links
|
20 |
"""
|
21 |
if locktype == "all":
|
22 |
for i in lock_t:
|
|
|
39 |
|
40 |
def remove_lock_channel(self, chat: int, locktype: str):
|
41 |
"""
|
42 |
+
locktypes: all, bot, anti_c_send, anti_fwd, anti_fwd_u, anti_fwd_c, anti_links
|
43 |
"""
|
44 |
if locktype == "all":
|
45 |
for i in lock_t:
|
|
|
55 |
else:
|
56 |
return False
|
57 |
|
58 |
+
def get_lock_channel(self, locktype: str="all", chat:int = 0):
|
59 |
"""
|
60 |
+
locktypes: anti_c_send, anti_fwd, anti_fwd_u, anti_fwd_c, anti_links, bot
|
61 |
"""
|
62 |
+
if locktype not in ["anti_c_send","anti_fwd","anti_fwd_u","anti_fwd_c","anti_links", "bot", "all"]:
|
63 |
return False
|
64 |
else:
|
65 |
if locktype == "all":
|
66 |
find = {}
|
67 |
else:
|
68 |
find = {"locktype":locktype}
|
69 |
+
if chat:
|
70 |
+
if find:
|
71 |
+
curr = self.find_one({"chat_id":chat, "locktype":locktype})
|
72 |
+
return bool(curr)
|
73 |
+
else:
|
74 |
+
to_return = []
|
75 |
+
for i in lock_t:
|
76 |
+
curr = self.find_one({"chat_id":chat, "locktype":i})
|
77 |
+
to_return.append(bool(curr))
|
78 |
+
return all(to_return)
|
79 |
+
else:
|
80 |
+
curr = self.find_all(find)
|
81 |
+
if not curr:
|
82 |
+
list_ = []
|
83 |
+
else:
|
84 |
+
list_ = [i["chat_id"] for i in curr]
|
85 |
+
return list_
|
86 |
|
87 |
def merge_u_and_c(self, chat: int, locktype: str):
|
88 |
if locktype == "anti_fwd_u":
|
Powers/plugins/auto_join.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
from pyrogram import filters
|
2 |
from pyrogram.enums import ChatMemberStatus as CMS
|
3 |
from pyrogram.types import CallbackQuery, ChatJoinRequest
|
@@ -5,6 +7,7 @@ from pyrogram.types import InlineKeyboardButton as ikb
|
|
5 |
from pyrogram.types import InlineKeyboardMarkup as ikm
|
6 |
from pyrogram.types import Message
|
7 |
|
|
|
8 |
from Powers.bot_class import Gojo
|
9 |
from Powers.database.autojoin_db import AUTOJOIN
|
10 |
from Powers.supports import get_support_staff
|
@@ -21,8 +24,15 @@ async def accept_join_requests(c: Gojo, m: Message):
|
|
21 |
a_j = AUTOJOIN()
|
22 |
|
23 |
try:
|
24 |
-
await
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
if len(split) == 1:
|
27 |
txt = "**USAGE**\n/joinreq [on | off]"
|
28 |
await m.reply_text(txt)
|
@@ -91,8 +101,12 @@ async def join_request_handler(c: Gojo, j: ChatJoinRequest):
|
|
91 |
if not join_type:
|
92 |
return
|
93 |
if join_type == "auto" or user in SUPPORT_STAFF:
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
96 |
elif join_type == "manual":
|
97 |
txt = "New join request is available\n**USER's INFO**\n"
|
98 |
txt += f"Name: {userr.first_name} {userr.last_name if userr.last_name else ''}"
|
@@ -113,6 +127,7 @@ async def join_request_handler(c: Gojo, j: ChatJoinRequest):
|
|
113 |
@Gojo.on_callback_query(filters.regex("^accept_joinreq_uest_") | filters.regex("^decline_joinreq_uest_"))
|
114 |
async def accept_decline_request(c:Gojo, q: CallbackQuery):
|
115 |
user_id = q.from_user.id
|
|
|
116 |
user_status = (await q.message.chat.get_member(user_id)).status
|
117 |
if user_status not in {CMS.OWNER, CMS.ADMINISTRATOR}:
|
118 |
await q.answer(
|
@@ -127,11 +142,22 @@ async def accept_decline_request(c:Gojo, q: CallbackQuery):
|
|
127 |
data = split[0]
|
128 |
|
129 |
if data == "accept":
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
elif data == "decline":
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
135 |
|
136 |
return
|
137 |
|
|
|
1 |
+
from traceback import format_exc
|
2 |
+
|
3 |
from pyrogram import filters
|
4 |
from pyrogram.enums import ChatMemberStatus as CMS
|
5 |
from pyrogram.types import CallbackQuery, ChatJoinRequest
|
|
|
7 |
from pyrogram.types import InlineKeyboardMarkup as ikm
|
8 |
from pyrogram.types import Message
|
9 |
|
10 |
+
from Powers import LOGGER
|
11 |
from Powers.bot_class import Gojo
|
12 |
from Powers.database.autojoin_db import AUTOJOIN
|
13 |
from Powers.supports import get_support_staff
|
|
|
24 |
a_j = AUTOJOIN()
|
25 |
|
26 |
try:
|
27 |
+
status = (await m.chat.get_member(c.me.id)).status
|
28 |
+
if status != CMS.ADMINISTRATOR:
|
29 |
+
await m.reply_text("I should be admin to accept and reject join requests")
|
30 |
+
return
|
31 |
+
except Exception as ef:
|
32 |
+
await m.reply_text(f"Some error occured, report it using `/bug`\n<b>Error:</b> <code>{ef}</code>")
|
33 |
+
LOGGER.error(ef)
|
34 |
+
LOGGER.error(format_exc())
|
35 |
+
return
|
36 |
if len(split) == 1:
|
37 |
txt = "**USAGE**\n/joinreq [on | off]"
|
38 |
await m.reply_text(txt)
|
|
|
101 |
if not join_type:
|
102 |
return
|
103 |
if join_type == "auto" or user in SUPPORT_STAFF:
|
104 |
+
try:
|
105 |
+
await c.approve_chat_join_request(chat,user)
|
106 |
+
except Exception as ef:
|
107 |
+
await c.send_message(chat,f"Some error occured while approving request, report it using `/bug`\n<b>Error:</b> <code>{ef}</code>")
|
108 |
+
LOGGER.error(ef)
|
109 |
+
LOGGER.error(format_exc())
|
110 |
elif join_type == "manual":
|
111 |
txt = "New join request is available\n**USER's INFO**\n"
|
112 |
txt += f"Name: {userr.first_name} {userr.last_name if userr.last_name else ''}"
|
|
|
127 |
@Gojo.on_callback_query(filters.regex("^accept_joinreq_uest_") | filters.regex("^decline_joinreq_uest_"))
|
128 |
async def accept_decline_request(c:Gojo, q: CallbackQuery):
|
129 |
user_id = q.from_user.id
|
130 |
+
chat = q.message.chat.id
|
131 |
user_status = (await q.message.chat.get_member(user_id)).status
|
132 |
if user_status not in {CMS.OWNER, CMS.ADMINISTRATOR}:
|
133 |
await q.answer(
|
|
|
142 |
data = split[0]
|
143 |
|
144 |
if data == "accept":
|
145 |
+
try:
|
146 |
+
await c.approve_chat_join_request(chat,user)
|
147 |
+
await q.answer(f"APPROVED: {user}",True)
|
148 |
+
except Exception as ef:
|
149 |
+
await c.send_message(chat,f"Some error occured while approving request, report it using `/bug`\n<b>Error:</b> <code>{ef}</code>")
|
150 |
+
LOGGER.error(ef)
|
151 |
+
LOGGER.error(format_exc())
|
152 |
+
|
153 |
elif data == "decline":
|
154 |
+
try:
|
155 |
+
await c.decline_chat_join_request(chat,user)
|
156 |
+
await q.answer(f"DECLINED: {user}")
|
157 |
+
except Exception as ef:
|
158 |
+
await c.send_message(chat,f"Some error occured while approving request, report it using `/bug`\n<b>Error:</b> <code>{ef}</code>")
|
159 |
+
LOGGER.error(ef)
|
160 |
+
LOGGER.error(format_exc())
|
161 |
|
162 |
return
|
163 |
|
Powers/plugins/birthday.py
CHANGED
@@ -177,7 +177,7 @@ async def cant_recall_it(c: Gojo, m: Message):
|
|
177 |
u_dob = give_date(result["dob"])
|
178 |
formatted = str(u_dob.strftime('%d' + '%B %Y'))[2:-5]
|
179 |
day = int(result["dob"].split('/')[0])
|
180 |
-
suffix = {1: 'st', 2: 'nd', 3: 'rd'}.get(day
|
181 |
bday_on = f"{day}{suffix} {formatted}"
|
182 |
if u_dob.month < curr.month:
|
183 |
next_b = date(curr.year + 1, u_dob.month, u_dob.day)
|
|
|
177 |
u_dob = give_date(result["dob"])
|
178 |
formatted = str(u_dob.strftime('%d' + '%B %Y'))[2:-5]
|
179 |
day = int(result["dob"].split('/')[0])
|
180 |
+
suffix = {1: 'st', 2: 'nd', 3: 'rd'}.get(day % 10, 'th')
|
181 |
bday_on = f"{day}{suffix} {formatted}"
|
182 |
if u_dob.month < curr.month:
|
183 |
next_b = date(curr.year + 1, u_dob.month, u_dob.day)
|
Powers/plugins/flood.py
CHANGED
@@ -20,7 +20,6 @@ from Powers.utils.extras import BAN_GIFS, KICK_GIFS, MUTE_GIFS
|
|
20 |
from Powers.utils.kbhelpers import ikb
|
21 |
from Powers.vars import Config
|
22 |
|
23 |
-
|
24 |
on_key = ["on", "start", "disable"]
|
25 |
off_key = ["off", "end", "enable", "stop"]
|
26 |
|
|
|
20 |
from Powers.utils.kbhelpers import ikb
|
21 |
from Powers.vars import Config
|
22 |
|
|
|
23 |
on_key = ["on", "start", "disable"]
|
24 |
off_key = ["off", "end", "enable", "stop"]
|
25 |
|
Powers/plugins/locks.py
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
from asyncio import sleep
|
|
|
2 |
from traceback import format_exc
|
3 |
|
4 |
from pyrogram import filters
|
5 |
from pyrogram.enums import MessageEntityType as MET
|
|
|
6 |
from pyrogram.errors import ChatAdminRequired, ChatNotModified, RPCError
|
7 |
from pyrogram.types import ChatPermissions, Message
|
8 |
|
@@ -124,6 +126,13 @@ async def lock_perm(c: Gojo, m: Message):
|
|
124 |
elif lock_type == "pin":
|
125 |
pin = False
|
126 |
perm = "pin"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
elif lock_type in ["links", "url"]:
|
128 |
curr = lock.insert_lock_channel(m.chat.id, "anti_links")
|
129 |
if not curr:
|
@@ -202,26 +211,15 @@ async def view_locks(_, m: Message):
|
|
202 |
if val:
|
203 |
return "✅"
|
204 |
return "❌"
|
205 |
-
|
206 |
lock = LOCKS()
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
anon = True
|
215 |
-
anti_f = anti_f_u = anti_f_c = False
|
216 |
-
if m.chat.id in anti_forward:
|
217 |
-
anti_f = True
|
218 |
-
if m.chat.id in anti_forward_u:
|
219 |
-
anti_f_u = True
|
220 |
-
if m.chat.id in anti_forward_c:
|
221 |
-
anti_f_c = True
|
222 |
-
antil = False
|
223 |
-
if m.chat.id in anti_links:
|
224 |
-
antil = True
|
225 |
vmsg = await convert_to_emoji(v_perm.can_send_messages)
|
226 |
vmedia = await convert_to_emoji(v_perm.can_send_media_messages)
|
227 |
vother = await convert_to_emoji(v_perm.can_send_other_messages)
|
@@ -235,6 +233,7 @@ async def view_locks(_, m: Message):
|
|
235 |
vantiu = await convert_to_emoji(anti_f_u)
|
236 |
vantic = await convert_to_emoji(anti_f_c)
|
237 |
vantil = await convert_to_emoji(antil)
|
|
|
238 |
|
239 |
if v_perm is not None:
|
240 |
try:
|
@@ -255,7 +254,8 @@ async def view_locks(_, m: Message):
|
|
255 |
<b>Can forward:</b> {vanti}
|
256 |
<b>Can forward from user:</b> {vantiu}
|
257 |
<b>Can forward from channel and chats:</b> {vantic}
|
258 |
-
<b>Can send links:</b> {
|
|
|
259 |
"""
|
260 |
LOGGER.info(f"{m.from_user.id} used locks cmd in {m.chat.id}")
|
261 |
await chkmsg.edit_text(permission_view_str)
|
@@ -278,8 +278,8 @@ async def unlock_perm(c: Gojo, m: Message):
|
|
278 |
await m.reply_text(text="Specify a permission to unlock!")
|
279 |
return
|
280 |
|
|
|
281 |
if unlock_type == "all":
|
282 |
-
lock = LOCKS()
|
283 |
try:
|
284 |
await c.set_chat_permissions(
|
285 |
chat_id,
|
@@ -359,6 +359,12 @@ async def unlock_perm(c: Gojo, m: Message):
|
|
359 |
elif unlock_type == "pin":
|
360 |
upin = True
|
361 |
uperm = "pin"
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
elif unlock_type == "anonchannel":
|
363 |
curr = lock.remove_lock_channel(m.chat.id,"anti_c_send")
|
364 |
|
@@ -474,6 +480,26 @@ async def is_approved_user(c:Gojo, m: Message):
|
|
474 |
return True
|
475 |
return False
|
476 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
477 |
@Gojo.on_message(filters.group & ~filters.me,18)
|
478 |
async def lock_del_mess(c:Gojo, m: Message):
|
479 |
lock = LOCKS()
|
@@ -488,24 +514,24 @@ async def lock_del_mess(c:Gojo, m: Message):
|
|
488 |
await delete_messages(c,m)
|
489 |
return
|
490 |
is_approved = await is_approved_user(c,m)
|
|
|
|
|
491 |
entity = m.entities if m.text else m.caption_entities
|
492 |
if entity:
|
493 |
for i in entity:
|
494 |
if i.type in [MET.URL or MET.TEXT_LINK]:
|
495 |
-
if not is_approved:
|
496 |
-
await delete_messages(c,m)
|
497 |
-
return
|
498 |
-
elif m.forward_from or m.forward_from_chat:
|
499 |
-
if not is_approved:
|
500 |
-
if lock.is_particular_lock(m.chat.id,"anti_fwd"):
|
501 |
-
await delete_messages(c,m)
|
502 |
-
return
|
503 |
-
elif lock.is_particular_lock(m.chat.id,"anti_fwd_u") and not m.forward_from_chat:
|
504 |
-
await delete_messages(c,m)
|
505 |
-
return
|
506 |
-
elif lock.is_particular_lock(m.chat.id,"anti_fwd_c") and m.forward_from_chat:
|
507 |
await delete_messages(c,m)
|
508 |
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
509 |
|
510 |
async def prevent_approved(m: Message):
|
511 |
approved_users = Approve(m.chat.id).list_approved()
|
|
|
1 |
from asyncio import sleep
|
2 |
+
from datetime import datetime, timedelta
|
3 |
from traceback import format_exc
|
4 |
|
5 |
from pyrogram import filters
|
6 |
from pyrogram.enums import MessageEntityType as MET
|
7 |
+
from pyrogram.enums import MessageServiceType as MST
|
8 |
from pyrogram.errors import ChatAdminRequired, ChatNotModified, RPCError
|
9 |
from pyrogram.types import ChatPermissions, Message
|
10 |
|
|
|
126 |
elif lock_type == "pin":
|
127 |
pin = False
|
128 |
perm = "pin"
|
129 |
+
elif lock_type == "bot":
|
130 |
+
curr = lock.insert_lock_channel(m.chat.id,"bot")
|
131 |
+
if not curr:
|
132 |
+
await m.reply_text("It is already on")
|
133 |
+
return
|
134 |
+
await m.reply_text("Restricted adding bots in the chat.")
|
135 |
+
return
|
136 |
elif lock_type in ["links", "url"]:
|
137 |
curr = lock.insert_lock_channel(m.chat.id, "anti_links")
|
138 |
if not curr:
|
|
|
211 |
if val:
|
212 |
return "✅"
|
213 |
return "❌"
|
214 |
+
|
215 |
lock = LOCKS()
|
216 |
+
anon= lock.get_lock_channel("anti_c_send", m.chat.id)
|
217 |
+
anti_f = lock.get_lock_channel("anti_fwd", m.chat.id)
|
218 |
+
anti_f_u = lock.get_lock_channel("anti_fwd_u", m.chat.id)
|
219 |
+
anti_f_c = lock.get_lock_channel("anti_fwd_c", m.chat.id)
|
220 |
+
antil = lock.get_lock_channel("anti_links", m.chat.id)
|
221 |
+
bots = lock.get_lock_channel("bot", m.chat.id)
|
222 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
vmsg = await convert_to_emoji(v_perm.can_send_messages)
|
224 |
vmedia = await convert_to_emoji(v_perm.can_send_media_messages)
|
225 |
vother = await convert_to_emoji(v_perm.can_send_other_messages)
|
|
|
233 |
vantiu = await convert_to_emoji(anti_f_u)
|
234 |
vantic = await convert_to_emoji(anti_f_c)
|
235 |
vantil = await convert_to_emoji(antil)
|
236 |
+
vantibot = await convert_to_emoji(bots)
|
237 |
|
238 |
if v_perm is not None:
|
239 |
try:
|
|
|
254 |
<b>Can forward:</b> {vanti}
|
255 |
<b>Can forward from user:</b> {vantiu}
|
256 |
<b>Can forward from channel and chats:</b> {vantic}
|
257 |
+
<b>Can send links:</b> {vantil}
|
258 |
+
<b>Can send links:</b> {vantibot}
|
259 |
"""
|
260 |
LOGGER.info(f"{m.from_user.id} used locks cmd in {m.chat.id}")
|
261 |
await chkmsg.edit_text(permission_view_str)
|
|
|
278 |
await m.reply_text(text="Specify a permission to unlock!")
|
279 |
return
|
280 |
|
281 |
+
lock = LOCKS()
|
282 |
if unlock_type == "all":
|
|
|
283 |
try:
|
284 |
await c.set_chat_permissions(
|
285 |
chat_id,
|
|
|
359 |
elif unlock_type == "pin":
|
360 |
upin = True
|
361 |
uperm = "pin"
|
362 |
+
elif unlock_type == "bot":
|
363 |
+
curr = lock.remove_lock_channel(m.chat.id,"bot")
|
364 |
+
if not curr:
|
365 |
+
m.reply_text("User already can add bots in the chat")
|
366 |
+
return
|
367 |
+
await m.reply_text("User are now allowed to add bots in the chat.")
|
368 |
elif unlock_type == "anonchannel":
|
369 |
curr = lock.remove_lock_channel(m.chat.id,"anti_c_send")
|
370 |
|
|
|
480 |
return True
|
481 |
return False
|
482 |
|
483 |
+
@Gojo.on_message(filters.service & filters.group, 19)
|
484 |
+
async def servicess(c: Gojo, m: Message):
|
485 |
+
if m.service != MST.NEW_CHAT_MEMBERS:
|
486 |
+
return
|
487 |
+
approved = await is_approved_user(c,m)
|
488 |
+
if approved:
|
489 |
+
return
|
490 |
+
for i in m.new_chat_members:
|
491 |
+
if i.is_bot:
|
492 |
+
try:
|
493 |
+
timee = datetime.now() + timedelta(minutes=5)
|
494 |
+
await m.chat.ban_member(i.id,until_date=timee)
|
495 |
+
sleep(1)
|
496 |
+
except Exception as ef:
|
497 |
+
LOGGER.error(ef)
|
498 |
+
LOGGER.error(format_exc())
|
499 |
+
return
|
500 |
+
|
501 |
+
|
502 |
+
|
503 |
@Gojo.on_message(filters.group & ~filters.me,18)
|
504 |
async def lock_del_mess(c:Gojo, m: Message):
|
505 |
lock = LOCKS()
|
|
|
514 |
await delete_messages(c,m)
|
515 |
return
|
516 |
is_approved = await is_approved_user(c,m)
|
517 |
+
if is_approved:
|
518 |
+
return
|
519 |
entity = m.entities if m.text else m.caption_entities
|
520 |
if entity:
|
521 |
for i in entity:
|
522 |
if i.type in [MET.URL or MET.TEXT_LINK]:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
523 |
await delete_messages(c,m)
|
524 |
return
|
525 |
+
elif m.forward_from or m.forward_from_chat:
|
526 |
+
if lock.is_particular_lock(m.chat.id,"anti_fwd"):
|
527 |
+
await delete_messages(c,m)
|
528 |
+
return
|
529 |
+
elif lock.is_particular_lock(m.chat.id,"anti_fwd_u") and not m.forward_from_chat:
|
530 |
+
await delete_messages(c,m)
|
531 |
+
return
|
532 |
+
elif lock.is_particular_lock(m.chat.id,"anti_fwd_c") and m.forward_from_chat:
|
533 |
+
await delete_messages(c,m)
|
534 |
+
return
|
535 |
|
536 |
async def prevent_approved(m: Message):
|
537 |
approved_users = Approve(m.chat.id).list_approved()
|