Spaces:
Sleeping
Sleeping
Captain Ezio
commited on
Commit
·
b8f7202
1
Parent(s):
4955625
Update bans.py
Browse files- Powers/plugins/bans.py +12 -12
Powers/plugins/bans.py
CHANGED
@@ -34,7 +34,7 @@ KICK_MEDIA = random.choice(KICK_GIFS)
|
|
34 |
@Gojo.on_message(command("tban") & restrict_filter)
|
35 |
async def tban_usr(c: Gojo, m: Message):
|
36 |
if len(m.text.split()) == 1 and not m.reply_to_message:
|
37 |
-
await m.reply_text(tlang(m, "
|
38 |
await m.stop_propagation()
|
39 |
|
40 |
try:
|
@@ -50,7 +50,7 @@ async def tban_usr(c: Gojo, m: Message):
|
|
50 |
await m.stop_propagation()
|
51 |
|
52 |
if user_id in SUPPORT_STAFF:
|
53 |
-
await m.reply_text(tlang(m, "
|
54 |
LOGGER.info(
|
55 |
f"{m.from_user.id} trying to ban {user_id} (SUPPORT_STAFF) in {m.chat.id}",
|
56 |
)
|
@@ -85,13 +85,13 @@ async def tban_usr(c: Gojo, m: Message):
|
|
85 |
admins_group = await admin_cache_reload(m, "ban")
|
86 |
|
87 |
if user_id in admins_group:
|
88 |
-
await m.reply_text(tlang(m, "
|
89 |
await m.stop_propagation()
|
90 |
|
91 |
try:
|
92 |
LOGGER.info(f"{m.from_user.id} tbanned {user_id} in {m.chat.id}")
|
93 |
await m.chat.ban_member(user_id, until_date=int(bantime))
|
94 |
-
txt = (tlang(m, "
|
95 |
admin=(await mention_html(m.from_user.first_name, m.from_user.id)),
|
96 |
banned=(await mention_html(user_first_name, user_id)),
|
97 |
chat_title=m.chat.title,
|
@@ -110,7 +110,7 @@ async def tban_usr(c: Gojo, m: Message):
|
|
110 |
await m.reply_animation(reply_to_message_id = r_id, animation = BAN_MEDIA, caption = txt, reply_markup=keyboard, parse_mode="html")
|
111 |
# await m.reply_text(txt, reply_markup=keyboard, reply_to_message_id=r_id)
|
112 |
except ChatAdminRequired:
|
113 |
-
await m.reply_text(tlang(m, "
|
114 |
except PeerIdInvalid:
|
115 |
await m.reply_text(
|
116 |
"I have not seen this user yet...!\nMind forwarding one of their message so I can recognize them?",
|
@@ -118,10 +118,10 @@ async def tban_usr(c: Gojo, m: Message):
|
|
118 |
except UserAdminInvalid:
|
119 |
await m.reply_text(tlang(m, "admin.user_admin_invalid"))
|
120 |
except RightForbidden:
|
121 |
-
await m.reply_text(tlang(m, tlang(m, "
|
122 |
except RPCError as ef:
|
123 |
await m.reply_text(
|
124 |
-
(tlang(m, "
|
125 |
SUPPORT_GROUP=SUPPORT_GROUP,
|
126 |
ef=ef,
|
127 |
),
|
@@ -134,7 +134,7 @@ async def tban_usr(c: Gojo, m: Message):
|
|
134 |
@Gojo.on_message(command("stban") & restrict_filter)
|
135 |
async def stban_usr(c: Gojo, m: Message):
|
136 |
if len(m.text.split()) == 1 and not m.reply_to_message:
|
137 |
-
await m.reply_text(tlang(m, "
|
138 |
await m.stop_propagation()
|
139 |
|
140 |
try:
|
@@ -150,7 +150,7 @@ async def stban_usr(c: Gojo, m: Message):
|
|
150 |
await m.stop_propagation()
|
151 |
|
152 |
if user_id in SUPPORT_STAFF:
|
153 |
-
await m.reply_text(tlang(m, "
|
154 |
LOGGER.info(
|
155 |
f"{m.from_user.id} trying to ban {user_id} (SUPPORT_STAFF) in {m.chat.id}",
|
156 |
)
|
@@ -183,7 +183,7 @@ async def stban_usr(c: Gojo, m: Message):
|
|
183 |
admins_group = await admin_cache_reload(m, "ban")
|
184 |
|
185 |
if user_id in admins_group:
|
186 |
-
await m.reply_text(tlang(m, "
|
187 |
await m.stop_propagation()
|
188 |
|
189 |
try:
|
@@ -195,7 +195,7 @@ async def stban_usr(c: Gojo, m: Message):
|
|
195 |
return
|
196 |
return
|
197 |
except ChatAdminRequired:
|
198 |
-
await m.reply_text(tlang(m, "
|
199 |
except PeerIdInvalid:
|
200 |
await m.reply_text(
|
201 |
"I have not seen this user yet...!\nMind forwarding one of their message so I can recognize them?",
|
@@ -203,7 +203,7 @@ async def stban_usr(c: Gojo, m: Message):
|
|
203 |
except UserAdminInvalid:
|
204 |
await m.reply_text(tlang(m, "admin.user_admin_invalid"))
|
205 |
except RightForbidden:
|
206 |
-
await m.reply_text(tlang(m, tlang(m, "
|
207 |
except RPCError as ef:
|
208 |
await m.reply_text(
|
209 |
(tlang(m, "general.some_error")).format(
|
|
|
34 |
@Gojo.on_message(command("tban") & restrict_filter)
|
35 |
async def tban_usr(c: Gojo, m: Message):
|
36 |
if len(m.text.split()) == 1 and not m.reply_to_message:
|
37 |
+
await m.reply_text(tlang(m, "admin.ban.no_target"))
|
38 |
await m.stop_propagation()
|
39 |
|
40 |
try:
|
|
|
50 |
await m.stop_propagation()
|
51 |
|
52 |
if user_id in SUPPORT_STAFF:
|
53 |
+
await m.reply_text(tlang(m, "admin.support_cannot_restrict"))
|
54 |
LOGGER.info(
|
55 |
f"{m.from_user.id} trying to ban {user_id} (SUPPORT_STAFF) in {m.chat.id}",
|
56 |
)
|
|
|
85 |
admins_group = await admin_cache_reload(m, "ban")
|
86 |
|
87 |
if user_id in admins_group:
|
88 |
+
await m.reply_text(tlang(m, "admin.ban.admin_cannot_ban"))
|
89 |
await m.stop_propagation()
|
90 |
|
91 |
try:
|
92 |
LOGGER.info(f"{m.from_user.id} tbanned {user_id} in {m.chat.id}")
|
93 |
await m.chat.ban_member(user_id, until_date=int(bantime))
|
94 |
+
txt = (tlang(m, "admin.ban.banned_user")).format(
|
95 |
admin=(await mention_html(m.from_user.first_name, m.from_user.id)),
|
96 |
banned=(await mention_html(user_first_name, user_id)),
|
97 |
chat_title=m.chat.title,
|
|
|
110 |
await m.reply_animation(reply_to_message_id = r_id, animation = BAN_MEDIA, caption = txt, reply_markup=keyboard, parse_mode="html")
|
111 |
# await m.reply_text(txt, reply_markup=keyboard, reply_to_message_id=r_id)
|
112 |
except ChatAdminRequired:
|
113 |
+
await m.reply_text(tlang(m, "admin.not_admin"))
|
114 |
except PeerIdInvalid:
|
115 |
await m.reply_text(
|
116 |
"I have not seen this user yet...!\nMind forwarding one of their message so I can recognize them?",
|
|
|
118 |
except UserAdminInvalid:
|
119 |
await m.reply_text(tlang(m, "admin.user_admin_invalid"))
|
120 |
except RightForbidden:
|
121 |
+
await m.reply_text(tlang(m, tlang(m, "admin.ban.bot_no_right")))
|
122 |
except RPCError as ef:
|
123 |
await m.reply_text(
|
124 |
+
(tlang(m, "general.some_error")).format(
|
125 |
SUPPORT_GROUP=SUPPORT_GROUP,
|
126 |
ef=ef,
|
127 |
),
|
|
|
134 |
@Gojo.on_message(command("stban") & restrict_filter)
|
135 |
async def stban_usr(c: Gojo, m: Message):
|
136 |
if len(m.text.split()) == 1 and not m.reply_to_message:
|
137 |
+
await m.reply_text(tlang(m, "admin.ban.no_target"))
|
138 |
await m.stop_propagation()
|
139 |
|
140 |
try:
|
|
|
150 |
await m.stop_propagation()
|
151 |
|
152 |
if user_id in SUPPORT_STAFF:
|
153 |
+
await m.reply_text(tlang(m, "admin.support_cannot_restrict"))
|
154 |
LOGGER.info(
|
155 |
f"{m.from_user.id} trying to ban {user_id} (SUPPORT_STAFF) in {m.chat.id}",
|
156 |
)
|
|
|
183 |
admins_group = await admin_cache_reload(m, "ban")
|
184 |
|
185 |
if user_id in admins_group:
|
186 |
+
await m.reply_text(tlang(m, "admin.ban.admin_cannot_ban"))
|
187 |
await m.stop_propagation()
|
188 |
|
189 |
try:
|
|
|
195 |
return
|
196 |
return
|
197 |
except ChatAdminRequired:
|
198 |
+
await m.reply_text(tlang(m, "admin.not_admin"))
|
199 |
except PeerIdInvalid:
|
200 |
await m.reply_text(
|
201 |
"I have not seen this user yet...!\nMind forwarding one of their message so I can recognize them?",
|
|
|
203 |
except UserAdminInvalid:
|
204 |
await m.reply_text(tlang(m, "admin.user_admin_invalid"))
|
205 |
except RightForbidden:
|
206 |
+
await m.reply_text(tlang(m, tlang(m, "admin.ban.bot_no_right")))
|
207 |
except RPCError as ef:
|
208 |
await m.reply_text(
|
209 |
(tlang(m, "general.some_error")).format(
|