Answer class
Sends many messages, reply to the messages in middlewares
Why do you need to use the Answer class?
We recommend using return when sending a message, but there are cases where this is impossible. For example, if you are using middleware, or you need to get response from the method, you need to use Answer class
Get Answer class and use it
If you want to get the Answer class in the middleware, get it as the 2nd argument. But if you're in a handler, you can get the Answer class using the @GetAnswer
parameter decorator
More info about the Answer class
The Answer class is asynchronous. You can pass the MessageSend class as content to the Answer class too. If you're using the Answer class, you can return class-method too
Add answer class to context
If you often use the Answer class, you shouldn't use the @GetAnswer
decorator in every handler. You can use the @GetAnswerContext
property decorator in the controller and use it like this.answer
You can read more about keyboard here
Last updated