Facebook
From faresfilms, 3 Years ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 66
  1. const fs = require('fs');
  2. const Discord = require('discord.js');
  3. const { prefix } = require('./config.json');
  4. const config = require('./config.json');
  5. const token = require('./config.json');
  6.  
  7.  
  8. const client = new Discord.Client();
  9. client.commands = new Discord.Collection();
  10.  
  11.  
  12.  
  13.  
  14. client.once('ready', () => {
  15.         console.log('Ready!');
  16. });
  17.  
  18. client.login(config.token);
  19.  
  20. client.on('message', message => {
  21.         if (!message.content.startsWith(config.prefix) || message.author.bot) return;
  22.  
  23.     const args = message.content.slice(prefix.length).trim().split(/ +/);
  24.    
  25.     const command = args.shift().toLowerCase();
  26.  
  27.     const firstarg = args[0]
  28.     const secondarg = args[1]
  29.     const thirdarg = args[2]
  30.     const fourtharg = args[3]
  31.     const fiftharg = args[4]
  32.  
  33.     const canecalcembed = new Discord.MessageEmbed()
  34.     .setColor('#34eb86')
  35.     .setTitle('Results')
  36.     .addFields(
  37.                 { name: 'Money per harvest', value: (((firstarg*secondarg)/3)*4)+(((firstarg*secondarg)/3)*4)*((thirdarg / 100)*4)*fourtharg},
  38.         { name: 'Exp per harvest', value: (((firstarg*secondarg)/3)*4)+(((firstarg*secondarg)/3)*4)*((thirdarg / 100)*4)*1.2}
  39.     )
  40.     .setFooter('Do you see "NaN"? Try "+canecalc"')
  41.  
  42.  
  43.  
  44.     if (command === 'canecalc') {
  45.         if (!args.length) {
  46.             return message.channel.send(`${message.author}`, CaneEmbed);
  47.         }
  48.      
  49.         message.channel.send(canecalcembed)
  50.  
  51.     }
  52.  
  53.     if (command === 'meloncalc') {
  54.         if (!args.length) {
  55.             return message.channel.send(`${message.author}`, MelonEmbed);
  56.         }
  57.    
  58.         message.channel.send((((firstarg*secondarg)/3)*4)+(((firstarg*secondarg)/3)*4)*((thirdarg / 100)*4)*fourtharg)
  59.  
  60.     }
  61.  
  62.  
  63.     if (command === 'pumpkincalc') {
  64.         if (!args.length) {
  65.             return message.channel.send(`${message.author}`, PumpkinEmbed);
  66.         }
  67.    
  68.         message.channel.send((((firstarg*secondarg)/3)*2)+(((firstarg*secondarg)/3)*4)*((thirdarg / 100)*4)*fourtharg)
  69.  
  70.     }
  71.  
  72.  
  73.  
  74.    
  75. });
  76.  
  77. const CaneEmbed = new Discord.MessageEmbed()
  78. .setColor('#34eb86')
  79. .setTitle('Incorrect Arguments!')
  80. .setDescription(`**Use this format :**\n+CaneCalc **(width) (length) (farming level) (price per (non enchanted))**`)
  81. .setFooter('made by faresfilms#7737');
  82.  
  83.  
  84. const PumpkinEmbed = new Discord.MessageEmbed()
  85. .setColor('#34eb86')
  86. .setTitle('Incorrect Arguments!')
  87. .setDescription(`**Use this format :**\n+PumpkinCalc **(width) (length) (farming level) (price per (non enchanted))**`)
  88. .setFooter('made by faresfilms#7737');
  89.  
  90.  
  91. const MelonEmbed = new Discord.MessageEmbed()
  92. .setColor('#34eb86')
  93. .setTitle('Incorrect Arguments!')
  94. .setDescription(`**Use this format :**\n+MelonCalc **(width) (length) (farming level) (price per (non enchanted))**`)
  95. .setFooter('made by faresfilms#7737');