import QRCode from 'qrcode'; var message="Esperando conexion"; export default function(client,app,special){ client.on('ready', () => { message="Su cliente esta funcionado"; console.log('Client is ready!'); }); client.on('message_create',async msg=>{ if(!msg.fromMe || msg.body.toString()!=`${special.prefix}ping`) return; await msg.reply("PONG!"); }) client.on('loading_screen', (percent, message) => { console.log('LOADING SCREEN', percent, message); }); client.on('authenticated', () => { console.log('AUTHENTICATED'); }); client.on('auth_failure', msg => { console.error('AUTHENTICATION FAILURE', msg); }); client.on('DISCONNECTED', () => { console.log('Desconectado'); }); client.on('qr', qr => { console.log('Codigo Qr recibido'); QRCode.toDataURL(qr, function (err, url) { message='Escanee el codigo(Si no deja, reinicie el espacio, asegurese que el estado diga "Running")
'; }); }); client.on('remote_session_saved', () => { message="Sesion guardada(MongoDB)"; console.log("Guardado"); }); app.get('/', (req, res) => { res.writeHead(200, { 'Content-Type': 'text/html' }) res.end(''+message); }); return {name:"Sistema", comandos:[{name:"ping",description:"Consulta si esta encendido",args:[""]}]} }