Advertisement
Ykia

Untitled

May 22nd, 2020
1,515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js')
  2. const fs = require('fs')
  3. const Math = require('mathjs')
  4.  
  5. function Random_min_max(min, max) {
  6.   min = Math.ceil(min);
  7.   max = Math.floor(max);
  8.   return Math.floor(Math.random() * (max - min +1)) + min;
  9. }
  10.  
  11. module.exports.run = async(client, message, args) => {
  12.     i=0;
  13.     var heroList = JSON.parse( fs.readFileSync( "./data-base/hero.json" ) );
  14.     x = Random_min_max(0,100);
  15.     console.log(x)
  16.     if (args[0] === "standard" || "s"){
  17.       if (x < 70){
  18.         for (i in heroList){
  19.           console.log(heroList[i].stars)
  20.           if (heroList[i].stars === 1){
  21.             let heroEmbed = new Discord.RichEmbed()
  22.               .setTitle(`**Noms :** ${heroList[i].name} | ${heroList[i].stars} ☆`)
  23.               .setDescription(`**Pouvoir/Arme :**`,`${heroList[i].power}`)
  24.               .addField(`**:heart: HP**`,`${heroList[i].HP}`)
  25.               .addField(`**:man_running: DEF**`,`${heroList[i].DEF}`)
  26.               .addField(`**:crossed_swords: ATK**`,`${heroList[i].ATK}`,)
  27.               .setImage(heroList[i].img)
  28.               .setColor("00BCE1")
  29.               .setTimestamp()
  30.             message.channel.sendEmbed(heroEmbed)
  31.           }
  32.         }
  33.       }else{
  34.          if (x < 95 && x > 70){
  35.            for (i in heroList) {
  36.             if (heroList[i].stars === 2) {
  37.               let heroEmbed = new Discord.RichEmbed()
  38.                 .setTitle(`**Noms :** ${heroList[i].name} | ${heroList[i].stars} ☆`)
  39.                 .setDescription(`**Pouvoir/Arme :**`,`${heroList[i].power}`)
  40.                 .addField(`**:heart: HP**`,`${heroList[i].HP}`)
  41.                 .addField(`**:man_running: DEF**`,`${heroList[i].DEF}`)
  42.                 .addField(`**:crossed_swords: ATK**`,`${heroList[i].ATK}`,)
  43.                 .setImage(heroList[i].img)
  44.                 .setColor("00BCE1")
  45.                 .setTimestamp()
  46.               message.channel.sendEmbed(heroEmbed)
  47.             }
  48.           }
  49.         }else{
  50.         for (i in heroList) {
  51.           if (heroList[i].stars === 3) {
  52.             let heroEmbed = new Discord.RichEmbed()
  53.               .setTitle(`**Noms :** ${heroList[i].name} | ${heroList[i].stars} ☆`)
  54.               .setDescription(`**Pouvoir/Arme :**`,`${heroList[i].power}`)
  55.               .addField(`**:heart: HP**`,`${heroList[i].HP}`)
  56.               .addField(`**:man_running: DEF**`,`${heroList[i].DEF}`)
  57.               .addField(`**:crossed_swords: ATK**`,`${heroList[i].ATK}`,)
  58.               .setImage(heroList[i].img)
  59.               .setColor("00BCE1")
  60.               .setTimestamp()
  61.             message.channel.sendEmbed(heroEmbed)
  62.           }
  63.         }
  64.       }
  65.     }
  66.   }
  67. };
  68.  
  69. module.exports.help = {
  70.     name : "summon"
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement