make grow command response in only one line

This commit is contained in:
Santiago Forero 2021-09-16 12:37:40 -05:00
parent f97cb67f4a
commit dd95984723
1 changed files with 2 additions and 9 deletions

View File

@ -4,23 +4,16 @@ module.exports = {
name: 'grow',
description: 'Grow your cactus.',
execute(event, args, bot) {
let grow_rate = Math.random() * (db.get(event.nick + '_score') / 10)
grow_rate = parseFloat(grow_rate.toFixed(3))
if(grow_rate == 0) {
grow_rate = 0.1
}
if(db.get(event.nick + '_score') == null) {
db.set(event.nick + '_score', 1.000)
}
db.set(event.nick + '_score', parseFloat(db.get(event.nick + '_score') + parseFloat(grow_rate.toFixed(3))))
bot.say(event.target, "You grew " + grow_rate + " cm")
bot.say(event.target, "You are now " + db.get(event.nick + '_score').toFixed(3) + " cm")
bot.say(event.target, event.nick + ": You grew " + grow_rate + " cm, you are now " + db.get(event.nick + '_score').toFixed(3) + " cm.")
},
};