Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
kshashov committed Jan 5, 2021
1 parent f352a42 commit 11b5069
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ This is a spring boot starter for [Telegram Bot API](https://github.com/pengrad/
<dependency>
<groupId>com.github.kshashov</groupId>
<artifactId>spring-boot-starter-telegram</artifactId>
<version>0.21</version>
<version>0.23</version>
</dependency>
```
### Gradle
```groovy
implementation 'com.github.kshashov:spring-boot-starter-telegram:0.21'
implementation 'com.github.kshashov:spring-boot-starter-telegram:0.23'
```

## Example
Expand Down Expand Up @@ -65,6 +65,22 @@ public class MyBot implements TelegramMvcController {
return "Hello, " + userName;
}

@MessageRequest("/helloCallback")
public String helloWithCustomCallback(TelegramRequest request, User user) {
request.setCallback(new Callback<BaseRequest, BaseResponse>() {
@Override
public void onResponse(BaseRequest request, BaseResponse response) {
// TODO
}

@Override
public void onFailure(BaseRequest request, IOException e) {
// TODO
}
});
return "Hello, " + user.firstName() + "!";
}

public static void main(String[] args) {
SpringApplication.run(MyBot.class);
}
Expand Down Expand Up @@ -119,7 +135,7 @@ If you need to override the matcher or process routes in a custom way, you can d
### Supported arguments

Some parameters may be nullable because they do not exist for all types of telegram requests
* `TelegramRequest` - entity that include all available parameters from the initial request, the path pattern and path variables
* `TelegramRequest` - entity that include all available parameters from the initial request, the path pattern and path variables. Provides an ability to set a custom callback
* `TelegramSession` - current session for the current chat (if any) or user
* `com.pengrad.telegrambot.TelegramBot` - bot instance that received the request
* **Nullable** `String`, `Integer`, `Long`, `Double`, `Float`, `BigInteger`, `BigDecimal` marked with `BotPathVariable` annotation - a value of the template variable from the path pattern
Expand Down

0 comments on commit 11b5069

Please sign in to comment.