From a367c16609edb108b1205379b854a6a54d89be52 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Mon, 23 Jan 2023 01:38:56 -0500 Subject: [PATCH] Add water time calculation --- slash-commands/watertime.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 slash-commands/watertime.js diff --git a/slash-commands/watertime.js b/slash-commands/watertime.js new file mode 100644 index 0000000..a65df11 --- /dev/null +++ b/slash-commands/watertime.js @@ -0,0 +1,18 @@ +const { SlashCommandBuilder } = require('discord.js'); +const { tree } = require('../modules/functions.js'); +const fn = require('../modules/functions.js'); + +module.exports = { + data: new SlashCommandBuilder() + .setName('watertime') + .setDescription('Calculate the watering time for a given tree height') + .addStringOption(o => + o.setName('height') + .setDescription('Tree height in feet, numbers ONLY') + .setRequired(true)), + execute(interaction) { + const treeHeight = interaction.options.getString('height'); + const waterTime = Math.floor(Math.floor(Math.pow(treeHeight * 0.07 + 5, 1.1)) / 60); + interaction.reply(`A tree that is ${treeHeight}ft tall will have a watering time of ${waterTime} minutes.`); + }, +}; \ No newline at end of file