5ef905449d
* Add 24h growth indicator * Fix float math * Fix some bugs * Trim decimals * Add 24 hour observed growth * Add beginning height option * Changed startup message to ping me * Add a ping reminder and setup command for it * Setup automatic water reminders * Improved workflows * New water readiness system * Documentation Time * Fix slash command link * Fix linebreaks * Readability improvements * Forgot to allow checking in prod * Switch to ephemeral reply * Restructuring and new help messages * Not meant to be uploaded * Documentation update * Changing the way reminders are deleted * Tweak timings * Adjust readiness detection system * moar tweekz * fix reminders * Updates to water reminders
29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
const { SlashCommandBuilder } = require('discord.js');
|
|
const dbfn = require('../modules/dbfn.js');
|
|
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 =>
|
|
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')
|
|
.setRequired(true)),
|
|
async execute(interaction) {
|
|
await interaction.deferReply({ ephemeral: true });
|
|
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.`);
|
|
}).catch(err => {
|
|
interaction.editReply("Error: " + err);
|
|
console.error(err);
|
|
return;
|
|
});
|
|
},
|
|
}; |