Answer the question
In order to leave comments, you need to log in
Is it okay to "simplify" the code this way?
Hello. I am writing a telegram bot. Now the code looks something like this:
bot.on('message', msg => {
someFunc(bot, redis, db, msg)
});
function someFunc(bot, redis, db, msg) {
//какие-то действия с Redis
//какие-то действия с БД
bot.sendMessage(msg.from.id, 'TExt');
}
function gen(bot) {
return send(id, text) {
bot.sendMessage(id, text)
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question