Exemple #1
0
 async def flood_checm(event):
     count = 1
     chat = (await event.get_chat()).title
     if event.chat_id in _check_flood.keys():
         if event.sender_id == [
                 x for x in _check_flood[event.chat_id].keys()
         ][0]:
             count = _check_flood[event.chat_id][event.sender_id]
             _check_flood[event.chat_id] = {event.sender_id: count + 1}
         else:
             _check_flood[event.chat_id] = {event.sender_id: count}
     else:
         _check_flood[event.chat_id] = {event.sender_id: count}
     if await check_if_admin(event) or event.sender.bot:
         return
     if event.sender_id in DEVLIST:
         return
     if _check_flood[event.chat_id][event.sender_id] >= int(
             get_flood_limit(event.chat_id)):
         try:
             name = event.sender.first_name
             await event.client.edit_permissions(event.chat_id,
                                                 event.sender_id,
                                                 send_messages=False)
             del _check_flood[event.chat_id]
             await event.reply("#AntiFlood\n\n`You have been muted.`")
             await asst.send_message(
                 int(Redis("LOG_CHANNEL")),
                 f"#Antiflood\n\n`Muted `[{name}](tg://user?id={event.sender_id})` in {chat}`",
                 buttons=Button.inline(
                     "Unmute",
                     data=f"anti_{event.sender_id}_{event.chat_id}"),
             )
         except BaseException:
             pass
Exemple #2
0
async def getflood(e):
    ok = get_flood_limit(e.chat_id)
    if ok:
        return await eor(e, f"`Flood limit for this chat is {ok}.`", time=5)
    await eor(e, "`No flood limits in this chat.`", time=5)