daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Jun 23rd, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require("discord.js");
  2. const mysql = require("mysql");
  3. const settings = require("./../../Constants/settings.json");
  4. const staff = require("./../../Constants/staff.json")
  5.  
  6. const NumberFormat = new Intl.NumberFormat('en-IN', { maximumSignificantDigits: 3 })
  7.  
  8.   function formatBal(bal){
  9.     return bal.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,')
  10.   }
  11.  
  12.   function format(number){
  13.     return number.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",")
  14.   }
  15.  
  16. exports.run = (client, message, args) => {
  17.  
  18.   const database = require("./../../ExportScripts/database.js");
  19.   database.getConnection(function(err, connection) {
  20.  
  21.     let target = message.mentions.users.first() || message.author;
  22.  
  23.     connection.query(`SELECT * FROM users WHERE id = '${target.id}'`, (err,rows) => {
  24.       if(err) throw(err);
  25.  
  26.       if (!rows[0]) return message.reply('This user does not have any xp!');
  27.  
  28.       let xp = parseInt(rows[0].xp);
  29.       let level = parseInt(rows[0].level);
  30.       let bal = parseFloat(rows[0].bal);
  31.       let bank = parseFloat(rows[0].bank)
  32.       let rep = parseInt(rows[0].rep);
  33.       let health = parseInt(rows[0].health);
  34.       let rank = parseInt(rows[0].rank);
  35.  
  36.       if (isNaN(rep)){
  37.         rep = 0;
  38.       }
  39.       if (isNaN(rank)){
  40.         rank = 0;
  41.       }
  42.   //Lead Dev
  43.       if (target.id === settings.AuthorID){
  44.       var embed = new Discord.RichEmbed()
  45.       .setColor(0xfaff00)
  46.       .setAuthor(target.username + `      [REM LEAD DEV]`, target.avatarURL)
  47.       .setImage(target.avatarURL)
  48.       .addField("Cash", `$${formatBal(bal)}`,true)
  49.       .addField(`Bank`, `$${formatBal(bank)}`,true)
  50.       .addField("Level", level,true)
  51.       .addField("Total XP", NumberFormat.format(xp),true)
  52.       .addField("Total Rep", NumberFormat.format(rep),true)
  53.       .addField("Health", health,true)
  54.       .setTimestamp()
  55.       message.channel.send(embed)  
  56.   //Interns
  57.     }else if (target.id === staff.Squid || target.id === staff.Airayami){
  58.       var embed = new Discord.RichEmbed()
  59.       .setColor(0xfaff00)
  60.       .setAuthor(target.username + `      [REM INTERN]`, target.avatarURL)
  61.       .setImage(target.avatarURL)
  62.       .addField("Cash", `$${formatBal(bal)}`,true)
  63.       .addField(`Bank`, `$${formatBal(bank)}`, true )
  64.       .addField("Level", level,true)
  65.       .addField("Total XP", NumberFormat.format(xp),true)
  66.       .addField("Total Rep", NumberFormat.format(rep),true)
  67.       .addField("Health", health,true)
  68.       .setTimestamp()
  69.       message.channel.send(embed)
  70.   //Moderators
  71.       }else if (target.id === staff.Lethal || target.id === staff.Jay || target.id === staff.Analyst || target.id === staff.BerChin){
  72.         var embed = new Discord.RichEmbed()
  73.         .setColor(0xfaff00)
  74.         .setAuthor(target.username + `      [REM MODERATOR]`, target.avatarURL)
  75.         .setImage(target.avatarURL)
  76.         .addField("Cash", `$${formatBal(bal)}`,true)
  77.         .addField(`Bank`, `$${formatBal(bank)}`, true )
  78.         .addField("Level", level,true)
  79.         .addField("Total XP", NumberFormat.format(xp),true)
  80.         .addField("Total Rep", NumberFormat.format(rep),true)
  81.         .addField("Health", health,true)
  82.         .setTimestamp()
  83.         message.channel.send(embed)
  84.   //Admins    
  85.       }else if (target.id === staff.Illuvium || target.id === staff.Simple || target.id === staff.Dark){
  86.         var embed = new Discord.RichEmbed()
  87.         .setColor(0xfaff00)
  88.         .setAuthor(target.username + `      [REM ADMIN]`, target.avatarURL)
  89.         .setImage(target.avatarURL)
  90.         .addField("Cash", `$${formatBal(bal)}`,true)
  91.         .addField(`Bank`, `$${formatBal(bank)}`, true )
  92.         .addField("Level", level,true)
  93.         .addField("Total XP", NumberFormat.format(xp),true)
  94.         .addField("Total Rep", NumberFormat.format(rep),true)
  95.         .addField("Health", health,true)
  96.         .setTimestamp()
  97.         message.channel.send(embed)
  98.   //Developers
  99.       }else if (target.id === staff.Lee){
  100.         var embed = new Discord.RichEmbed()
  101.         .setColor(0xfaff00)
  102.         .setAuthor(target.username + `      [REM DEVELOPER]`, target.avatarURL)
  103.         .setImage(target.avatarURL)
  104.         .addField("Cash", `$${formatBal(bal)}`,true)
  105.         .addField(`Bank`, `$${formatBal(bank)}`, true )
  106.         .addField("Level", level,true)
  107.         .addField("Total XP", NumberFormat.format(xp),true)
  108.         .addField("Total Rep", NumberFormat.format(rep),true)
  109.         .addField("Health", health,true)
  110.         .setTimestamp()
  111.         message.channel.send(embed)
  112.       }else if (rank === 4){
  113.         var embed = new Discord.RichEmbed()
  114.         .setColor(0xfa3005)
  115.         .setAuthor(target.username + `      [DEITY SUPPORTER]`, target.avatarURL)
  116.         .setImage(target.avatarURL)
  117.         .addField("Cash", `$${formatBal(bal)}`,true)
  118.         .addField(`Bank`, `$${formatBal(bank)}`, true )
  119.         .addField("Level", level,true)
  120.         .addField("Total XP", NumberFormat.format(xp),true)
  121.         .addField("Total Rep", NumberFormat.format(rep),true)
  122.         .addField("Health", health,true)
  123.         .setTimestamp()
  124.         message.channel.send(embed)
  125.       }else if (rank === 3){
  126.         var embed = new Discord.RichEmbed()
  127.         .setColor(0xa904f7)
  128.         .setAuthor(target.username + `      [ULTIMATE SUPPORTER]`, target.avatarURL)
  129.         .setImage(target.avatarURL)
  130.         .addField("Cash", `$${formatBal(bal)}`,true)
  131.         .addField(`Bank`, `$${formatBal(bank)}`, true )
  132.         .addField("Level", level,true)
  133.         .addField("Total XP", NumberFormat.format(xp),true)
  134.         .addField("Total Rep", NumberFormat.format(rep),true)
  135.         .addField("Health", health,true)
  136.         .setTimestamp()
  137.         message.channel.send(embed)
  138.       }else if (rank === 2){
  139.         var embed = new Discord.RichEmbed()
  140.         .setColor(0xdd00ff)
  141.         .setAuthor(target.username + `      [LEGENDARY SUPPORTER]`, target.avatarURL)
  142.         .setImage(target.avatarURL)
  143.         .addField("Cash", `$${formatBal(bal)}`,true)
  144.         .addField(`Bank`, `$${formatBal(bank)}`, true )
  145.         .addField("Level", level,true)
  146.         .addField("Total XP", NumberFormat.format(xp),true)
  147.         .addField("Total Rep", NumberFormat.format(rep),true)
  148.         .addField("Health", health,true)
  149.         .setTimestamp()
  150.         message.channel.send(embed)
  151.       }else if (rank === 1){
  152.         var embed = new Discord.RichEmbed()
  153.         .setColor(0x00bcf5)
  154.         .setAuthor(target.username + `      [SUPPORTER]`, target.avatarURL)
  155.         .setImage(target.avatarURL)
  156.         .addField("Cash", `$${formatBal(bal)}`,true)
  157.         .addField(`Bank`, `$${formatBal(bank)}`, true )
  158.         .addField("Level", level,true)
  159.         .addField("Total XP", NumberFormat.format(xp),true)
  160.         .addField("Total Rep", NumberFormat.format(rep),true)
  161.         .addField("Health", health,true)
  162.         .setTimestamp()
  163.         message.channel.send(embed)
  164.       }else{
  165.         var embed = new Discord.RichEmbed()
  166.         .setColor(0xfaff00)
  167.         .setAuthor(target.username, target.avatarURL)
  168.         .setImage(target.avatarURL)
  169.         .addField("Cash", `$${formatBal(bal)}`,true)
  170.         .addField(`Bank`, `$${formatBal(bank)}`, true )
  171.         .addField("Level", level,true)
  172.         .addField("Total XP", NumberFormat.format(xp),true)
  173.         .addField("Total Rep", NumberFormat.format(rep),true)
  174.         .addField("Health", health,true)
  175.         .setTimestamp()
  176.       }
  177.     })
  178. })
  179. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Pastebin PRO 'SUMMER SPECIAL'!
Get 60% OFF Pastebin PRO accounts!
 
Top