Skip to content

Commit 75f2c7a

Browse files
authored
Merge pull request #326 from mircoianese/api_v6.7
BOT Api v6.7
2 parents dfd39d1 + d1e0879 commit 75f2c7a

File tree

14 files changed

+275
-11
lines changed

14 files changed

+275
-11
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![codecov](https://codecov.io/gh/pengrad/java-telegram-bot-api/branch/master/graph/badge.svg)](https://codecov.io/gh/pengrad/java-telegram-bot-api)
55

66
Java library for interacting with [Telegram Bot API](https://core.telegram.org/bots/api)
7-
- Full support of all Bot API 6.6 methods
7+
- Full support of all Bot API 6.7 methods
88
- Telegram [Passport](https://core.telegram.org/passport) and Decryption API
99
- Bot [Payments](https://core.telegram.org/bots/payments)
1010
- [Gaming Platform](https://telegram.org/blog/games)
@@ -13,14 +13,14 @@ Java library for interacting with [Telegram Bot API](https://core.telegram.org/b
1313

1414
Gradle:
1515
```groovy
16-
implementation 'com.github.pengrad:java-telegram-bot-api:6.6.1'
16+
implementation 'com.github.pengrad:java-telegram-bot-api:6.7.0'
1717
```
1818
Maven:
1919
```xml
2020
<dependency>
2121
<groupId>com.github.pengrad</groupId>
2222
<artifactId>java-telegram-bot-api</artifactId>
23-
<version>6.6.1</version>
23+
<version>6.7.0</version>
2424
</dependency>
2525
```
2626
[JAR with all dependencies on release page](https://github.com/pengrad/java-telegram-bot-api/releases)

README_RU.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![codecov](https://codecov.io/gh/pengrad/java-telegram-bot-api/branch/master/graph/badge.svg)](https://codecov.io/gh/pengrad/java-telegram-bot-api)
55

66
Java библиотека, созданная для работы с [Telegram Bot API](https://core.telegram.org/bots/api)
7-
- Полная поддержка всех методов BOT API 6.6
7+
- Полная поддержка всех методов BOT API 6.7
88
- Поддержка Telegram [паспорта](https://core.telegram.org/passport) и дешифровки (Decryption API);
99
- Поддержка [платежей](https://core.telegram.org/bots/payments);
1010
- [Игровая платформа](https://telegram.org/blog/games).
@@ -13,14 +13,14 @@ Java библиотека, созданная для работы с [Telegram B
1313

1414
Gradle:
1515
```groovy
16-
implementation 'com.github.pengrad:java-telegram-bot-api:6.6.1'
16+
implementation 'com.github.pengrad:java-telegram-bot-api:6.7.0'
1717
```
1818
Maven:
1919
```xml
2020
<dependency>
2121
<groupId>com.github.pengrad</groupId>
2222
<artifactId>java-telegram-bot-api</artifactId>
23-
<version>6.6.1</version>
23+
<version>6.7.0</version>
2424
</dependency>
2525
```
2626
Также JAR со всеми зависимостями можно найти [в релизах](https://github.com/pengrad/java-telegram-bot-api/releases).

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
GROUP=com.github.pengrad
2-
VERSION_NAME=6.6.1
2+
VERSION_NAME=6.7.0
33

44
POM_DESCRIPTION=Java API for Telegram Bot API
55
POM_URL=https://github.com/pengrad/java-telegram-bot-api/
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.pengrad.telegrambot.model;
2+
3+
import java.io.Serializable;
4+
import java.util.Objects;
5+
6+
public class BotName implements Serializable {
7+
private final static long serialVersionUID = 0L;
8+
9+
private String name;
10+
11+
BotName() {
12+
}
13+
14+
public String name() {
15+
return name;
16+
}
17+
18+
@Override
19+
public boolean equals(Object o) {
20+
if (this == o) return true;
21+
if (o == null || getClass() != o.getClass()) return false;
22+
23+
BotName that = (BotName) o;
24+
25+
return Objects.equals(name, that.name);
26+
}
27+
28+
@Override
29+
public int hashCode() {
30+
return name != null ? name.hashCode() : 0;
31+
}
32+
33+
@Override
34+
public String toString() {
35+
return "BotName{" +
36+
", name='" + name + '\'' +
37+
'}';
38+
}
39+
}

library/src/main/java/com/pengrad/telegrambot/model/ChatMemberUpdated.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class ChatMemberUpdated implements Serializable {
1616
private ChatMember old_chat_member;
1717
private ChatMember new_chat_member;
1818
private ChatInviteLink invite_link;
19+
private Boolean via_chat_folder_invite_link;
1920

2021
public Chat chat() {
2122
return chat;
@@ -41,6 +42,10 @@ public ChatInviteLink inviteLink() {
4142
return invite_link;
4243
}
4344

45+
public Boolean viaChatFolderInviteLink() {
46+
return via_chat_folder_invite_link;
47+
}
48+
4449
@Override
4550
public boolean equals(Object o) {
4651
if (this == o) return true;
@@ -51,12 +56,13 @@ public boolean equals(Object o) {
5156
Objects.equals(date, that.date) &&
5257
Objects.equals(old_chat_member, that.old_chat_member) &&
5358
Objects.equals(new_chat_member, that.new_chat_member) &&
54-
Objects.equals(invite_link, that.invite_link);
59+
Objects.equals(invite_link, that.invite_link) &&
60+
Objects.equals(via_chat_folder_invite_link, that.via_chat_folder_invite_link);
5561
}
5662

5763
@Override
5864
public int hashCode() {
59-
return Objects.hash(chat, from, date, old_chat_member, new_chat_member, invite_link);
65+
return Objects.hash(chat, from, date, old_chat_member, new_chat_member, invite_link, via_chat_folder_invite_link);
6066
}
6167

6268
@Override
@@ -68,6 +74,7 @@ public String toString() {
6874
", old_chat_member=" + old_chat_member +
6975
", new_chat_member=" + new_chat_member +
7076
", invite_link=" + invite_link +
77+
", via_chat_folder_invite_link=" + via_chat_folder_invite_link +
7178
'}';
7279
}
7380
}

library/src/main/java/com/pengrad/telegrambot/model/WriteAccessAllowed.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
public class WriteAccessAllowed implements Serializable {
66
private final static long serialVersionUID = 0L;
77

8+
private String web_app_name;
9+
10+
public String webAppName() {
11+
return web_app_name;
12+
}
13+
814
@Override
915
public boolean equals(Object o) {
1016
if (this == o) return true;

library/src/main/java/com/pengrad/telegrambot/model/request/InlineKeyboardButton.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class InlineKeyboardButton implements Serializable {
1818
private String callback_data;
1919
private String switch_inline_query;
2020
private String switch_inline_query_current_chat;
21+
private SwitchInlineQueryChosenChat switch_inline_query_chosen_chat;
2122
private CallbackGame callback_game;
2223
private Boolean pay;
2324
private WebAppInfo web_app;
@@ -56,6 +57,11 @@ public InlineKeyboardButton switchInlineQueryCurrentChat(String switchInlineQuer
5657
return this;
5758
}
5859

60+
public InlineKeyboardButton switchInlineQueryChosenChat(SwitchInlineQueryChosenChat switchInlineQueryChosenChat) {
61+
switch_inline_query_chosen_chat = switchInlineQueryChosenChat;
62+
return this;
63+
}
64+
5965
public InlineKeyboardButton callbackGame(String callbackGame) {
6066
callback_game = new CallbackGame();
6167
return this;
@@ -91,6 +97,10 @@ public String switchInlineQueryCurrentChat() {
9197
return switch_inline_query_current_chat;
9298
}
9399

100+
public SwitchInlineQueryChosenChat switchInlineQueryChosenChat() {
101+
return switch_inline_query_chosen_chat;
102+
}
103+
94104
public CallbackGame callbackGame() {
95105
return callback_game;
96106
}
@@ -114,14 +124,15 @@ public boolean equals(Object o) {
114124
Objects.equals(callback_data, that.callback_data) &&
115125
Objects.equals(switch_inline_query, that.switch_inline_query) &&
116126
Objects.equals(switch_inline_query_current_chat, that.switch_inline_query_current_chat) &&
127+
Objects.equals(switch_inline_query_chosen_chat, that.switch_inline_query_chosen_chat) &&
117128
Objects.equals(callback_game, that.callback_game) &&
118129
Objects.equals(pay, that.pay) &&
119130
Objects.equals(web_app, that.web_app);
120131
}
121132

122133
@Override
123134
public int hashCode() {
124-
return Objects.hash(text, url, login_url, callback_data, switch_inline_query, switch_inline_query_current_chat, callback_game, pay, web_app);
135+
return Objects.hash(text, url, login_url, callback_data, switch_inline_query, switch_inline_query_current_chat, switch_inline_query_chosen_chat, callback_game, pay, web_app);
125136
}
126137

127138
@Override
@@ -133,6 +144,7 @@ public String toString() {
133144
", callback_data='" + callback_data + '\'' +
134145
", switch_inline_query='" + switch_inline_query + '\'' +
135146
", switch_inline_query_current_chat='" + switch_inline_query_current_chat + '\'' +
147+
", switch_inline_query_chosen_chat='" + switch_inline_query_chosen_chat + '\'' +
136148
", callback_game=" + callback_game +
137149
", pay=" + pay +
138150
", web_app=" + web_app +
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package com.pengrad.telegrambot.model.request;
2+
3+
import java.io.Serializable;
4+
import java.util.Objects;
5+
6+
import com.pengrad.telegrambot.model.WebAppInfo;
7+
8+
public class InlineQueryResultsButton implements Serializable {
9+
10+
private final static long serialVersionUID = 0L;
11+
12+
private String text;
13+
private WebAppInfo web_app;
14+
private String start_parameter;
15+
16+
public InlineQueryResultsButton(String text, WebAppInfo webApp) {
17+
this.text = text;
18+
this.web_app = webApp;
19+
}
20+
21+
public InlineQueryResultsButton(String text, String startParameter) {
22+
this.text = text;
23+
this.start_parameter = startParameter;
24+
}
25+
26+
public String text() {
27+
return text;
28+
}
29+
30+
public WebAppInfo webApp() {
31+
return web_app;
32+
}
33+
34+
public String startParameter() {
35+
return start_parameter;
36+
}
37+
38+
@Override
39+
public int hashCode() {
40+
return Objects.hash(text,
41+
web_app,
42+
start_parameter);
43+
}
44+
45+
@Override
46+
public String toString() {
47+
return "InlineQueryResultsButton{" +
48+
"text='" + text + '\'' +
49+
", web_app=" + web_app +
50+
", start_parameter='" + start_parameter + '\'' +
51+
'}';
52+
}
53+
54+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.pengrad.telegrambot.model.request;
2+
3+
import java.io.Serializable;
4+
import java.util.Objects;
5+
6+
public class SwitchInlineQueryChosenChat implements Serializable {
7+
private final static long serialVersionUID = 0L;
8+
9+
private String query;
10+
private Boolean allow_user_chats;
11+
private Boolean allow_bot_chats;
12+
private Boolean allow_group_chats;
13+
private Boolean allow_channel_chats;
14+
15+
public SwitchInlineQueryChosenChat query(String query) {
16+
this.query = query;
17+
return this;
18+
}
19+
20+
public SwitchInlineQueryChosenChat allowUserChats(Boolean allowUserChats) {
21+
this.allow_user_chats = allowUserChats;
22+
return this;
23+
}
24+
25+
public SwitchInlineQueryChosenChat allowBotChats(Boolean allowBotChats) {
26+
this.allow_bot_chats = allowBotChats;
27+
return this;
28+
}
29+
30+
public SwitchInlineQueryChosenChat allowGroupChats(Boolean allowGroupChats) {
31+
this.allow_group_chats = allowGroupChats;
32+
return this;
33+
}
34+
35+
public SwitchInlineQueryChosenChat allowChannelChats(Boolean allowChannelChats) {
36+
this.allow_channel_chats = allowChannelChats;
37+
return this;
38+
}
39+
40+
@Override
41+
public int hashCode() {
42+
return Objects.hash(query,
43+
allow_user_chats,
44+
allow_bot_chats,
45+
allow_group_chats,
46+
allow_channel_chats
47+
);
48+
}
49+
50+
@Override
51+
public String toString() {
52+
return "SwitchInlineQueryChosenChat{" +
53+
"query='" + query + '\'' +
54+
", allow_user_chats=" + allow_user_chats +
55+
", allow_bot_chats=" + allow_bot_chats +
56+
", allow_group_chats=" + allow_group_chats +
57+
", allow_channel_chats='" + allow_channel_chats + '\'' +
58+
'}';
59+
}
60+
61+
}

library/src/main/java/com/pengrad/telegrambot/request/AnswerInlineQuery.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.pengrad.telegrambot.request;
22

33
import com.pengrad.telegrambot.model.request.InlineQueryResult;
4+
import com.pengrad.telegrambot.model.request.InlineQueryResultsButton;
45
import com.pengrad.telegrambot.response.BaseResponse;
56

67
/**
@@ -26,10 +27,22 @@ public AnswerInlineQuery nextOffset(String nextOffset) {
2627
return add("next_offset", nextOffset);
2728
}
2829

30+
public AnswerInlineQuery button(InlineQueryResultsButton button) {
31+
return add ("button", button);
32+
}
33+
34+
/**
35+
* @deprecated Replaced by {@link #button(InlineQueryResultsButton)}
36+
*/
37+
@Deprecated
2938
public AnswerInlineQuery switchPmText(String switchPmText) {
3039
return add("switch_pm_text", switchPmText);
3140
}
3241

42+
/**
43+
* @deprecated Replaced by {@link #button(InlineQueryResultsButton)}
44+
*/
45+
@Deprecated
3346
public AnswerInlineQuery switchPmParameter(String switchPmParameter) {
3447
return add("switch_pm_parameter", switchPmParameter);
3548
}

0 commit comments

Comments
 (0)