Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js')
- const fs = require('fs')
- const Math = require('mathjs')
- function Random_min_max(min, max) {
- min = Math.ceil(min);
- max = Math.floor(max);
- return Math.floor(Math.random() * (max - min +1)) + min;
- }
- module.exports.run = async(client, message, args) => {
- i=0;
- var heroList = JSON.parse( fs.readFileSync( "./data-base/hero.json" ) );
- x = Random_min_max(0,100);
- console.log(x)
- if (args[0] === "standard" || "s"){
- if (x < 70){
- for (i in heroList){
- console.log(heroList[i].stars)
- if (heroList[i].stars === 1){
- let heroEmbed = new Discord.RichEmbed()
- .setTitle(`**Noms :** ${heroList[i].name} | ${heroList[i].stars} ☆`)
- .setDescription(`**Pouvoir/Arme :**`,`${heroList[i].power}`)
- .addField(`**:heart: HP**`,`${heroList[i].HP}`)
- .addField(`**:man_running: DEF**`,`${heroList[i].DEF}`)
- .addField(`**:crossed_swords: ATK**`,`${heroList[i].ATK}`,)
- .setImage(heroList[i].img)
- .setColor("00BCE1")
- .setTimestamp()
- message.channel.sendEmbed(heroEmbed)
- }
- }
- }else{
- if (x < 95 && x > 70){
- for (i in heroList) {
- if (heroList[i].stars === 2) {
- let heroEmbed = new Discord.RichEmbed()
- .setTitle(`**Noms :** ${heroList[i].name} | ${heroList[i].stars} ☆`)
- .setDescription(`**Pouvoir/Arme :**`,`${heroList[i].power}`)
- .addField(`**:heart: HP**`,`${heroList[i].HP}`)
- .addField(`**:man_running: DEF**`,`${heroList[i].DEF}`)
- .addField(`**:crossed_swords: ATK**`,`${heroList[i].ATK}`,)
- .setImage(heroList[i].img)
- .setColor("00BCE1")
- .setTimestamp()
- message.channel.sendEmbed(heroEmbed)
- }
- }
- }else{
- for (i in heroList) {
- if (heroList[i].stars === 3) {
- let heroEmbed = new Discord.RichEmbed()
- .setTitle(`**Noms :** ${heroList[i].name} | ${heroList[i].stars} ☆`)
- .setDescription(`**Pouvoir/Arme :**`,`${heroList[i].power}`)
- .addField(`**:heart: HP**`,`${heroList[i].HP}`)
- .addField(`**:man_running: DEF**`,`${heroList[i].DEF}`)
- .addField(`**:crossed_swords: ATK**`,`${heroList[i].ATK}`,)
- .setImage(heroList[i].img)
- .setColor("00BCE1")
- .setTimestamp()
- message.channel.sendEmbed(heroEmbed)
- }
- }
- }
- }
- }
- };
- module.exports.help = {
- name : "summon"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement