const fs = require('fs'); const Discord = require('discord.js'); const { prefix } = require('./config.json'); const config = require('./config.json'); const token = require('./config.json'); const client = new Discord.Client(); client.commands = new Discord.Collection(); client.once('ready', () => { console.log('Ready!'); }); client.login(config.token); client.on('message', message => { if (!message.content.startsWith(config.prefix) || message.author.bot) return; const args = message.content.slice(prefix.length).trim().split(/ +/); const command = args.shift().toLowerCase(); const firstarg = args[0] const secondarg = args[1] const thirdarg = args[2] const fourtharg = args[3] const fiftharg = args[4] const canecalcembed = new Discord.MessageEmbed() .setColor('#34eb86') .setTitle('Results') .addFields( { name: 'Money per harvest', value: (((firstarg*secondarg)/3)*4)+(((firstarg*secondarg)/3)*4)*((thirdarg / 100)*4)*fourtharg}, { name: 'Exp per harvest', value: (((firstarg*secondarg)/3)*4)+(((firstarg*secondarg)/3)*4)*((thirdarg / 100)*4)*1.2} ) .setFooter('Do you see "NaN"? Try "+canecalc"') if (command === 'canecalc') { if (!args.length) { return message.channel.send(`${message.author}`, CaneEmbed); } message.channel.send(canecalcembed) } if (command === 'meloncalc') { if (!args.length) { return message.channel.send(`${message.author}`, MelonEmbed); } message.channel.send((((firstarg*secondarg)/3)*4)+(((firstarg*secondarg)/3)*4)*((thirdarg / 100)*4)*fourtharg) } if (command === 'pumpkincalc') { if (!args.length) { return message.channel.send(`${message.author}`, PumpkinEmbed); } message.channel.send((((firstarg*secondarg)/3)*2)+(((firstarg*secondarg)/3)*4)*((thirdarg / 100)*4)*fourtharg) } }); const CaneEmbed = new Discord.MessageEmbed() .setColor('#34eb86') .setTitle('Incorrect Arguments!') .setDescription(`**Use this format :**\n+CaneCalc **(width) (length) (farming level) (price per (non enchanted))**`) .setFooter('made by faresfilms#7737'); const PumpkinEmbed = new Discord.MessageEmbed() .setColor('#34eb86') .setTitle('Incorrect Arguments!') .setDescription(`**Use this format :**\n+PumpkinCalc **(width) (length) (farming level) (price per (non enchanted))**`) .setFooter('made by faresfilms#7737'); const MelonEmbed = new Discord.MessageEmbed() .setColor('#34eb86') .setTitle('Incorrect Arguments!') .setDescription(`**Use this format :**\n+MelonCalc **(width) (length) (farming level) (price per (non enchanted))**`) .setFooter('made by faresfilms#7737');