Answer the question
In order to leave comments, you need to log in
How to make the VK bot forward the message?
It is necessary to make the bot forward messages (well, that is, answer the last message) in the dialogue! not in conversation
Answer the question
In order to leave comments, you need to log in
In 1 case arrow functions are used. They do not have their own this, inheriting from the parent. For example:
// Пусть this - [object MyObject]
function log() {
console.log(this);
};
var obj = new MyObject2();
obj.on("ready", () => log()); // [object MyObject];
// Пусть this - [object MyObject]
function log() {
console.log(this);
};
var obj = new MyObject2();
obj.on("ready", log); // [object MyObject2];
Everything is very simple, you just need to read about classes. They have properties and functions. So when we use this, we indicate that we want to access a property or method of an instance of this class. Try to look at your code in more detail. If you go upstairs, you will see that the msg property is declared at the top, or declared in the parent class from which your class inherits.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question