owner-broadcastchats.js 1.3 KB

1234567891011121314151617
  1. import fs from 'fs';
  2. const handler = async (m, {conn, text} ) => {
  3. const chats = Object.entries(conn.chats).filter(([jid, chat]) => !jid.endsWith('@g.us') && chat.isChats).map((v) => v[0]);
  4. if (!text) throw '*⚠️ 𝐈𝐧𝐠𝐫𝐞𝐬𝐞 𝐞𝐥 𝐦𝐞𝐧𝐬𝐚𝐣𝐞 𝐪𝐮𝐞 𝐪𝐮𝐢𝐞𝐫𝐞 𝐭𝐫𝐚𝐦𝐢𝐭𝐞*'
  5. const cc = text ? m : m.quoted ? await m.getQuotedObj() : false || m;
  6. const teks = text ? text : cc.text;
  7. for (const i of chats) {
  8. await delay(500);
  9. conn.sendMessage(i, { text: `✅ *COMUNICADO OFICIAL* ✅\n\n` + teks, mentions: [m.sender], mentions: (await conn.groupMetadata(id)).participants.map(v => v.id) }, { quoted: fkontak })}
  10. m.reply(`*✅ ᴍᴇɴsᴀɴᴇ ᴇɴᴠɪᴀᴅᴏ ᴀ ${chats.length} ᴄʜᴀᴛs ᴘʀɪᴠᴀᴅᴏs*\n\n*𝐍𝐎𝐓𝐀: ᴇs ᴘᴏsɪʙʟᴇ ǫᴜᴇ ᴛᴇɴɢᴀ ғᴀʟʟᴏs ᴇsᴛᴇ ᴄᴏᴍᴀɴᴅᴏ ʏ ɴᴏ sᴇ ᴇɴᴠɪᴇ ᴀ ᴛᴏᴅᴏs ʟᴏs ᴄʜᴀᴛs, ᴅɪsᴄᴜʟᴘᴇɴ ᴘᴏʀ ᴇʟ ᴍᴏᴍᴇɴᴛᴏ*`)};
  11. handler.help = ['broadcastchats', 'bcchats'].map((v) => v + ' <teks>');
  12. handler.tags = ['owner'];
  13. handler.command = /^(broadcastchats?|bcc(hats?)?)$/i;
  14. handler.rowner = true;
  15. export default handler;
  16. const delay = (time) => new Promise((res) => setTimeout(res, time));