2023-01-23 06:38:56 +00:00
|
|
|
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')
|
2023-02-20 01:42:14 +00:00
|
|
|
.addIntegerOption(o =>
|
2023-01-23 06:38:56 +00:00
|
|
|
o.setName('height')
|
2023-02-20 01:42:14 +00:00
|
|
|
.setDescription('Tree height')
|
|
|
|
.setRequired(true))
|
|
|
|
.addBooleanOption(o =>
|
|
|
|
o.setName('private')
|
|
|
|
.setDescription('Should the response be private? Default: true')
|
|
|
|
.setRequired(false)),
|
2023-01-23 06:55:33 +00:00
|
|
|
async execute(interaction) {
|
2023-02-20 01:42:14 +00:00
|
|
|
const treeHeight = interaction.options.getInteger('height');
|
|
|
|
const privateOpt = interaction.options.getBoolean('private');
|
|
|
|
const private = privateOpt != undefined ? privateOpt : true;
|
|
|
|
await interaction.deferReply( {ephemeral: private });
|
|
|
|
const waterSeconds = fn.getWaterTime(treeHeight);
|
|
|
|
const waterTime = fn.parseWaterTime(waterSeconds);
|
|
|
|
await interaction.editReply(`A tree that is ${treeHeight}ft tall will have a watering time of ${waterTime}.`);
|
2023-01-23 06:38:56 +00:00
|
|
|
},
|
|
|
|
};
|