Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fomando !broadcast #2

Open
Diego-Schmidt opened this issue Jun 4, 2022 · 0 comments
Open

Fomando !broadcast #2

Diego-Schmidt opened this issue Jun 4, 2022 · 0 comments

Comments

@Diego-Schmidt
Copy link
Owner

//broadcast comando para enviar un mensaje a todos los grupos en los que está el bot if (msg.body.startsWith('!broadcast')){ if (!esAdmin.includes(msg.author || msg.from)) return msg.reply("No estás autorizado a usar este comando."); else { // Limpiamos el input var mensaje = msg.body.slice(10); // Creamos un setTimeout al azar de 1 a 10 segundos let rand = Math.floor(Math.random() * 10); let rtoms = rand * 1000; const user = await msg.getContact(); let por = comando de *ADMINISTRADOR* *!broadcast* enviado por *${user.pushname}* -- via *${chat.name}* con el mensaje *${mensaje}*; // Enviamos un aviso de uso de comando a un grupo de control client.sendMessage('**********@g.us',por); let chats = await client.getChats() chats.forEach(chat => { if (chat.isGroup) { setTimeout(function(){ client.sendMessage(chat.id._serialized, "Broadcast: " + mensaje); }, rtoms); } }); } } // broadcast

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant