Answer the question
In order to leave comments, you need to log in
Is it ok to extend a standard object?
I am writing a telegram bot. I have an app object whose methods allow us to receive information from the user and send it. The code looks like this:
app.on('message', msg => {
const text = msg.text;
switch(text) {
case '/add':
add(redis, mongo, message, app, users);
break:
case '/remove':
add(redis, mongo, message, app, users);
break:
}
})
app.redis = redis;
app.mongo = mongo;
app.add = (){...};
Answer the question
In order to leave comments, you need to log in
If not, what is the best way to do it?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question