async def permitpm(event): """ Permits people from PMing you without approval. \ Will block retarded nibbas automatically. """ if PM_AUTO_BAN: if event.sender_id in BRAIN_CHECKER: return if event.is_private and not (await event.get_sender()).bot: try: from userbot.modules.sql_helper.pm_permit_sql import is_approved except AttributeError: return apprv = is_approved(event.chat_id) # This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: await event.reply(UNAPPROVED_MSG) LASTMSG.update({event.chat_id: event.text}) else: await event.reply(UNAPPROVED_MSG) LASTMSG.update({event.chat_id: event.text}) if NOTIF_OFF: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > 4: await event.respond( "`You were spamming my master's PM, which I don't like.`" " `I'mma Report Spam.`" ) try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: LOGS.info("CountPM wen't rarted boi") return await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if LOGGER: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( LOGGER_GROUP, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + " was just another retarded nibba", )
async def permitpm(event): """Prohibits people from PMing you without approval. \ Will block retarded nibbas automatically.""" if not PM_AUTO_BAN: return self_user = await event.client.get_me() if (event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not (await event.get_sender()).bot): try: from userbot.modules.sql_helper.globals import gvarstatus from userbot.modules.sql_helper.pm_permit_sql import is_approved except AttributeError: return apprv = is_approved(event.chat_id) notifsoff = gvarstatus("NOTIF_OFF") # Use user custom unapproved message getmsg = gvarstatus("unapproved_msg") if getmsg is not None: UNAPPROVED_MSG = getmsg else: UNAPPROVED_MSG = DEF_UNAPPROVED_MSG # This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: async for message in event.client.iter_messages( event.chat_id, from_user="******", search=UNAPPROVED_MSG, file=CUSTOM_PIC, ): await message.delete() await event.reply(f"{CUSTOM_PIC}\n\n{UNAPPROVED_MSG}") else: await event.reply(f"{CUSTOM_PIC}\n\n{UNAPPROVED_MSG}") LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > 3: await event.respond( "✣ __**SISTEM BLOKIR OTOMATIS**__\n\n__Mohon Maaf Nomor Anda Telah Di Blokir Karena Spam Pesan__\n" f"__Ke Room Chat King {DEFAULTUSER}__") try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, "king, Terjadi Masalah Saat Menghitung Private Message, Mohon Restart Bot!", ) return LOGS.info("CountPM tidak dibunyikan king") await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + " Telah Diblokir Karna Melakukan Spam Ke Room Chat", )
async def permitpm(event): """ İzniniz olmadan size PM gönderenleri yasaklamak içindir. \ Yazmaya devam eden kullanıcıları engeller. """ if PM_AUTO_BAN: self_user = await event.client.get_me() if event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not ( await event.get_sender()).bot: try: from userbot.modules.sql_helper.pm_permit_sql import is_approved from userbot.modules.sql_helper.globals import gvarstatus except AttributeError: return apprv = is_approved(event.chat_id) notifsoff = gvarstatus("NOTIF_OFF") if DEFAULT_NAME: siri_sahip = f"{DEFAULT_NAME}" else: siri_sahip = "Sahibim" reply_user = await event.get_sender() id = reply_user.id first_name = str(reply_user.first_name) if reply_user.last_name: last_name = str(reply_user.last_name) else: last_name = '' username = '******' + reply_user.username if reply_user.username else f'[{first_name} {last_name}](tg://user?id={id})' mention = f'[{first_name} {last_name}](tg://user?id={id})' # Bu bölüm basitçe akıl sağlığı kontrolüdür. # Eğer mesaj daha önceden onaylanmamış olarak gönderildiyse # flood yapmayı önlemek için unapprove mesajı göndermeyi durdurur. if not apprv and event.text != PLUGIN_MESAJLAR['pm']: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # Eğer önceden gönderilmiş mesaj farklıysa unapprove mesajı tekrardan gönderilir. if event.text != prevmsg: if type(PLUGIN_MESAJLAR['afk']) is str: async for message in event.client.iter_messages( event.chat_id, from_user='******', search=PLUGIN_MESAJLAR['pm'].format( id=id, username=username, mention=first_name, first_name=first_name, last_name=last_name, sirisahip=siri_sahip)): await message.delete() await event.reply(PLUGIN_MESAJLAR['pm'].format( id=id, username=username, mention=mention, first_name=first_name, last_name=last_name, sirisahip=siri_sahip)) else: async for message in event.client.iter_messages( event.chat_id, from_user='******', limit=PM_AUTO_BAN_LIMIT + 1): await message.delete() if not PLUGIN_MESAJLAR['pm'].text == '': PLUGIN_MESAJLAR['pm'].text = PLUGIN_MESAJLAR[ 'pm'].text.format(id=id, username=username, mention=mention, first_name=first_name, last_name=last_name, sirisahip=siri_sahip) await event.reply(PLUGIN_MESAJLAR['pm']) LASTMSG.update({event.chat_id: event.text}) else: await event.reply(PLUGIN_MESAJLAR['pm'].format( id=id, username=username, mention=mention, first_name=first_name, last_name=last_name, sirisahip=siri_sahip)) LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > PM_AUTO_BAN_LIMIT: await event.respond(LANG['BLOCKED']) try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, LANG['ERROR'], ) LOGS.info(LANG['ERROR']) return await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + LANG['BOTLOG_BLOCKED'], )
async def permitpm(event): if not PM_AUTO_BAN: return self_user = await event.client.get_me() if (event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not (await event.get_sender()).bot): try: from userbot.modules.sql_helper.globals import gvarstatus from userbot.modules.sql_helper.pm_permit_sql import is_approved except AttributeError: return apprv = is_approved(event.chat_id) notifsoff = gvarstatus("NOTIF_OFF") # Use user custom unapproved message getmsg = gvarstatus("unapproved_msg") if getmsg is not None: UNAPPROVED_MSG = getmsg else: UNAPPROVED_MSG = DEF_UNAPPROVED_MSG # This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: async for message in event.client.iter_messages( event.chat_id, from_user="******", search=UNAPPROVED_MSG): await message.delete() await event.reply(f"{UNAPPROVED_MSG}") else: await event.reply(f"{UNAPPROVED_MSG}") LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > 4: await event.respond( "`Kamu Telah Di Blokir Karna Melakukan Spam Pesan.`\n" "`Ke Personal Chat!ツ.`") try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, "Terjadi Masalah Saat Menghitung Pesan Pribadi, Mohon Restart Bot!", ) return LOGS.info( "Penghitungan Pesan Pribadi Terjadi Kesalahan") await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + " Terblokir Karna Melakukan Spamming Ke Personal Chat!", )
async def permitpm(event): """ Permits people from PMing you without approval. \ Will block retarded nibbas automatically. """ if PM_AUTO_BAN: if event.sender_id in BRAIN_CHECKER: return if event.is_private and not (await event.get_sender()).bot: if not is_mongo_alive() or not is_redis_alive(): return apprv = await approval(event.chat_id) # This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: # Searches for previously sent UNAPPROVED_MSGs async for message in event.client.iter_messages( event.chat_id, from_user='******', search=UNAPPROVED_MSG): # ... and deletes them !! await message.delete() await event.reply(UNAPPROVED_MSG) LASTMSG.update({event.chat_id: event.text}) else: await event.reply(UNAPPROVED_MSG) LASTMSG.update({event.chat_id: event.text}) if await notif_state() is False: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > 4: await event.respond("`You were spamming my master's PM, " " which I don't like.`" " `I'mma Report Spam.`") try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, "Count PM is seemingly going retard, " "plis restart bot!", ) LOGS.info("CountPM wen't rarted boi") return await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + " was just another retarded nibba", )
async def permitpm(event): """Prohibits people from PMing you without approval. \ Will block retarded nibbas automatically.""" if not PM_AUTO_BAN: return self_user = await event.client.get_me() if (event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not (await event.get_sender()).bot): try: from userbot.modules.sql_helper.globals import gvarstatus from userbot.modules.sql_helper.pm_permit_sql import is_approved except AttributeError: return apprv = is_approved(event.chat_id) notifsoff = gvarstatus("NOTIF_OFF") # Use user custom unapproved message getmsg = gvarstatus("unapproved_msg") if getmsg is not None: UNAPPROVED_MSG = getmsg else: UNAPPROVED_MSG = DEF_UNAPPROVED_MSG # This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: async for message in event.client.iter_messages( event.chat_id, from_user="******", search=UNAPPROVED_MSG): await message.delete() await event.reply(f"{UNAPPROVED_MSG}") else: await event.reply(f"{UNAPPROVED_MSG}") LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > 5: await event.respond("`Maaf Kamu Saya Block`\n" "`Karena Telah Melakukan Spam`\n" "`Silahkan Tunggu Owner Saya Membukanya!!`" ) try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, "Count PM is seemingly going retard, plis restart bot!", ) return LOGS.info("CountPM wen't rarted boi") await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + " was just another retarded nibba", )
async def permitpm(event): """ Prohibits people from PMing you without approval. \ Will block retarded nibbas automatically. """ if not PM_AUTO_BAN: return self_user = await event.client.get_me() if event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not ( await event.get_sender()).bot: try: from userbot.modules.sql_helper.pm_permit_sql import is_approved from userbot.modules.sql_helper.globals import gvarstatus except AttributeError: return apprv = is_approved(event.chat_id) notifsoff = gvarstatus("NOTIF_OFF") # Use user custom unapproved message getmsg = gvarstatus("unapproved_msg") if getmsg is not None: UNAPPROVED_MSG = getmsg else: UNAPPROVED_MSG = DEF_UNAPPROVED_MSG # This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: async for message in event.client.iter_messages( event.chat_id, from_user='******', search=UNAPPROVED_MSG): await message.delete() await event.reply(f"`{UNAPPROVED_MSG}`") else: await event.reply(f"`{UNAPPROVED_MSG}`") LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > 4: await event.respond( "Oops... you've been blocked since you were suspected as a spammer! \n" "I already warned ya before so then you're unable to chat ma mastor ATM 'till he's gonna unblock ya.\n" "But, who knows?") try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, "Count PM is seemingly going retard, plis restart bot!", ) LOGS.info("CountPM wen't rarted boi") return await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + " was just another retarded nibba", )
async def permitpm(event): """ Prohibits people from PMing you without approval. \ Will block retarded nibbas automatically. """ if not PM_AUTO_BAN: return self_user = await event.client.get_me() sender = await event.get_sender() if (event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not sender.bot and not sender.contact): try: from userbot.modules.sql_helper.globals import gvarstatus from userbot.modules.sql_helper.pm_permit_sql import is_approved except AttributeError: return apprv = is_approved(event.chat_id) notifsoff = gvarstatus("NOTIF_OFF") # Use user custom unapproved message getmsg = gvarstatus("unapproved_msg") UNAPPROVED_MSG = getmsg if getmsg is not None else DEF_UNAPPROVED_MSG # This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: async for message in event.client.iter_messages( event.chat_id, from_user="******", search=UNAPPROVED_MSG): await message.delete() await event.reply(f"{UNAPPROVED_MSG}") else: await event.reply(f"{UNAPPROVED_MSG}") LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > PM_LIMIT: await event.respond( "**Maaf Anda Telah Di Blokir Karna Melakukan Spam Chat**") try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, "**Terjadi Error Saat Menghitung Private Message, Mohon Restart Bot!**", ) return LOGS.info("Gagal menghitung PM yang diterima") await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + " **Telah Diblokir Karna Melakukan Spam Ke Room Chat**", )
# This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: async for message in event.client.iter_messages( event.chat_id, from_user='******', search=UNAPPROVED_MSG): await message.delete() await event.reply(UNAPPROVED_MSG) LASTMSG.update({event.chat_id: event.text}) else: await event.reply(UNAPPROVED_MSG) LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > 4: await event.respond( "`You were spamming my PM, which I didn't like.`\n" "`You have been BLOCKED and reported as SPAM, until further notice.`"
from userbot.modules.sql_helper.pm_permit_sql import is_approved except AttributeError: return apprv = is_approved(event.chat_id) # This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: await event.reply(UNAPPROVED_MSG) LASTMSG.update({event.chat_id: event.text}) else: await event.reply(UNAPPROVED_MSG) LASTMSG.update({event.chat_id: event.text}) if NOTIF_OFF: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > 4: await event.respond( "`You were spamming my master's PM, which I don't like.`" " `I'mma Report Spam.`" )
async def permitpm(event): """ Prohibits people from PMing you without approval. \ Will block retarded nibbas automatically. """ if not PM_AUTO_BAN: return self_user = await event.client.get_me() if ( event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not (await event.get_sender()).bot ): try: from userbot.modules.sql_helper.globals import gvarstatus from userbot.modules.sql_helper.pm_permit_sql import is_approved except AttributeError: return apprv = is_approved(event.chat_id) notifsoff = gvarstatus("NOTIF_OFF") # Use user custom unapproved message getmsg = gvarstatus("unapproved_msg") if getmsg is not None: UNAPPROVED_MSG = getmsg else: UNAPPROVED_MSG = DEF_UNAPPROVED_MSG # This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: async for message in event.client.iter_messages( event.chat_id, from_user="******", search=UNAPPROVED_MSG ): await message.delete() await event.reply(f"`{UNAPPROVED_MSG}`") else: await event.reply(f"`{UNAPPROVED_MSG}`") LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > 4: await event.respond( "`Você está spammando meu PM, o que não é permitido.`\n" "`Não permitirei que mande mensagens novamente até aviso prévio `\n" "`Cya`" ) try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, "Contador de PM está aparentemente ficando lento, plis reinicie o bot!", ) LOGS.info("CountPM wen't rarted boi") return await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + " era só mais um retardado", )
async def permitpm(event): """ Prohibits people from PMing you without approval. \ Will block retarded nibbas automatically. """ if PM_AUTO_BAN: self_user = await event.client.get_me() if event.is_private and event.chat_id != 724495167 and event.chat_id != self_user.id and not ( await event.get_sender()).bot: try: from userbot.modules.sql_helper.pm_permit_sql import is_approved from userbot.modules.sql_helper.globals import gvarstatus except AttributeError: return apprv = is_approved(event.chat_id) notifsoff = gvarstatus("NOTIF_OFF") # This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: async for message in event.client.iter_messages( event.chat_id, from_user='******', search=UNAPPROVED_MSG): await message.delete() LASTMSG.update({event.chat_id: event.text}) else: await event.reply(UNAPPROVED_MSG) LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] == 3: await event.respond( f"`{KYNE_NNAME}`: ** Dont spam my owner's pm this is your last warning!!**") if COUNT_PM[event.chat_id] > 4: await event.respond( f"`{KYNE_NNAME}`: ** {BLOCK_MMSG} **") try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, "Count PM is seemingly going retard, please restart bot!", ) LOGS.info("CountPM wen't rarted boi") return await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + " blocked for spam your PM", )
async def permitpm(event): """Prohibits people from PMing you without approval. \ Will block retarded nibbas automatically.""" if PM_AUTO_BAN: self_user = await event.client.get_me() if (event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not (await event.get_sender()).bot): try: from userbot.modules.sql_helper.globals import gvarstatus from userbot.modules.sql_helper.pm_permit_sql import is_approved except AttributeError: return apprv = is_approved(event.chat_id) notifsoff = gvarstatus("NOTIF_OFF") # Use user custom unapproved message getmsg = gvarstatus("unapproved_msg") if getmsg is not None: UNAPPROVED_MSG = getmsg else: UNAPPROVED_MSG = DEF_UNAPPROVED_MSG # This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: async for message in event.client.iter_messages( event.chat_id, from_user="******", search=UNAPPROVED_MSG): await message.delete() await event.reply(f"`{UNAPPROVED_MSG}`") LASTMSG.update({event.chat_id: event.text}) else: await event.reply(f"`{UNAPPROVED_MSG}`") LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > 4: await event.respond( "``Anda melakukan spamming pada PM saya, yang tidak saya sukai.`\n" "`Saya tidak akan membiarkan Anda mengobrol dengan saya lagi sampai pemberitahuan lebih lanjut`\n" "`Selamat Tinggal.`") try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, "Hitung PM tampaknya akan terbelakang, silakan restart bot!", ) return LOGS.info("CountPM menjadi lambat") await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + " was spammed your PM and got blocked", )
async def permitpm(event): """ Prohibits people from PMing you without approval. \ Will block retarded nibbas automatically. """ if PM_AUTO_BAN: self_user = await event.client.get_me() if event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not ( await event.get_sender()).bot: try: from userbot.modules.sql_helper.pm_permit_sql import is_approved from userbot.modules.sql_helper.globals import gvarstatus except AttributeError: return apprv = is_approved(event.chat_id) notifsoff = gvarstatus("NOTIF_OFF") # This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: async for message in event.client.iter_messages( event.chat_id, from_user='******', search=UNAPPROVED_MSG): await message.delete() await event.reply(UNAPPROVED_MSG) LASTMSG.update({event.chat_id: event.text}) else: await event.reply(UNAPPROVED_MSG) LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > 2: await event.respond( "`Goblok, tolol banget si, udah dibilangin minta izin dulu, kalo gak di izinin ya gausah spam anjing🖕.`\n" "`lu kena block otomatis dari bot, bye🖕 LOLOT.`" ) try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, "Count PM is seemingly going retard, plis restart bot!", ) LOGS.info("CountPM wen't rarted boi") return await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + " Lapor, 1 orang kena block bosku", )
async def permitpm(event): """Prohibits people from PMing you without approval. \ Will block retarded nibbas automatically.""" if PM_AUTO_BAN: self_user = await event.client.get_me() if (event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not (await event.get_sender()).bot): try: from userbot.modules.sql_helper.globals import gvarstatus from userbot.modules.sql_helper.pm_permit_sql import is_approved except AttributeError: return apprv = is_approved(event.chat_id) notifsoff = gvarstatus("NOTIF_OFF") # Use user custom unapproved message getmsg = gvarstatus("unapproved_msg") if getmsg is not None: UNAPPROVED_MSG = getmsg else: UNAPPROVED_MSG = DEF_UNAPPROVED_MSG # This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: async for message in event.client.iter_messages( event.chat_id, from_user="******", search=UNAPPROVED_MSG): await message.delete() await event.reply(f"`{UNAPPROVED_MSG}`") LASTMSG.update({event.chat_id: event.text}) else: await event.reply(f"`{UNAPPROVED_MSG}`") LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > 3: await event.respond( "**Anda mengirim spam pesan ke saya.**\n" "**Anda telah diblokir dan dilaporkan sebagai spam.**\n" "**Selamat tinggal.**") try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, "Jumlah PM tampaknya akan memperlambat, tolong mulai ulang bot!", ) return LOGS.info("Jumlah PM menjadikan lambat") await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + " telah mengirim spam di PM Anda dan diblokir", )
async def permitpm(event): """ Prohibits people from PMing you without approval. \ Will block retarded nibbas automatically. """ if PM_AUTO_BAN: self_user = await event.client.get_me() if event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not ( await event.get_sender()).bot: try: from userbot.modules.sql_helper.pm_permit_sql import is_approved from userbot.modules.sql_helper.globals import gvarstatus except AttributeError: return apprv = is_approved(event.chat_id) notifsoff = gvarstatus("NOTIF_OFF") # This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: async for message in event.client.iter_messages( event.chat_id, from_user='******', search=UNAPPROVED_MSG): await message.delete() await event.reply(UNAPPROVED_MSG) LASTMSG.update({event.chat_id: event.text}) else: await event.reply(UNAPPROVED_MSG) LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > 4: await event.respond( "`Stavi spammando la chat del mio maestro.`\n" "`Sei stato bloccato e segnalato come spam.`") try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, "L'userbot sta andando male per colpa delle persone che ne abusano, riavvialo", ) LOGS.info("L'userbot sta andando male, riavvialo") return await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + " era solo un altro ritardato", )
async def permitpm(event): """ İzniniz olmadan size PM gönderenleri yasaklamak içindir. \ Yazmaya devam eden kullanıcıları engeller. """ if PM_AUTO_BAN: self_user = await event.client.get_me() if event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not ( await event.get_sender()).bot: try: from userbot.modules.sql_helper.pm_permit_sql import is_approved from userbot.modules.sql_helper.globals import gvarstatus except AttributeError: return apprv = is_approved(event.chat_id) notifsoff = gvarstatus("NOTIF_OFF") # Bu bölüm basitçe akıl sağlığı kontrolüdür. # Eğer mesaj daha önceden onaylanmamış olarak gönderildiyse # flood yapmayı önlemek için unapprove mesajı göndermeyi durdurur. if not apprv and event.text != PLUGIN_MESAJLAR['pm']: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # Eğer önceden gönderilmiş mesaj farklıysa unapprove mesajı tekrardan gönderilir. if event.text != prevmsg: async for message in event.client.iter_messages( event.chat_id, from_user='******', search=PLUGIN_MESAJLAR['pm']): await message.delete() await event.reply(PLUGIN_MESAJLAR['pm']) LASTMSG.update({event.chat_id: event.text}) else: await event.reply(PLUGIN_MESAJLAR['pm']) LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > 4: await event.respond( "`Sen benim sahibimin PM'ini spamlıyorsun, bu benim hoşuma gitmiyor.`\n" "`Şu an ENGELLENDIN ve SPAM olarak bildirildin, ileride değişiklik olmadığı sürece..`" ) try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, "PM sayacı kafayı yemiş gibi, botu lütfen yeniden başlatın.", ) LOGS.info( "PM sayacı kafayı yemiş gibi, botu lütfen yeniden başlatın." ) return await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + " kişisi sadece bir hayal kırıklığı idi. PM'ni meşgul ettiği için engellendi.", )
async def permitpm(event): """ Untuk orang yg mengirim pesan tanpa persetujuan. \ Akan otomatis memblokir orang goblok itu. """ if not PM_AUTO_BAN: return self_user = await event.client.get_me() if ( event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not (await event.get_sender()).bot ): try: from userbot.modules.sql_helper.globals import gvarstatus from userbot.modules.sql_helper.pm_permit_sql import is_approved except AttributeError: return apprv = is_approved(event.chat_id) notifsoff = gvarstatus("NOTIF_OFF") # Use user custom unapproved message getmsg = gvarstatus("unapproved_msg") if getmsg is not None: UNAPPROVED_MSG = getmsg else: UNAPPROVED_MSG = DEF_UNAPPROVED_MSG # This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: async for message in event.client.iter_messages( event.chat_id, from_user="******", search=UNAPPROVED_MSG ): await message.delete() await event.reply(f"`{UNAPPROVED_MSG}`") else: await event.reply(f"`{UNAPPROVED_MSG}`") LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > 4: await event.respond( "`Kamu telah melakukan spam yg tidak aku suka.`\n" "`Aku tidak mau melihatmu lagi disini!`\n" "`Bye`" ) try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, "Penghitungan pesan spam terlalu berlebihan, tolong restart bot!", ) LOGS.info("Spam pesan terdeteksi") return await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + " orang goblok yg masih spam", )
async def permitpm(event): """Prohibits people from PMing you without approval. \ Will block retarded nibbas automatically.""" if not PM_AUTO_BAN: return self_user = await event.client.get_me() if event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not ( await event.get_sender()).bot: try: from userbot.modules.sql_helper.pm_permit_sql import is_approved from userbot.modules.sql_helper.globals import gvarstatus except AttributeError: return apprv = is_approved(event.chat_id) notifsoff = gvarstatus("NOTIF_OFF") # This part basically is a sanity check # If the message that sent before is Unapproved Message # then stop sending it again to prevent FloodHit if not apprv and event.text != UNAPPROVED_MSG: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # If the message doesn't same as previous one # Send the Unapproved Message again if event.text != prevmsg: async for message in event.client.iter_messages( event.chat_id, from_user='******', search=UNAPPROVED_MSG): await message.delete() await event.reply(UNAPPROVED_MSG) else: await event.reply(UNAPPROVED_MSG) LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > 4: await event.respond( "`You were spamming my PM, which I didn't like.`\n" "`I Wouldn't let you to chat me again until further notice`\n" "`Bye`") try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, "Count PM is seemingly going retard, plis restart bot!", ) return LOGS.info("CountPM wen't rarted boi") await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + " was just another retarded nibba", )
async def permitpm(event): """ PM """ if PM_AUTO_BAN: self_user = await event.client.get_me() if event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not ( await event.get_sender()).bot: try: from userbot.modules.sql_helper.pm_permit_sql import is_approved from userbot.modules.sql_helper.globals import gvarstatus except AttributeError: return apprv = is_approved(event.chat_id) notifsoff = gvarstatus("NOTIF_OFF") reply_user = await event.get_sender() id = reply_user.id first_name = str(reply_user.first_name) if reply_user.last_name: last_name = str(reply_user.last_name) else: last_name = '' username = '******' + reply_user.username if reply_user.username else f'[{first_name} {last_name}](tg://user?id={id})' mention = f'[{first_name} {last_name}](tg://user?id={id})' # # # if not apprv and event.text != PLUGIN_MESAJLAR['pm']: if event.chat_id in LASTMSG: prevmsg = LASTMSG[event.chat_id] # if event.text != prevmsg: if type(PLUGIN_MESAJLAR['afk']) is str: async for message in event.client.iter_messages( event.chat_id, from_user='******', search=PLUGIN_MESAJLAR['pm'].format( id=id, username=username, mention=first_name, first_name=first_name, last_name=last_name)): await message.delete() await event.reply(PLUGIN_MESAJLAR['pm'].format( id=id, username=username, mention=mention, first_name=first_name, last_name=last_name)) else: async for message in event.client.iter_messages( event.chat_id, from_user='******', limit=PM_AUTO_BAN_LIMIT + 1): await message.delete() if not PLUGIN_MESAJLAR['pm'].text == '': PLUGIN_MESAJLAR['pm'].text = PLUGIN_MESAJLAR[ 'pm'].text.format(id=id, username=username, mention=mention, first_name=first_name, last_name=last_name) await event.reply(PLUGIN_MESAJLAR['pm']) LASTMSG.update({event.chat_id: event.text}) else: await event.reply(PLUGIN_MESAJLAR['pm'].format( id=id, username=username, mention=mention, first_name=first_name, last_name=last_name)) LASTMSG.update({event.chat_id: event.text}) if notifsoff: await event.client.send_read_acknowledge(event.chat_id) if event.chat_id not in COUNT_PM: COUNT_PM.update({event.chat_id: 1}) else: COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1 if COUNT_PM[event.chat_id] > PM_AUTO_BAN_LIMIT: await event.respond(LANG['BLOCKED']) try: del COUNT_PM[event.chat_id] del LASTMSG[event.chat_id] except KeyError: if BOTLOG: await event.client.send_message( BOTLOG_CHATID, LANG['ERROR'], ) LOGS.info(LANG['ERROR']) return await event.client(BlockRequest(event.chat_id)) await event.client(ReportSpamRequest(peer=event.chat_id)) if BOTLOG: name = await event.client.get_entity(event.chat_id) name0 = str(name.first_name) await event.client.send_message( BOTLOG_CHATID, "[" + name0 + "](tg://user?id=" + str(event.chat_id) + ")" + LANG['BOTLOG_BLOCKED'], )