Add privacy setting and use new parser
This commit is contained in:
parent
d783da4b83
commit
39b9a5191e
@ -6,13 +6,21 @@ module.exports = {
|
|||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName('watertime')
|
.setName('watertime')
|
||||||
.setDescription('Calculate the watering time for a given tree height')
|
.setDescription('Calculate the watering time for a given tree height')
|
||||||
.addStringOption(o =>
|
.addIntegerOption(o =>
|
||||||
o.setName('height')
|
o.setName('height')
|
||||||
.setDescription('Tree height in feet, numbers ONLY')
|
.setDescription('Tree height')
|
||||||
.setRequired(true)),
|
.setRequired(true))
|
||||||
|
.addBooleanOption(o =>
|
||||||
|
o.setName('private')
|
||||||
|
.setDescription('Should the response be private? Default: true')
|
||||||
|
.setRequired(false)),
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply();
|
const treeHeight = interaction.options.getInteger('height');
|
||||||
const treeHeight = interaction.options.getString('height');
|
const privateOpt = interaction.options.getBoolean('private');
|
||||||
await interaction.editReply(`A tree that is ${treeHeight}ft tall will have a watering time of ${fn.getWaterTime(treeHeight)} minutes.`);
|
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}.`);
|
||||||
},
|
},
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user