File size: 1,370 Bytes
6514026
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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")<br><img src="'+url+'"></img>';
      
    });
    
     
});
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('<head><meta http-equiv="refresh" content="5"></head>'+message);
});
return {name:"Sistema",
  comandos:[{name:"ping",description:"Consulta si esta encendido",args:[""]}]}
}