var T2W = require("numbers2words");
var translator = new T2W("EN_US");
const { wordsToNumbers } = require('words-to-numbers');
let numbr = wordsToNumbers(message.content.toLowerCase());
message.channel.send(translator.toWords(numbr + 1));
So this is in bot.on('message', async message) =>
. I’ve tried using other Node.js libraries, like words-to-numbers and numbers2words.
My idea is that, for example, somebody says “three” and the bot responds with “four”, by converting the message’s number ("three"
to 3
), adding 1
(4
), and then converting it back to a literal number ("four"
).
I’d be grateful to anybody that will answer this, I’m clueless! =)