SHARE
TWEET

Untitled

a guest Aug 22nd, 2019 60 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. client.commands = new Discord.Collection();
  4. const fs = require('fs');
  5. const coins = require('./coins.json')
  6. fs.readdir('./Commandes/', (error, f) => {
  7.     if (error) { return console.error(error); }
  8.         let commandes = f.filter(f => f.split('.').pop() === 'js');
  9.         if (commandes.length <= 0) { return console.log('Aucune commande trouvée !'); }
  10.  
  11.         commandes.forEach((f) => {
  12.             let commande = require(`./Commandes/${f}`);
  13.             console.log(`${f} commande chargée !`);
  14.             client.commands.set(commande.help.name, commande);
  15.         });
  16. });
  17.  
  18. //Systeme de monnaie
  19.  
  20. if(!coins[message.author.id]){
  21.     coins[message.author.id] = {
  22.       coins: 0
  23.     };
  24.   }
  25.  
  26.   let coinAmt = Math.floor(Math.random() * 15) + 1;
  27.   let baseAmt = Math.floor(Math.random() * 15) + 1;
  28.   console.log(`${coinAmt} ; ${baseAmt}`);
  29.  
  30.   if(coinAmt === baseAmt){
  31.     coins[message.author.id] = {
  32.       coins: coins[message.author.id].coins + coinAmt
  33.     };
  34.   fs.writeFile("./coins.json", JSON.stringify(coins), (err) => {
  35.     if (err) console.log(err)
  36.   });
  37.   let coinEmbed = new Discord.RichEmbed()
  38.   .setAuthor(message.author.username)
  39.   .setColor("#0000FF")
  40.   .addField("💸", `${coinAmt} coins added!`);
  41.  
  42.   message.channel.send(coinEmbed).then(msg => {msg.delete(5000)});
  43.   };
  44.  
  45. fs.readdir('./Events/', (error, f) => {
  46.     if (error) { return console.error(error); }
  47.         console.log(`${f.length} events chargés`);
  48.  
  49.         f.forEach((f) => {
  50.             let events = require(`./Events/${f}`);
  51.             let event = f.split('.')[0];
  52.             client.on(event, events.bind(null, client));
  53.         });
  54. });
  55.  
  56. client.login('');
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