_antitrabas.js 2.3 KB

123456789101112131415161718192021222324252627282930
  1. //By @NeKosmic || https://github.com/NeKosmic/ //
  2. import * as fs from 'fs'
  3. export async function before(m, { conn, isAdmin, isBotAdmin, usedPrefix }) {
  4. if (m.isBaileys && m.fromMe) return !0
  5. if (!m.isGroup) return !1
  6. m.isBot = m.id.startsWith('BAE5') && m.id.length === 16 || m.id.startsWith('3EB0') && m.id.length === 12 || m.id.startsWith('3EB0') && (m.id.length === 20 || m.id.length === 22) || m.id.startsWith('B24E') && m.id.length === 20;
  7. if (m.isBot) return
  8. let chat = global.db.data.chats[m.chat]
  9. let bot = global.db.data.settings[this.user.jid] || {}
  10. let delet = m.key.participant
  11. let bang = m.key.id
  12. let name = await conn.getName(m.sender)
  13. let fakemek = {key: {participant: "[email protected]","remoteJid": "[email protected]"},"message": {"groupInviteMessage": {"groupJid": "[email protected]","inviteCode": "m","groupName": "P", "caption": '𝙺𝚊𝚗𝚝𝚞 - 𝙱𝚘𝚝', 'jpegThumbnail': null}}}
  14. if (chat.antiTraba && m.text.length > 5000) { //Cantidad máxima de caracteres aceptados en un mensaje//
  15. if (isAdmin) return conn.sendMessage(m.chat, { text: `⚠️El administrador @${m.sender.split("@")[0]} acaba de enviar un texto que contiene muchos caracteres -.-!`, mentions: [m.sender] }, { quoted: fakemek })
  16. conn.sendButton(m.chat, `*[ ! ] Se detecto un mensaje que contiene muchos caracteres [ ! ]*\n`, `${isBotAdmin ? '' : 'No soy administrador, no puedo hacer nada :/'}`, null, [['ᴅᴇsᴀᴄᴛɪᴠᴀ ᴀɴᴛɪᴛʀᴀʙᴀ', `/disable antitraba`]], null, null, m)
  17. //await conn.sendButton(m.chat, `*[ ! ] Se detecto un mensaje que contiene muchos caracteres [ ! ]*\n`, `${isBotAdmin ? '' : 'No soy administrador, no puedo hacer nada :/'}`, author, ['[ ]', usedPrefix+'apagar antitraba'], fakemek )
  18. if (isBotAdmin) {
  19. conn.sendMessage(m.chat, { delete: { remoteJid: m.chat, fromMe: false, id: bang, participant: delet }})
  20. setTimeout(() => {
  21. conn.sendMessage(m.chat, { text: `Marcar el chat como leido ✓\n${"\n".repeat(400)}\n• El número : wa.me/${m.sender.split("@")[0]}\n• Alias : ${name}\n‼️Acaba de enviar un texto que contiene muchos caracteres que puede ocasionar fallos en los dispositivos`, mentions: [m.sender] }, { quoted: fakemek })
  22. }, 0)
  23. setTimeout(() => {
  24. conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove')
  25. }, 1000)} else if (!bot.restrict) return m.reply(`Este comando esta desactivado por mi jefe`)
  26. }
  27. return !0
  28. }