Spaces:
Paused
Paused
Captain Ezio
commited on
Commit
·
aebd97a
1
Parent(s):
f826b42
Update flood.py
Browse files- Powers/plugins/flood.py +45 -24
Powers/plugins/flood.py
CHANGED
|
@@ -128,7 +128,7 @@ async def flood_on_off(c: Gojo, m: Message):
|
|
| 128 |
slimit = is_flood[0]
|
| 129 |
swithin = is_flood[1]
|
| 130 |
return await m.reply_text(f"Flood is on for this chat\n**Action**: {saction}\n**Messages**: {slimit} within {swithin} sec")
|
| 131 |
-
return await m.reply_text("Flood protection is off
|
| 132 |
|
| 133 |
@Gojo.on_message(command(['setflood']) & ~filters.bot & admin_filter)
|
| 134 |
async def flood_set(c: Gojo, m: Message):
|
|
@@ -149,7 +149,7 @@ async def flood_set(c: Gojo, m: Message):
|
|
| 149 |
slimit = is_flood[0]
|
| 150 |
swithin = is_flood[1]
|
| 151 |
return await m.reply_text(f"Flood is on for this chat\n**Action**: {saction}\n**Messages**: {slimit} within {swithin} sec")
|
| 152 |
-
return await m.reply_text("Flood protection is off
|
| 153 |
|
| 154 |
if len(split) == 2:
|
| 155 |
c_id = m.chat.id
|
|
@@ -182,32 +182,53 @@ async def callbacks(c: Gojo, q: CallbackQuery):
|
|
| 182 |
if user in SUPPORT_STAFF or user_status in [CMS.OWNER, CMS.ADMINISTRATOR]:
|
| 183 |
if data in ["f_mute", "f_ban", "f_kick"]:
|
| 184 |
change = data.split("_")[1]
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
change = int(data.split("_")[1])
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
if data in ["f_f_5", "f_f_10", "f_f_15"]:
|
| 202 |
data = data.split("_")[-1]
|
| 203 |
change = int(data)
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
else:
|
| 212 |
await q.answer(
|
| 213 |
"You don't have enough permission to do this!\nStay in your limits!",
|
|
|
|
| 128 |
slimit = is_flood[0]
|
| 129 |
swithin = is_flood[1]
|
| 130 |
return await m.reply_text(f"Flood is on for this chat\n**Action**: {saction}\n**Messages**: {slimit} within {swithin} sec")
|
| 131 |
+
return await m.reply_text("Flood protection is off for this chat.")
|
| 132 |
|
| 133 |
@Gojo.on_message(command(['setflood']) & ~filters.bot & admin_filter)
|
| 134 |
async def flood_set(c: Gojo, m: Message):
|
|
|
|
| 149 |
slimit = is_flood[0]
|
| 150 |
swithin = is_flood[1]
|
| 151 |
return await m.reply_text(f"Flood is on for this chat\n**Action**: {saction}\n**Messages**: {slimit} within {swithin} sec")
|
| 152 |
+
return await m.reply_text("Flood protection is off for this chat.")
|
| 153 |
|
| 154 |
if len(split) == 2:
|
| 155 |
c_id = m.chat.id
|
|
|
|
| 182 |
if user in SUPPORT_STAFF or user_status in [CMS.OWNER, CMS.ADMINISTRATOR]:
|
| 183 |
if data in ["f_mute", "f_ban", "f_kick"]:
|
| 184 |
change = data.split("_")[1]
|
| 185 |
+
if not change == saction:
|
| 186 |
+
Flood.save_flood(c_id, slimit, swithin, change)
|
| 187 |
+
await q.answer("Updated action", show_alert=True)
|
| 188 |
+
await q.edit_message_caption(
|
| 189 |
+
f"Set the limit of message after the flood protection will be activated\n **CURRENT LIMIT** {slimit} messages",
|
| 190 |
+
reply_markup=limit_kb
|
| 191 |
+
)
|
| 192 |
+
return
|
| 193 |
+
else:
|
| 194 |
+
await q.answer("Updated action", show_alert=True)
|
| 195 |
+
await q.edit_message_caption(
|
| 196 |
+
f"Set the limit of message after the flood protection will be activated\n **CURRENT LIMIT** {slimit} messages",
|
| 197 |
+
reply_markup=limit_kb
|
| 198 |
+
)
|
| 199 |
+
if data in ["f_5", "f_10", "f_15"]:
|
| 200 |
change = int(data.split("_")[1])
|
| 201 |
+
if not change == slimit:
|
| 202 |
+
Flood.save_flood(c_id, change, swithin, saction)
|
| 203 |
+
await q.answer("Updated limit", show_alert=True)
|
| 204 |
+
await q.edit_message_caption(
|
| 205 |
+
f"Set the time with the number of message recived treated as flood\n **CUURENT TIME** {swithin}",
|
| 206 |
+
reply_markup=within_kb
|
| 207 |
+
)
|
| 208 |
+
return
|
| 209 |
+
else:
|
| 210 |
+
await q.answer("Updated action", show_alert=True)
|
| 211 |
+
await q.edit_message_caption(
|
| 212 |
+
f"Set the limit of message after the flood protection will be activated\n **CURRENT LIMIT** {slimit} messages",
|
| 213 |
+
reply_markup=limit_kb
|
| 214 |
+
)
|
| 215 |
if data in ["f_f_5", "f_f_10", "f_f_15"]:
|
| 216 |
data = data.split("_")[-1]
|
| 217 |
change = int(data)
|
| 218 |
+
if not change == swithin:
|
| 219 |
+
Flood.save_flood(c_id, slimit, change, saction)
|
| 220 |
+
await q.answer("Updated", show_alert=True)
|
| 221 |
+
await q.edit_message_caption(
|
| 222 |
+
"Flood protection setting has been updated",
|
| 223 |
+
reply_markup=close_kb
|
| 224 |
+
)
|
| 225 |
+
return
|
| 226 |
+
else:
|
| 227 |
+
await q.answer("Updated action", show_alert=True)
|
| 228 |
+
await q.edit_message_caption(
|
| 229 |
+
f"Set the limit of message after the flood protection will be activated\n **CURRENT LIMIT** {slimit} messages",
|
| 230 |
+
reply_markup=limit_kb
|
| 231 |
+
)
|
| 232 |
else:
|
| 233 |
await q.answer(
|
| 234 |
"You don't have enough permission to do this!\nStay in your limits!",
|