Skip to content

Commit b02da0d

Browse files
committed
replacing the parameters switch_pm_text and switch_pm_parameter of the method answerInlineQuery with the parameter button of type InlineQueryResultsButton.
1 parent 1a8fe18 commit b02da0d

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
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+
}

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)