Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Group ids `io.github.mail-ru-im` and `ru.mail` will no longer being maintained.
<dependency>
<groupId>ru.mail.im</groupId>
<artifactId>bot-api</artifactId>
<version>1.2.3</version>
<version>1.2.4</version>
</dependency>
...
</dependencies>
Expand All @@ -41,7 +41,7 @@ repositories {
}

dependencies {
implementation 'ru.mail.im:bot-api:1.2.3'
implementation 'ru.mail.im:bot-api:1.2.4'
}
```

Expand Down Expand Up @@ -117,6 +117,9 @@ client.stop(); // stop when work done

## Changelog

`1.2.4`
- Support text formats MarkdownV2 and HTML for EditTextRequest

`1.2.3`
- Catch all exceptions in IOBackoff.execute

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ public ApiResponse editText(final EditTextRequest request) throws IOException {
request.getChatId(),
request.getMsgId(),
request.getNewText(),
request.getFormat(),
request.getParseMode(),
request.getKeyboard()
);
}
Expand All @@ -158,7 +160,7 @@ public ApiResponse editText(
final long msgId,
final String text
) throws IOException {
return client.messages().editText(chatId, msgId, text, null);
return client.messages().editText(chatId, msgId, text, null, null, null);
}

public ApiResponse deleteMessage(final DeleteMessagesRequest request) throws IOException {
Expand Down
2 changes: 2 additions & 0 deletions library/src/main/java/ru/mail/im/botapi/api/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ ApiResponse editText(
@RequestParam("chatId") final String chatId,
@RequestParam("msgId") final long msgId,
@RequestParam("text") final String newText,
@RequestParam("format") final String format,
@RequestParam("parseMode") final String parseMode,
@RequestParam("inlineKeyboardMarkup") final List<List<InlineKeyboardButton>> keyboard
) throws IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ public class EditTextRequest {
private String chatId;
private long msgId;
private String newText;
private String format;
private String parseMode;
private List<List<InlineKeyboardButton>> keyboard;

public String getChatId() {
Expand Down Expand Up @@ -43,4 +45,22 @@ public EditTextRequest setKeyboard(final List<List<InlineKeyboardButton>> keyboa
this.keyboard = keyboard;
return this;
}

public String getFormat() {
return format;
}

public EditTextRequest setFormat(String format) {
this.format = format;
return this;
}

public String getParseMode() {
return parseMode;
}

public EditTextRequest setParseMode(String parseMode) {
this.parseMode = parseMode;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void onSendVoice(final String chatId, final File file) {

@Override
public void onEditText(final String chatId, final long msgId, final String newText) {
api(client -> client.messages().editText(chatId, msgId, newText, null));
api(client -> client.messages().editText(chatId, msgId, newText, null, null, null));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ public class SimpleStart {

public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter API URL:");
String apiUrl = scanner.nextLine();
System.out.println("Enter bot token:");
String token = scanner.nextLine();
System.out.println("Enter test chatId:");
String chatId = scanner.nextLine();

BotApiClient client = new BotApiClient(token);
BotApiClient client = new BotApiClient(apiUrl, token);

BotApiClientController controller = BotApiClientController.startBot(client);
System.out.println("STARTED");
Expand Down