File size: 1,076 Bytes
c62c5ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
export default function(client,app,special){
// client: https://docs.wwebjs.dev/Client.html
// app: https://expressjs.com/en/4x/api.html

client.on('message_create',async msg=>{
  let texto=msg.body.toString();
  //Chequear que lo.hemos enviado al mensaje y empieza con el identificador
  if(!msg.fromMe || !texto.startsWith(special.prefix)) return; 
  //Quitamos el identificador y obtenemos el comando y sus argumentos
  let args=texto.slice(special.prefix.length).split(" ");
  let comando = args.shift();
  args=args.join(" ").split("|");
  switch(comando){
    case "saludar":
      await msg.reply("Hola!");
      break;
    case "echo":
      await msg.reply(args.join("|"));
      break;
    default:
      return;
      break; //No se si este break va, pero por las dudas
  }
});
return {name:`Nombre del plugin(Será visto en ${special.prefix}help)`,
        comandos:[
          {name:"saludar",description:"Saludar, este comando no requiere argumentos"},
          {name:"echo",description:"Este comando repite todo lo escrito luego",args:["[texto]"]}
        ]}
}