2023-01-25 09:53:49 +00:00
|
|
|
const { SlashCommandBuilder } = require('discord.js');
|
2023-01-27 02:30:52 +00:00
|
|
|
const dbfn = require('../modules/dbfn.js');
|
2023-01-25 09:53:49 +00:00
|
|
|
const fn = require('../modules/functions.js');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
data: new SlashCommandBuilder()
|
|
|
|
.setName('timetoheight')
|
|
|
|
.setDescription('Calculate how long it would take to reach a given height')
|
|
|
|
.addStringOption(o =>
|
2023-01-27 02:30:52 +00:00
|
|
|
o.setName('beginheight')
|
|
|
|
.setDescription('Begining tree height in feet, numbers ONLY')
|
|
|
|
.setRequired(true))
|
|
|
|
.addStringOption(o =>
|
|
|
|
o.setName('endheight')
|
|
|
|
.setDescription('Ending tree height in feet, numbers ONLY')
|
2023-01-25 09:53:49 +00:00
|
|
|
.setRequired(true)),
|
|
|
|
async execute(interaction) {
|
|
|
|
await interaction.deferReply();
|
2023-01-27 02:30:52 +00:00
|
|
|
const beginHeight = interaction.options.getString('beginheight');
|
|
|
|
const endHeight = interaction.options.getString('endheight');
|
|
|
|
fn.timeToHeight(beginHeight, endHeight).then(res => {
|
|
|
|
interaction.editReply(`It will take a tree that is ${beginHeight}ft tall ${res} to reach ${endHeight}ft.`);
|
2023-01-25 09:53:49 +00:00
|
|
|
}).catch(err => {
|
|
|
|
interaction.editReply("Error: " + err);
|
|
|
|
console.error(err);
|
|
|
|
return;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
};
|