SHARE
TWEET

eco.js

a guest May 22nd, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js');
  2. const client = new Discord.Client();
  3. const fs = require ('fs');
  4. const moment = require ('moment');
  5. let userData = JSON.parse(fs.readFileSync('Storage/userData.json', 'utf8'));
  6.  
  7. client.on('ready', () => {
  8.   console.log(`Connexion sur ${client.user.tag} en cours..\nConnecté.`);
  9.   client.user.setActivity(`SatUrneMal - Développement..`);
  10. });
  11.  
  12. var prefix = ('/');
  13.  
  14. client.on('message', msg => {
  15. let sender = msg.author;
  16. let cont = msg.content.slice(prefix.length).split(" ");
  17. let args = cont.slice(1);
  18.  
  19.  
  20. if (!userData[sender.id + msg.guild.id]) userData[sender.id + msg.guild.id] = {}
  21. if (!userData[sender.id + msg.guild.id].money) userData[sender.id + msg.guild.id].money = 0;
  22. if (!userData[sender.id + msg.guild.id].lastDaily) userData[sender.id + msg.guild.id].lastDaily = 'Not Collected';
  23. fs.writeFile('Storage/userData.json', JSON.stringify(userData), (err) => {
  24. if (err) console.error(err);
  25. })
  26.  
  27. if(msg.content === prefix + "banque") {
  28.   const banque = new Discord.RichEmbed()
  29.   .addField(":credit_card: Compte banquaire de :", msg.author)
  30.   .addField("** **", "** **")
  31.   .addField("<:coin:579404606002692155> Argent sur le compte :", userData[sender.id + msg.guild.id].money + "$")
  32.   msg.channel.send(banque)
  33. }
  34.  
  35. if (msg.content === prefix + 'daily') {
  36.   if (userData[sender.id + msg.guild.id].lastDaily != moment().format('L')) {
  37.     userData[sender.id + msg.guild.id].lastDaily = moment().format('L')
  38.     userData[sender.id + msg.guild.id].money += 500
  39.  
  40.     const daily = new Discord.RichEmbed()
  41.     .addField(":credit_card: Compte banquaire de :", msg.author)
  42.     .addField("** **", "** **")
  43.     .addField("<:coin:579404606002692155> Crédité de :", "500$")
  44.     .addField("** **", "** **")
  45.     .addField("Vous avez collécté votre récompense quotidienne.", "** **")
  46.     msg.channel.send(daily)
  47.   }
  48. }
  49.  
  50. if (msg.content === prefix + 'daily') {
  51.   if (userData[sender.id + msg.guild.id].lastDaily = moment().format('L')) {
  52.     userData[sender.id + msg.guild.id].lastDaily != moment().format('L')
  53.    
  54.     const dailycollected = new Discord.RichEmbed()
  55.     .addField(":credit_card: Compte banquaire de :", msg.author)
  56.     .addField("** **", "** **")
  57.     .addField("Une erreur est survenue lors de la transaction.", "Vous avez **déjà** collécté votre récompense quotidienne.")
  58.     msg.channel.send(dailycollected)
  59.     }
  60. }
  61. });
  62. client.login('NTc3OTM0OTIyOTcxMzQ5MDM4.XNxZHw.s6lmfID4B1osx0q2VzATFP1vBJ4');
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
 
Top