More cleanup
This commit is contained in:
parent
bea0b95fc7
commit
3275c10913
2
pom.xml
2
pom.xml
@ -67,7 +67,7 @@
|
|||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
|
|
||||||
<junit.version>5.5.2</junit.version>
|
<junit.version>5.6.2</junit.version>
|
||||||
<mockito.version>3.1.0</mockito.version>
|
<mockito.version>3.1.0</mockito.version>
|
||||||
<mockitojupiter.version>3.1.0</mockitojupiter.version>
|
<mockitojupiter.version>3.1.0</mockitojupiter.version>
|
||||||
<jacksonbase.version>2.10.1</jacksonbase.version>
|
<jacksonbase.version>2.10.1</jacksonbase.version>
|
||||||
|
@ -25,7 +25,7 @@ import static org.telegram.abilitybots.api.objects.Flag.*;
|
|||||||
* Helper and utility methods
|
* Helper and utility methods
|
||||||
*/
|
*/
|
||||||
public final class AbilityUtils {
|
public final class AbilityUtils {
|
||||||
public static User EMPTY_USER = new User(0, "", false, "", "", "");
|
public static User EMPTY_USER = new User(0, "", false);
|
||||||
|
|
||||||
private AbilityUtils() {
|
private AbilityUtils() {
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public final class AbilityUtils {
|
|||||||
*/
|
*/
|
||||||
public static String stripTag(String username) {
|
public static String stripTag(String username) {
|
||||||
String lowerCase = username.toLowerCase();
|
String lowerCase = username.toLowerCase();
|
||||||
return lowerCase.startsWith("@") ? lowerCase.substring(1, lowerCase.length()) : lowerCase;
|
return lowerCase.startsWith("@") ? lowerCase.substring(1) : lowerCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -252,7 +252,7 @@ public final class AbilityUtils {
|
|||||||
* The full name is identified as the concatenation of the first and last name, separated by a space.
|
* The full name is identified as the concatenation of the first and last name, separated by a space.
|
||||||
* This method can return an empty name if both first and last name are empty.
|
* This method can return an empty name if both first and last name are empty.
|
||||||
*
|
*
|
||||||
* @param user
|
* @param user User to use
|
||||||
* @return the full name of the user
|
* @return the full name of the user
|
||||||
*/
|
*/
|
||||||
public static String fullName(User user) {
|
public static String fullName(User user) {
|
||||||
|
@ -19,8 +19,8 @@ import static org.telegram.abilitybots.api.bot.TestUtils.mockContext;
|
|||||||
import static org.telegram.abilitybots.api.db.MapDBContext.offlineInstance;
|
import static org.telegram.abilitybots.api.db.MapDBContext.offlineInstance;
|
||||||
|
|
||||||
class AbilityBotI18nTest {
|
class AbilityBotI18nTest {
|
||||||
private static final User NO_LANGUAGE_USER = new User(1, "first", false, "last", "username", null);
|
private static final User NO_LANGUAGE_USER = new User(1, "first", false, "last", "username", null, false, false, false);
|
||||||
private static final User ITALIAN_USER = new User(2, "first", false, "last", "username", "it-IT");
|
private static final User ITALIAN_USER = new User(2, "first", false, "last", "username", "it-IT", false, false, false);
|
||||||
|
|
||||||
private DBContext db;
|
private DBContext db;
|
||||||
private NoPublicCommandsBot bot;
|
private NoPublicCommandsBot bot;
|
||||||
|
@ -351,7 +351,7 @@ public class AbilityBotTest {
|
|||||||
String newFirstName = USER.getFirstName() + "-test";
|
String newFirstName = USER.getFirstName() + "-test";
|
||||||
String newLastName = USER.getLastName() + "-test";
|
String newLastName = USER.getLastName() + "-test";
|
||||||
int sameId = USER.getId();
|
int sameId = USER.getId();
|
||||||
User changedUser = new User(sameId, newFirstName, false, newLastName, newUsername, null);
|
User changedUser = new User(sameId, newFirstName, false, newLastName, newUsername, "en", false, false, false);
|
||||||
|
|
||||||
mockAlternateUser(update, message, changedUser);
|
mockAlternateUser(update, message, changedUser);
|
||||||
|
|
||||||
@ -515,6 +515,7 @@ public class AbilityBotTest {
|
|||||||
assertTrue(bot.checkGlobalFlags(update), "Unexpected result when checking for the default global flags");
|
assertTrue(bot.checkGlobalFlags(update), "Unexpected result when checking for the default global flags");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"NumericOverflow", "divzero"})
|
||||||
@Test
|
@Test
|
||||||
void canConsumeUpdate() {
|
void canConsumeUpdate() {
|
||||||
Ability ability = getDefaultBuilder()
|
Ability ability = getDefaultBuilder()
|
||||||
|
@ -22,7 +22,7 @@ import static org.telegram.abilitybots.api.objects.Locality.ALL;
|
|||||||
import static org.telegram.abilitybots.api.objects.Privacy.PUBLIC;
|
import static org.telegram.abilitybots.api.objects.Privacy.PUBLIC;
|
||||||
|
|
||||||
public class ContinuousTextTest {
|
public class ContinuousTextTest {
|
||||||
private static final User USER = new User(1, "first", false, "last", "username", null);
|
private static final User USER = new User(1, "first", false);
|
||||||
|
|
||||||
private DBContext db;
|
private DBContext db;
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ import static org.mockito.Mockito.when;
|
|||||||
import static org.telegram.abilitybots.api.objects.MessageContext.newContext;
|
import static org.telegram.abilitybots.api.objects.MessageContext.newContext;
|
||||||
|
|
||||||
public final class TestUtils {
|
public final class TestUtils {
|
||||||
public static final User USER = new User(1, "first", false, "last", "username", null);
|
public static final User USER = new User(1, "first", false, "last", "username", null, false, false, false);
|
||||||
public static final User CREATOR = new User(1337, "creatorFirst", false, "creatorLast", "creatorUsername", null);
|
public static final User CREATOR = new User(1337, "creatorFirst", false, "creatorLast", "creatorUsername", null, false, false, false);
|
||||||
|
|
||||||
private TestUtils() {
|
private TestUtils() {
|
||||||
|
|
||||||
|
@ -8,15 +8,6 @@ import org.telegram.telegrambots.meta.bots.AbsSender;
|
|||||||
|
|
||||||
class CommandRegistryTest {
|
class CommandRegistryTest {
|
||||||
|
|
||||||
@Test
|
|
||||||
void should_create_registry() {
|
|
||||||
CommandRegistry registry = new CommandRegistry(true, () -> "BotUsername");
|
|
||||||
Assertions.assertNotNull(registry, "CommandRegistry is not created");
|
|
||||||
NullPointerException exception = Assertions.assertThrows(NullPointerException.class,
|
|
||||||
() -> new CommandRegistry(true, () -> "BotUsername"));
|
|
||||||
Assertions.assertEquals("Bot username must not be null", exception.getMessage(), "Invalid exception message");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_executes_commandWithBotUsername() {
|
void should_executes_commandWithBotUsername() {
|
||||||
CommandRegistry registry = new CommandRegistry(true, () -> "BotUsername");
|
CommandRegistry registry = new CommandRegistry(true, () -> "BotUsername");
|
||||||
|
@ -69,11 +69,11 @@
|
|||||||
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<guice.version>4.2.2</guice.version>
|
<guice.version>4.2.3</guice.version>
|
||||||
<jackson.version>2.10.1</jackson.version>
|
<jackson.version>2.10.1</jackson.version>
|
||||||
<jacksonanotation.version>2.10.1</jacksonanotation.version>
|
<jacksonanotation.version>2.10.1</jacksonanotation.version>
|
||||||
<json.version>20180813</json.version>
|
<json.version>20180813</json.version>
|
||||||
<guava.version>28.1-jre</guava.version>
|
<guava.version>30.0-jre</guava.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -119,6 +119,7 @@
|
|||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -3,7 +3,6 @@ package org.telegram.telegrambots.meta.api.methods;
|
|||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@ -15,7 +14,6 @@ import java.io.Serializable;
|
|||||||
*/
|
*/
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
@Data
|
|
||||||
public abstract class BotApiMethod<T extends Serializable> extends PartialBotApiMethod<T> {
|
public abstract class BotApiMethod<T extends Serializable> extends PartialBotApiMethod<T> {
|
||||||
protected static final String METHOD_FIELD = "method";
|
protected static final String METHOD_FIELD = "method";
|
||||||
|
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects;
|
package org.telegram.telegrambots.meta.api.objects;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9,6 +15,10 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
|||||||
* This object represents a Telegram chat with an user or a group
|
* This object represents a Telegram chat with an user or a group
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("WeakerAccess")
|
@SuppressWarnings("WeakerAccess")
|
||||||
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class Chat implements BotApiObject {
|
public class Chat implements BotApiObject {
|
||||||
|
|
||||||
private static final String ID_FIELD = "id";
|
private static final String ID_FIELD = "id";
|
||||||
@ -39,8 +49,10 @@ public class Chat implements BotApiObject {
|
|||||||
* so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
|
* so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
|
||||||
*/
|
*/
|
||||||
@JsonProperty(ID_FIELD)
|
@JsonProperty(ID_FIELD)
|
||||||
|
@NonNull
|
||||||
private Long id; ///< Unique identifier for this chat, not exceeding 1e13 by absolute value
|
private Long id; ///< Unique identifier for this chat, not exceeding 1e13 by absolute value
|
||||||
@JsonProperty(TYPE_FIELD)
|
@JsonProperty(TYPE_FIELD)
|
||||||
|
@NonNull
|
||||||
private String type; ///< Type of the chat, one of “private”, “group” or “channel”
|
private String type; ///< Type of the chat, one of “private”, “group” or “channel”
|
||||||
@JsonProperty(TITLE_FIELD)
|
@JsonProperty(TITLE_FIELD)
|
||||||
private String title; ///< Optional. Title of the chat, only for channels and group chat
|
private String title; ///< Optional. Title of the chat, only for channels and group chat
|
||||||
@ -83,96 +95,23 @@ public class Chat implements BotApiObject {
|
|||||||
@JsonProperty(SLOWMODEDELAY_FIELD)
|
@JsonProperty(SLOWMODEDELAY_FIELD)
|
||||||
private Integer slowModeDelay;
|
private Integer slowModeDelay;
|
||||||
|
|
||||||
public Chat() {
|
@JsonIgnore
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean isGroupChat() {
|
public Boolean isGroupChat() {
|
||||||
return GROUPCHATTYPE.equals(type);
|
return GROUPCHATTYPE.equals(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public Boolean isChannelChat() {
|
public Boolean isChannelChat() {
|
||||||
return CHANNELCHATTYPE.equals(type);
|
return CHANNELCHATTYPE.equals(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public Boolean isUserChat() {
|
public Boolean isUserChat() {
|
||||||
return USERCHATTYPE.equals(type);
|
return USERCHATTYPE.equals(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public Boolean isSuperGroupChat() {
|
public Boolean isSuperGroupChat() {
|
||||||
return SUPERGROUPCHATTYPE.equals(type);
|
return SUPERGROUPCHATTYPE.equals(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFirstName() {
|
|
||||||
return firstName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLastName() {
|
|
||||||
return lastName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserName() {
|
|
||||||
return userName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChatPermissions getPermissions() {
|
|
||||||
return permissions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChatPhoto getPhoto() {
|
|
||||||
return photo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getInviteLink() {
|
|
||||||
return inviteLink;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Message getPinnedMessage() {
|
|
||||||
return pinnedMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStickerSetName() {
|
|
||||||
return stickerSetName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getCanSetStickerSet() {
|
|
||||||
return canSetStickerSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSlowModeDelay() {
|
|
||||||
return slowModeDelay;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Chat{" +
|
|
||||||
"id=" + id +
|
|
||||||
", type='" + type + '\'' +
|
|
||||||
", title='" + title + '\'' +
|
|
||||||
", firstName='" + firstName + '\'' +
|
|
||||||
", lastName='" + lastName + '\'' +
|
|
||||||
", userName='" + userName + '\'' +
|
|
||||||
", allMembersAreAdministrators=" + allMembersAreAdministrators +
|
|
||||||
", photo=" + photo +
|
|
||||||
", description='" + description + '\'' +
|
|
||||||
", inviteLink='" + inviteLink + '\'' +
|
|
||||||
", pinnedMessage=" + pinnedMessage +
|
|
||||||
", stickerSetName='" + stickerSetName + '\'' +
|
|
||||||
", canSetStickerSet=" + canSetStickerSet +
|
|
||||||
", permissions=" + permissions +
|
|
||||||
", slowModeDelay=" + slowModeDelay +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects;
|
package org.telegram.telegrambots.meta.api.objects;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.NonNull;
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,15 +13,17 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
|||||||
* This object represents a point on the map.
|
* This object represents a point on the map.
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class Location implements BotApiObject {
|
public class Location implements BotApiObject {
|
||||||
|
|
||||||
private static final String LONGITUDE_FIELD = "longitude";
|
private static final String LONGITUDE_FIELD = "longitude";
|
||||||
private static final String LATITUDE_FIELD = "latitude";
|
private static final String LATITUDE_FIELD = "latitude";
|
||||||
|
|
||||||
@JsonProperty(LONGITUDE_FIELD)
|
@JsonProperty(LONGITUDE_FIELD)
|
||||||
|
@NonNull
|
||||||
private Double longitude; ///< Longitude as defined by sender
|
private Double longitude; ///< Longitude as defined by sender
|
||||||
@JsonProperty(LATITUDE_FIELD)
|
@JsonProperty(LATITUDE_FIELD)
|
||||||
|
@NonNull
|
||||||
private Double latitude; ///< Latitude as defined by sender
|
private Double latitude; ///< Latitude as defined by sender
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects;
|
package org.telegram.telegrambots.meta.api.objects;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
import org.telegram.telegrambots.meta.api.objects.games.Animation;
|
import org.telegram.telegrambots.meta.api.objects.games.Animation;
|
||||||
import org.telegram.telegrambots.meta.api.objects.games.Game;
|
import org.telegram.telegrambots.meta.api.objects.games.Game;
|
||||||
@ -19,6 +25,10 @@ import java.util.List;
|
|||||||
* @version 1.0
|
* @version 1.0
|
||||||
* This object represents a message.
|
* This object represents a message.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class Message implements BotApiObject {
|
public class Message implements BotApiObject {
|
||||||
private static final String MESSAGEID_FIELD = "message_id";
|
private static final String MESSAGEID_FIELD = "message_id";
|
||||||
private static final String FROM_FIELD = "from";
|
private static final String FROM_FIELD = "from";
|
||||||
@ -71,12 +81,15 @@ public class Message implements BotApiObject {
|
|||||||
private static final String VIABOT_FIELD = "via_bot";
|
private static final String VIABOT_FIELD = "via_bot";
|
||||||
|
|
||||||
@JsonProperty(MESSAGEID_FIELD)
|
@JsonProperty(MESSAGEID_FIELD)
|
||||||
|
@NonNull
|
||||||
private Integer messageId; ///< Integer Unique message identifier
|
private Integer messageId; ///< Integer Unique message identifier
|
||||||
@JsonProperty(FROM_FIELD)
|
@JsonProperty(FROM_FIELD)
|
||||||
private User from; ///< Optional. Sender, can be empty for messages sent to channels
|
private User from; ///< Optional. Sender, can be empty for messages sent to channels
|
||||||
@JsonProperty(DATE_FIELD)
|
@JsonProperty(DATE_FIELD)
|
||||||
private Integer date; ///< Optional. Date the message was sent in Unix time
|
@NonNull
|
||||||
|
private Integer date; ///< ODate the message was sent in Unix time
|
||||||
@JsonProperty(CHAT_FIELD)
|
@JsonProperty(CHAT_FIELD)
|
||||||
|
@NonNull
|
||||||
private Chat chat; ///< Conversation the message belongs to
|
private Chat chat; ///< Conversation the message belongs to
|
||||||
@JsonProperty(FORWARDFROM_FIELD)
|
@JsonProperty(FORWARDFROM_FIELD)
|
||||||
private User forwardFrom; ///< Optional. For forwarded messages, sender of the original message
|
private User forwardFrom; ///< Optional. For forwarded messages, sender of the original message
|
||||||
@ -213,37 +226,6 @@ public class Message implements BotApiObject {
|
|||||||
private Dice dice; // Optional. Message is a dice with random value from 1 to 6
|
private Dice dice; // Optional. Message is a dice with random value from 1 to 6
|
||||||
@JsonProperty(VIABOT_FIELD)
|
@JsonProperty(VIABOT_FIELD)
|
||||||
private User viaBot; // Optional. Bot through which the message was sent
|
private User viaBot; // Optional. Bot through which the message was sent
|
||||||
public Message() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getMessageId() {
|
|
||||||
return messageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getFrom() {
|
|
||||||
return from;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getDate() {
|
|
||||||
return date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Chat getChat() {
|
|
||||||
return chat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getForwardFrom() {
|
|
||||||
return forwardFrom;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getForwardDate() {
|
|
||||||
return forwardDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getText() {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MessageEntity> getEntities() {
|
public List<MessageEntity> getEntities() {
|
||||||
if (entities != null) {
|
if (entities != null) {
|
||||||
@ -259,130 +241,47 @@ public class Message implements BotApiObject {
|
|||||||
return captionEntities;
|
return captionEntities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Audio getAudio() {
|
@JsonIgnore
|
||||||
return audio;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Document getDocument() {
|
|
||||||
return document;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PhotoSize> getPhoto() {
|
|
||||||
return photo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Sticker getSticker() {
|
|
||||||
return sticker;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasSticker() {
|
|
||||||
return sticker != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Video getVideo() {
|
|
||||||
return video;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Animation getAnimation() {
|
|
||||||
return animation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Contact getContact() {
|
|
||||||
return contact;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getLocation() {
|
|
||||||
return location;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Venue getVenue() {
|
|
||||||
return venue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Message getPinnedMessage() {
|
|
||||||
return pinnedMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<User> getNewChatMembers() {
|
public List<User> getNewChatMembers() {
|
||||||
return newChatMembers == null ? new ArrayList<>() : newChatMembers;
|
return newChatMembers == null ? new ArrayList<>() : newChatMembers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getLeftChatMember() {
|
@JsonIgnore
|
||||||
return leftChatMember;
|
public boolean hasSticker() {
|
||||||
}
|
return sticker != null;
|
||||||
|
|
||||||
public String getNewChatTitle() {
|
|
||||||
return newChatTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PhotoSize> getNewChatPhoto() {
|
|
||||||
return newChatPhoto;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getDeleteChatPhoto() {
|
|
||||||
return deleteChatPhoto;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getGroupchatCreated() {
|
|
||||||
return groupchatCreated;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Message getReplyToMessage() {
|
|
||||||
return replyToMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Voice getVoice() {
|
|
||||||
return voice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCaption() {
|
|
||||||
return caption;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getSuperGroupCreated() {
|
|
||||||
return superGroupCreated;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getChannelChatCreated() {
|
|
||||||
return channelChatCreated;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getMigrateToChatId() {
|
|
||||||
return migrateToChatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getMigrateFromChatId() {
|
|
||||||
return migrateFromChatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getForwardFromMessageId() {
|
|
||||||
return forwardFromMessageId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isGroupMessage() {
|
public boolean isGroupMessage() {
|
||||||
return chat.isGroupChat();
|
return chat.isGroupChat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isUserMessage() {
|
public boolean isUserMessage() {
|
||||||
return chat.isUserChat();
|
return chat.isUserChat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isChannelMessage() {
|
public boolean isChannelMessage() {
|
||||||
return chat.isChannelChat();
|
return chat.isChannelChat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isSuperGroupMessage() {
|
public boolean isSuperGroupMessage() {
|
||||||
return chat.isSuperGroupChat();
|
return chat.isSuperGroupChat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public Long getChatId() {
|
public Long getChatId() {
|
||||||
return chat.getId();
|
return chat.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean hasText() {
|
public boolean hasText() {
|
||||||
return text != null && !text.isEmpty();
|
return text != null && !text.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isCommand() {
|
public boolean isCommand() {
|
||||||
if (hasText() && entities != null) {
|
if (hasText() && entities != null) {
|
||||||
for (MessageEntity entity : entities) {
|
for (MessageEntity entity : entities) {
|
||||||
@ -395,202 +294,98 @@ public class Message implements BotApiObject {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean hasDocument() {
|
public boolean hasDocument() {
|
||||||
return this.document != null;
|
return this.document != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean hasVideo() {
|
public boolean hasVideo() {
|
||||||
return this.video != null;
|
return this.video != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean hasAudio(){
|
public boolean hasAudio(){
|
||||||
return this.audio != null;
|
return this.audio != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean hasVoice(){
|
public boolean hasVoice(){
|
||||||
return this.voice != null;
|
return this.voice != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isReply() {
|
public boolean isReply() {
|
||||||
return this.replyToMessage != null;
|
return this.replyToMessage != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean hasLocation() {
|
public boolean hasLocation() {
|
||||||
return location != null;
|
return location != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chat getForwardFromChat() {
|
@JsonIgnore
|
||||||
return forwardFromChat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getEditDate() {
|
|
||||||
return editDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Game getGame() {
|
|
||||||
return game;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean hasGame() {
|
private boolean hasGame() {
|
||||||
return game != null;
|
return game != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean hasEntities() {
|
public boolean hasEntities() {
|
||||||
return entities != null && !entities.isEmpty();
|
return entities != null && !entities.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean hasPhoto() {
|
public boolean hasPhoto() {
|
||||||
return photo != null && !photo.isEmpty();
|
return photo != null && !photo.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean hasInvoice() {
|
public boolean hasInvoice() {
|
||||||
return invoice != null;
|
return invoice != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean hasSuccessfulPayment() {
|
public boolean hasSuccessfulPayment() {
|
||||||
return successfulPayment != null;
|
return successfulPayment != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean hasContact() {
|
public boolean hasContact() {
|
||||||
return contact != null;
|
return contact != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Invoice getInvoice() {
|
@JsonIgnore
|
||||||
return invoice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SuccessfulPayment getSuccessfulPayment() {
|
|
||||||
return successfulPayment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public VideoNote getVideoNote() {
|
|
||||||
return videoNote;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasVideoNote() {
|
public boolean hasVideoNote() {
|
||||||
return videoNote != null;
|
return videoNote != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthorSignature() {
|
@JsonIgnore
|
||||||
return authorSignature;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getForwardSignature() {
|
|
||||||
return forwardSignature;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMediaGroupId() {
|
|
||||||
return mediaGroupId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getConnectedWebsite() {
|
|
||||||
return connectedWebsite;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PassportData getPassportData() {
|
|
||||||
return passportData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasPassportData() {
|
public boolean hasPassportData() {
|
||||||
return passportData != null;
|
return passportData != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean hasAnimation() {
|
public boolean hasAnimation() {
|
||||||
return animation != null;
|
return animation != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getForwardSenderName() {
|
@JsonIgnore
|
||||||
return forwardSenderName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setForwardSenderName(String forwardSenderName) {
|
|
||||||
this.forwardSenderName = forwardSenderName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasPoll() {
|
public boolean hasPoll() {
|
||||||
return poll != null;
|
return poll != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Poll getPoll() {
|
@JsonIgnore
|
||||||
return poll;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dice getDice() {
|
|
||||||
return dice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasDice() {
|
public boolean hasDice() {
|
||||||
return dice != null;
|
return dice != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getViaBot() {
|
@JsonIgnore
|
||||||
return viaBot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasViaBot() {
|
public boolean hasViaBot() {
|
||||||
return viaBot != null;
|
return viaBot != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean hasReplyMarkup() {
|
public boolean hasReplyMarkup() {
|
||||||
return replyMarkup != null;
|
return replyMarkup != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InlineKeyboardMarkup getReplyMarkup() {
|
|
||||||
return replyMarkup;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Message{" +
|
|
||||||
"messageId=" + messageId +
|
|
||||||
", from=" + from +
|
|
||||||
", date=" + date +
|
|
||||||
", chat=" + chat +
|
|
||||||
", forwardFrom=" + forwardFrom +
|
|
||||||
", forwardFromChat=" + forwardFromChat +
|
|
||||||
", forwardDate=" + forwardDate +
|
|
||||||
", text='" + text + '\'' +
|
|
||||||
", entities=" + entities +
|
|
||||||
", captionEntities=" + captionEntities +
|
|
||||||
", audio=" + audio +
|
|
||||||
", document=" + document +
|
|
||||||
", photo=" + photo +
|
|
||||||
", sticker=" + sticker +
|
|
||||||
", video=" + video +
|
|
||||||
", contact=" + contact +
|
|
||||||
", location=" + location +
|
|
||||||
", venue=" + venue +
|
|
||||||
", animation=" + animation +
|
|
||||||
", pinnedMessage=" + pinnedMessage +
|
|
||||||
", newChatMembers=" + newChatMembers +
|
|
||||||
", leftChatMember=" + leftChatMember +
|
|
||||||
", newChatTitle='" + newChatTitle + '\'' +
|
|
||||||
", newChatPhoto=" + newChatPhoto +
|
|
||||||
", deleteChatPhoto=" + deleteChatPhoto +
|
|
||||||
", groupchatCreated=" + groupchatCreated +
|
|
||||||
", replyToMessage=" + replyToMessage +
|
|
||||||
", voice=" + voice +
|
|
||||||
", caption='" + caption + '\'' +
|
|
||||||
", superGroupCreated=" + superGroupCreated +
|
|
||||||
", channelChatCreated=" + channelChatCreated +
|
|
||||||
", migrateToChatId=" + migrateToChatId +
|
|
||||||
", migrateFromChatId=" + migrateFromChatId +
|
|
||||||
", editDate=" + editDate +
|
|
||||||
", game=" + game +
|
|
||||||
", forwardFromMessageId=" + forwardFromMessageId +
|
|
||||||
", invoice=" + invoice +
|
|
||||||
", successfulPayment=" + successfulPayment +
|
|
||||||
", videoNote=" + videoNote +
|
|
||||||
", authorSignature='" + authorSignature + '\'' +
|
|
||||||
", forwardSignature='" + forwardSignature + '\'' +
|
|
||||||
", mediaGroupId='" + mediaGroupId + '\'' +
|
|
||||||
", connectedWebsite='" + connectedWebsite + '\'' +
|
|
||||||
", passportData=" + passportData +
|
|
||||||
", forwardSenderName='" + forwardSenderName + '\'' +
|
|
||||||
", poll=" + poll +
|
|
||||||
", replyMarkup=" + replyMarkup +
|
|
||||||
", dice=" + dice +
|
|
||||||
", viaBot=" + viaBot +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,22 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects;
|
package org.telegram.telegrambots.meta.api.objects;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Ruben Bermudez
|
* @author Ruben Bermudez
|
||||||
* @version 3.0
|
* @version 3.0
|
||||||
* This object represents a Telegram user or bot.
|
* This object represents a Telegram user or bot.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class User implements BotApiObject {
|
public class User implements BotApiObject {
|
||||||
|
|
||||||
private static final String ID_FIELD = "id";
|
private static final String ID_FIELD = "id";
|
||||||
@ -23,10 +30,13 @@ public class User implements BotApiObject {
|
|||||||
private static final String SUPPORTINLINEQUERIES_FIELD = "supports_inline_queries";
|
private static final String SUPPORTINLINEQUERIES_FIELD = "supports_inline_queries";
|
||||||
|
|
||||||
@JsonProperty(ID_FIELD)
|
@JsonProperty(ID_FIELD)
|
||||||
|
@NonNull
|
||||||
private Integer id; ///< Unique identifier for this user or bot
|
private Integer id; ///< Unique identifier for this user or bot
|
||||||
@JsonProperty(FIRSTNAME_FIELD)
|
@JsonProperty(FIRSTNAME_FIELD)
|
||||||
|
@NonNull
|
||||||
private String firstName; ///< User‘s or bot’s first name
|
private String firstName; ///< User‘s or bot’s first name
|
||||||
@JsonProperty(ISBOT_FIELD)
|
@JsonProperty(ISBOT_FIELD)
|
||||||
|
@NonNull
|
||||||
private Boolean isBot; ///< True, if this user is a bot
|
private Boolean isBot; ///< True, if this user is a bot
|
||||||
@JsonProperty(LASTNAME_FIELD)
|
@JsonProperty(LASTNAME_FIELD)
|
||||||
private String lastName; ///< Optional. User‘s or bot’s last name
|
private String lastName; ///< Optional. User‘s or bot’s last name
|
||||||
@ -40,90 +50,4 @@ public class User implements BotApiObject {
|
|||||||
private Boolean canReadAllGroupMessages; ///< Optional. True, if privacy mode is disabled for the bot. Returned only in getMe.
|
private Boolean canReadAllGroupMessages; ///< Optional. True, if privacy mode is disabled for the bot. Returned only in getMe.
|
||||||
@JsonProperty(SUPPORTINLINEQUERIES_FIELD)
|
@JsonProperty(SUPPORTINLINEQUERIES_FIELD)
|
||||||
private Boolean supportInlineQueries; ///< Optional. True, if the bot supports inline queries. Returned only in getMe.
|
private Boolean supportInlineQueries; ///< Optional. True, if the bot supports inline queries. Returned only in getMe.
|
||||||
|
|
||||||
public User() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public User(Integer id, String firstName, Boolean isBot, String lastName, String userName, String languageCode) {
|
|
||||||
this.id = id;
|
|
||||||
this.firstName = firstName;
|
|
||||||
this.isBot = isBot;
|
|
||||||
this.lastName = lastName;
|
|
||||||
this.userName = userName;
|
|
||||||
this.languageCode = languageCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFirstName() {
|
|
||||||
return firstName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLastName() {
|
|
||||||
return lastName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserName() {
|
|
||||||
return userName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguageCode() {
|
|
||||||
return languageCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getBot() {
|
|
||||||
return isBot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getCanJoinGroups() {
|
|
||||||
return canJoinGroups;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getCanReadAllGroupMessages() {
|
|
||||||
return canReadAllGroupMessages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getSupportInlineQueries() {
|
|
||||||
return supportInlineQueries;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
User user = (User) o;
|
|
||||||
return Objects.equals(id, user.id) &&
|
|
||||||
Objects.equals(firstName, user.firstName) &&
|
|
||||||
Objects.equals(isBot, user.isBot) &&
|
|
||||||
Objects.equals(lastName, user.lastName) &&
|
|
||||||
Objects.equals(userName, user.userName) &&
|
|
||||||
Objects.equals(languageCode, user.languageCode) &&
|
|
||||||
Objects.equals(canJoinGroups, user.canJoinGroups) &&
|
|
||||||
Objects.equals(canReadAllGroupMessages, user.canReadAllGroupMessages) &&
|
|
||||||
Objects.equals(supportInlineQueries, user.supportInlineQueries);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash(id, firstName, isBot, lastName, userName, languageCode,
|
|
||||||
canJoinGroups, canReadAllGroupMessages, supportInlineQueries);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "User{" +
|
|
||||||
"id=" + id +
|
|
||||||
", firstName='" + firstName + '\'' +
|
|
||||||
", isBot=" + isBot +
|
|
||||||
", lastName='" + lastName + '\'' +
|
|
||||||
", userName='" + userName + '\'' +
|
|
||||||
", languageCode='" + languageCode + '\'' +
|
|
||||||
", canJoinGroups=" + canJoinGroups +
|
|
||||||
", canReadAllGroupMessages=" + canReadAllGroupMessages +
|
|
||||||
", supportInlineQueries=" + supportInlineQueries +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,11 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects.games;
|
package org.telegram.telegrambots.meta.api.objects.games;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
import org.telegram.telegrambots.meta.api.objects.PhotoSize;
|
import org.telegram.telegrambots.meta.api.objects.PhotoSize;
|
||||||
|
|
||||||
@ -28,7 +31,9 @@ import org.telegram.telegrambots.meta.api.objects.PhotoSize;
|
|||||||
* This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
|
* This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class Animation implements BotApiObject {
|
public class Animation implements BotApiObject {
|
||||||
private static final String FILEID_FIELD = "file_id";
|
private static final String FILEID_FIELD = "file_id";
|
||||||
private static final String FILEUNIQUEID_FIELD = "file_unique_id";
|
private static final String FILEUNIQUEID_FIELD = "file_unique_id";
|
||||||
@ -41,18 +46,23 @@ public class Animation implements BotApiObject {
|
|||||||
private static final String FILESIZE_FIELD = "file_size";
|
private static final String FILESIZE_FIELD = "file_size";
|
||||||
|
|
||||||
@JsonProperty(FILEID_FIELD)
|
@JsonProperty(FILEID_FIELD)
|
||||||
|
@NonNull
|
||||||
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file
|
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file
|
||||||
/**
|
/**
|
||||||
* Unique identifier for this file, which is supposed to be the same over time and for different bots.
|
* Unique identifier for this file, which is supposed to be the same over time and for different bots.
|
||||||
* Can't be used to download or reuse the file.
|
* Can't be used to download or reuse the file.
|
||||||
*/
|
*/
|
||||||
@JsonProperty(FILEUNIQUEID_FIELD)
|
@JsonProperty(FILEUNIQUEID_FIELD)
|
||||||
|
@NonNull
|
||||||
private String fileUniqueId;
|
private String fileUniqueId;
|
||||||
@JsonProperty(WIDTH_FIELD)
|
@JsonProperty(WIDTH_FIELD)
|
||||||
|
@NonNull
|
||||||
private Integer width; ///< Video width as defined by sender
|
private Integer width; ///< Video width as defined by sender
|
||||||
@JsonProperty(HEIGHT_FIELD)
|
@JsonProperty(HEIGHT_FIELD)
|
||||||
|
@NonNull
|
||||||
private Integer height; ///< Video height as defined by sender
|
private Integer height; ///< Video height as defined by sender
|
||||||
@JsonProperty(DURATION_FIELD)
|
@JsonProperty(DURATION_FIELD)
|
||||||
|
@NonNull
|
||||||
private Integer duration; ///< Duration of the video in seconds as defined by sender
|
private Integer duration; ///< Duration of the video in seconds as defined by sender
|
||||||
@JsonProperty(THUMB_FIELD)
|
@JsonProperty(THUMB_FIELD)
|
||||||
private PhotoSize thumb; ///< Optional. Animation thumbnail as defined by sender
|
private PhotoSize thumb; ///< Optional. Animation thumbnail as defined by sender
|
||||||
|
@ -17,8 +17,11 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects.games;
|
package org.telegram.telegrambots.meta.api.objects.games;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
import org.telegram.telegrambots.meta.api.objects.MessageEntity;
|
import org.telegram.telegrambots.meta.api.objects.MessageEntity;
|
||||||
import org.telegram.telegrambots.meta.api.objects.PhotoSize;
|
import org.telegram.telegrambots.meta.api.objects.PhotoSize;
|
||||||
@ -32,7 +35,9 @@ import java.util.List;
|
|||||||
* @apiNote Use BotFather to create and edit games, their short names will act as unique identifiers.
|
* @apiNote Use BotFather to create and edit games, their short names will act as unique identifiers.
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class Game implements BotApiObject {
|
public class Game implements BotApiObject {
|
||||||
|
|
||||||
private static final String TITLE_FIELD = "title";
|
private static final String TITLE_FIELD = "title";
|
||||||
@ -43,10 +48,13 @@ public class Game implements BotApiObject {
|
|||||||
private static final String TEXTENTITIES_FIELD = "text_entities";
|
private static final String TEXTENTITIES_FIELD = "text_entities";
|
||||||
|
|
||||||
@JsonProperty(TITLE_FIELD)
|
@JsonProperty(TITLE_FIELD)
|
||||||
|
@NonNull
|
||||||
private String title; ///< Title of the game
|
private String title; ///< Title of the game
|
||||||
@JsonProperty(DESCRIPTION_FIELD)
|
@JsonProperty(DESCRIPTION_FIELD)
|
||||||
|
@NonNull
|
||||||
private String description; ///< Description of the game
|
private String description; ///< Description of the game
|
||||||
@JsonProperty(PHOTO_FIELD)
|
@JsonProperty(PHOTO_FIELD)
|
||||||
|
@NonNull
|
||||||
private List<PhotoSize> photo; ///< Photo
|
private List<PhotoSize> photo; ///< Photo
|
||||||
/**
|
/**
|
||||||
* Optional. Brief description of the game or high scores included in the game message.
|
* Optional. Brief description of the game or high scores included in the game message.
|
||||||
|
@ -18,8 +18,10 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects.games;
|
package org.telegram.telegrambots.meta.api.objects.games;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.NonNull;
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
import org.telegram.telegrambots.meta.api.objects.User;
|
import org.telegram.telegrambots.meta.api.objects.User;
|
||||||
|
|
||||||
@ -30,15 +32,19 @@ import org.telegram.telegrambots.meta.api.objects.User;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class GameHighScore implements BotApiObject {
|
public class GameHighScore implements BotApiObject {
|
||||||
private static final String POSITION_FIELD = "position";
|
private static final String POSITION_FIELD = "position";
|
||||||
private static final String USER_FIELD = "user";
|
private static final String USER_FIELD = "user";
|
||||||
private static final String SCORE_FIELD = "score";
|
private static final String SCORE_FIELD = "score";
|
||||||
|
|
||||||
@JsonProperty(POSITION_FIELD)
|
@JsonProperty(POSITION_FIELD)
|
||||||
|
@NonNull
|
||||||
private Integer position; ///< Position in the game high score table
|
private Integer position; ///< Position in the game high score table
|
||||||
@JsonProperty(USER_FIELD)
|
@JsonProperty(USER_FIELD)
|
||||||
|
@NonNull
|
||||||
private User user; ///< User
|
private User user; ///< User
|
||||||
@JsonProperty(SCORE_FIELD)
|
@JsonProperty(SCORE_FIELD)
|
||||||
|
@NonNull
|
||||||
private Integer score; ///< Score
|
private Integer score; ///< Score
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,12 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
import org.telegram.telegrambots.meta.api.objects.Location;
|
import org.telegram.telegrambots.meta.api.objects.Location;
|
||||||
import org.telegram.telegrambots.meta.api.objects.User;
|
import org.telegram.telegrambots.meta.api.objects.User;
|
||||||
@ -16,7 +19,9 @@ import org.telegram.telegrambots.meta.api.objects.User;
|
|||||||
* partner.
|
* partner.
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
public class ChosenInlineQuery implements BotApiObject {
|
public class ChosenInlineQuery implements BotApiObject {
|
||||||
private static final String RESULTID_FIELD = "result_id";
|
private static final String RESULTID_FIELD = "result_id";
|
||||||
@ -26,8 +31,10 @@ public class ChosenInlineQuery implements BotApiObject {
|
|||||||
private static final String QUERY_FIELD = "query";
|
private static final String QUERY_FIELD = "query";
|
||||||
|
|
||||||
@JsonProperty(RESULTID_FIELD)
|
@JsonProperty(RESULTID_FIELD)
|
||||||
|
@NonNull
|
||||||
private String resultId; ///< The unique identifier for the result that was chosen.
|
private String resultId; ///< The unique identifier for the result that was chosen.
|
||||||
@JsonProperty(FROM_FIELD)
|
@JsonProperty(FROM_FIELD)
|
||||||
|
@NonNull
|
||||||
private User from; ///< The user that chose the result.
|
private User from; ///< The user that chose the result.
|
||||||
@JsonProperty(LOCATION_FIELD)
|
@JsonProperty(LOCATION_FIELD)
|
||||||
private Location location; ///< Optional. Sender location, only for bots that require user location
|
private Location location; ///< Optional. Sender location, only for bots that require user location
|
||||||
@ -40,5 +47,6 @@ public class ChosenInlineQuery implements BotApiObject {
|
|||||||
@JsonProperty(INLINE_MESSAGE_ID_FIELD)
|
@JsonProperty(INLINE_MESSAGE_ID_FIELD)
|
||||||
private String inlineMessageId;
|
private String inlineMessageId;
|
||||||
@JsonProperty(QUERY_FIELD)
|
@JsonProperty(QUERY_FIELD)
|
||||||
|
@NonNull
|
||||||
private String query; ///< The query that was used to obtain the result.
|
private String query; ///< The query that was used to obtain the result.
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,12 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
import org.telegram.telegrambots.meta.api.objects.Location;
|
import org.telegram.telegrambots.meta.api.objects.Location;
|
||||||
import org.telegram.telegrambots.meta.api.objects.User;
|
import org.telegram.telegrambots.meta.api.objects.User;
|
||||||
@ -16,7 +19,9 @@ import org.telegram.telegrambots.meta.api.objects.User;
|
|||||||
* bot could return some default or trending results.
|
* bot could return some default or trending results.
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
public class InlineQuery implements BotApiObject {
|
public class InlineQuery implements BotApiObject {
|
||||||
private static final String ID_FIELD = "id";
|
private static final String ID_FIELD = "id";
|
||||||
@ -26,14 +31,18 @@ public class InlineQuery implements BotApiObject {
|
|||||||
private static final String OFFSET_FIELD = "offset";
|
private static final String OFFSET_FIELD = "offset";
|
||||||
|
|
||||||
@JsonProperty(ID_FIELD)
|
@JsonProperty(ID_FIELD)
|
||||||
|
@NonNull
|
||||||
private String id; ///< Unique identifier for this query
|
private String id; ///< Unique identifier for this query
|
||||||
@JsonProperty(FROM_FIELD)
|
@JsonProperty(FROM_FIELD)
|
||||||
|
@NonNull
|
||||||
private User from; ///< Sender
|
private User from; ///< Sender
|
||||||
@JsonProperty(LOCATION_FIELD)
|
@JsonProperty(LOCATION_FIELD)
|
||||||
private Location location; ///< Optional. Sender location, only for bots that request user location
|
private Location location; ///< Optional. Sender location, only for bots that request user location
|
||||||
@JsonProperty(QUERY_FIELD)
|
@JsonProperty(QUERY_FIELD)
|
||||||
|
@NonNull
|
||||||
private String query; ///< Text of the query
|
private String query; ///< Text of the query
|
||||||
@JsonProperty(OFFSET_FIELD)
|
@JsonProperty(OFFSET_FIELD)
|
||||||
|
@NonNull
|
||||||
private String offset; ///< Offset of the results to be returned, can be controlled by the bot
|
private String offset; ///< Offset of the results to be returned, can be controlled by the bot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import lombok.Builder;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,6 +19,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
|||||||
*/
|
*/
|
||||||
@JsonDeserialize
|
@JsonDeserialize
|
||||||
@Data
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
|
@ -7,6 +7,7 @@ import lombok.Builder;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,6 +19,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
|||||||
*/
|
*/
|
||||||
@JsonDeserialize
|
@JsonDeserialize
|
||||||
@Data
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
|
@ -7,6 +7,7 @@ import lombok.Builder;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -16,6 +17,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
|||||||
*/
|
*/
|
||||||
@JsonDeserialize
|
@JsonDeserialize
|
||||||
@Data
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
|
@ -8,6 +8,7 @@ import lombok.Builder;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,6 +20,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
|||||||
*/
|
*/
|
||||||
@JsonDeserialize
|
@JsonDeserialize
|
||||||
@Data
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
|
@ -3,6 +3,12 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result;
|
|||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
|
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
|
||||||
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
|
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
|
||||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||||
@ -15,6 +21,11 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
|||||||
* specified content instead of the photo.
|
* specified content instead of the photo.
|
||||||
*/
|
*/
|
||||||
@JsonDeserialize
|
@JsonDeserialize
|
||||||
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
public class InlineQueryResultPhoto implements InlineQueryResult {
|
public class InlineQueryResultPhoto implements InlineQueryResult {
|
||||||
private static final String TYPE_FIELD = "type";
|
private static final String TYPE_FIELD = "type";
|
||||||
private static final String ID_FIELD = "id";
|
private static final String ID_FIELD = "id";
|
||||||
@ -33,8 +44,10 @@ public class InlineQueryResultPhoto implements InlineQueryResult {
|
|||||||
@JsonProperty(TYPE_FIELD)
|
@JsonProperty(TYPE_FIELD)
|
||||||
private final String type = "photo"; ///< Type of the result, must be “photo”
|
private final String type = "photo"; ///< Type of the result, must be “photo”
|
||||||
@JsonProperty(ID_FIELD)
|
@JsonProperty(ID_FIELD)
|
||||||
|
@NonNull
|
||||||
private String id; ///< Unique identifier of this result, 1-64 bytes
|
private String id; ///< Unique identifier of this result, 1-64 bytes
|
||||||
@JsonProperty(PHOTOURL_FIELD)
|
@JsonProperty(PHOTOURL_FIELD)
|
||||||
|
@NonNull
|
||||||
private String photoUrl; ///< A valid URL of the photo. Photo size must not exceed 5MB
|
private String photoUrl; ///< A valid URL of the photo. Photo size must not exceed 5MB
|
||||||
@JsonProperty(MIMETYPE_FIELD)
|
@JsonProperty(MIMETYPE_FIELD)
|
||||||
private String mimeType; ///< Optional. MIME type of the photo, defaults to image/jpeg
|
private String mimeType; ///< Optional. MIME type of the photo, defaults to image/jpeg
|
||||||
@ -57,122 +70,6 @@ public class InlineQueryResultPhoto implements InlineQueryResult {
|
|||||||
@JsonProperty(PARSEMODE_FIELD)
|
@JsonProperty(PARSEMODE_FIELD)
|
||||||
private String parseMode; ///< Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
|
private String parseMode; ///< Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
|
||||||
|
|
||||||
public InlineQueryResultPhoto() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InlineQueryResultPhoto setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPhotoUrl() {
|
|
||||||
return photoUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InlineQueryResultPhoto setPhotoUrl(String photoUrl) {
|
|
||||||
this.photoUrl = photoUrl;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMimeType() {
|
|
||||||
return mimeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InlineQueryResultPhoto setMimeType(String mimeType) {
|
|
||||||
this.mimeType = mimeType;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPhotoWidth() {
|
|
||||||
return photoWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InlineQueryResultPhoto setPhotoWidth(Integer photoWidth) {
|
|
||||||
this.photoWidth = photoWidth;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPhotoHeight() {
|
|
||||||
return photoHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InlineQueryResultPhoto setPhotoHeight(Integer photoHeight) {
|
|
||||||
this.photoHeight = photoHeight;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getThumbUrl() {
|
|
||||||
return thumbUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InlineQueryResultPhoto setThumbUrl(String thumbUrl) {
|
|
||||||
this.thumbUrl = thumbUrl;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InlineQueryResultPhoto setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InlineQueryResultPhoto setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCaption() {
|
|
||||||
return caption;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InlineQueryResultPhoto setCaption(String caption) {
|
|
||||||
this.caption = caption;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InputMessageContent getInputMessageContent() {
|
|
||||||
return inputMessageContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InlineQueryResultPhoto setInputMessageContent(InputMessageContent inputMessageContent) {
|
|
||||||
this.inputMessageContent = inputMessageContent;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InlineKeyboardMarkup getReplyMarkup() {
|
|
||||||
return replyMarkup;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InlineQueryResultPhoto setReplyMarkup(InlineKeyboardMarkup replyMarkup) {
|
|
||||||
this.replyMarkup = replyMarkup;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getParseMode() {
|
|
||||||
return parseMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InlineQueryResultPhoto setParseMode(String parseMode) {
|
|
||||||
this.parseMode = parseMode;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate() throws TelegramApiValidationException {
|
public void validate() throws TelegramApiValidationException {
|
||||||
if (id == null || id.isEmpty()) {
|
if (id == null || id.isEmpty()) {
|
||||||
@ -188,23 +85,4 @@ public class InlineQueryResultPhoto implements InlineQueryResult {
|
|||||||
replyMarkup.validate();
|
replyMarkup.validate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "InlineQueryResultPhoto{" +
|
|
||||||
"type='" + type + '\'' +
|
|
||||||
", id='" + id + '\'' +
|
|
||||||
", photoUrl='" + photoUrl + '\'' +
|
|
||||||
", mimeType='" + mimeType + '\'' +
|
|
||||||
", photoWidth=" + photoWidth +
|
|
||||||
", photoHeight=" + photoHeight +
|
|
||||||
", thumbUrl='" + thumbUrl + '\'' +
|
|
||||||
", title='" + title + '\'' +
|
|
||||||
", description='" + description + '\'' +
|
|
||||||
", caption='" + caption + '\'' +
|
|
||||||
", inputMessageContent=" + inputMessageContent +
|
|
||||||
", replyMarkup=" + replyMarkup +
|
|
||||||
", parseMode='" + parseMode + '\'' +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package org.telegram.telegrambots.meta.test;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
|
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
|
||||||
@ -183,8 +182,8 @@ class TestDeserialization {
|
|||||||
assertEquals("offset", inlineQuery.getOffset());
|
assertEquals("offset", inlineQuery.getOffset());
|
||||||
assertFromUser(inlineQuery.getFrom());
|
assertFromUser(inlineQuery.getFrom());
|
||||||
assertNotNull(inlineQuery.getLocation());
|
assertNotNull(inlineQuery.getLocation());
|
||||||
assertEquals(Float.valueOf("0.234242534"), inlineQuery.getLocation().getLatitude());
|
assertEquals(0.234242534, inlineQuery.getLocation().getLatitude());
|
||||||
assertEquals(Float.valueOf("0.234242534"), inlineQuery.getLocation().getLongitude());
|
assertEquals(0.234242534, inlineQuery.getLocation().getLongitude());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertCallbackQuery(CallbackQuery callbackQuery) {
|
private void assertCallbackQuery(CallbackQuery callbackQuery) {
|
||||||
|
@ -18,11 +18,25 @@ import org.telegram.telegrambots.meta.api.methods.groupadministration.GetChatMem
|
|||||||
import org.telegram.telegrambots.meta.api.methods.groupadministration.KickChatMember;
|
import org.telegram.telegrambots.meta.api.methods.groupadministration.KickChatMember;
|
||||||
import org.telegram.telegrambots.meta.api.methods.groupadministration.LeaveChat;
|
import org.telegram.telegrambots.meta.api.methods.groupadministration.LeaveChat;
|
||||||
import org.telegram.telegrambots.meta.api.methods.groupadministration.UnbanChatMember;
|
import org.telegram.telegrambots.meta.api.methods.groupadministration.UnbanChatMember;
|
||||||
import org.telegram.telegrambots.meta.api.methods.send.*;
|
import org.telegram.telegrambots.meta.api.methods.send.SendChatAction;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.send.SendContact;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.send.SendGame;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.send.SendInvoice;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.send.SendLocation;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.send.SendVenue;
|
||||||
import org.telegram.telegrambots.meta.api.methods.updates.GetWebhookInfo;
|
import org.telegram.telegrambots.meta.api.methods.updates.GetWebhookInfo;
|
||||||
import org.telegram.telegrambots.meta.api.methods.updatingmessages.EditMessageCaption;
|
import org.telegram.telegrambots.meta.api.methods.updatingmessages.EditMessageCaption;
|
||||||
import org.telegram.telegrambots.meta.api.methods.updatingmessages.EditMessageReplyMarkup;
|
import org.telegram.telegrambots.meta.api.methods.updatingmessages.EditMessageReplyMarkup;
|
||||||
import org.telegram.telegrambots.meta.api.methods.updatingmessages.EditMessageText;
|
import org.telegram.telegrambots.meta.api.methods.updatingmessages.EditMessageText;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.Chat;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.ChatMember;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.File;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.Message;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.User;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.UserProfilePhotos;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.WebhookInfo;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.games.GameHighScore;
|
||||||
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
|
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
|
||||||
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputTextMessageContent;
|
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputTextMessageContent;
|
||||||
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult;
|
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult;
|
||||||
@ -37,6 +51,7 @@ import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.InlineKe
|
|||||||
import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.KeyboardButton;
|
import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.KeyboardButton;
|
||||||
import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.KeyboardRow;
|
import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.KeyboardRow;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -48,7 +63,7 @@ public final class BotApiMethodHelperFactory {
|
|||||||
private BotApiMethodHelperFactory() {
|
private BotApiMethodHelperFactory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getSendMessage() {
|
public static BotApiMethod<Message> getSendMessage() {
|
||||||
return new SendMessage()
|
return new SendMessage()
|
||||||
.setChatId("@test")
|
.setChatId("@test")
|
||||||
.setText("Hithere")
|
.setText("Hithere")
|
||||||
@ -57,14 +72,14 @@ public final class BotApiMethodHelperFactory {
|
|||||||
.setReplyMarkup(new ForceReplyKeyboard());
|
.setReplyMarkup(new ForceReplyKeyboard());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getAnswerCallbackQuery() {
|
public static BotApiMethod<Boolean> getAnswerCallbackQuery() {
|
||||||
return new AnswerCallbackQuery()
|
return new AnswerCallbackQuery()
|
||||||
.setCallbackQueryId("id")
|
.setCallbackQueryId("id")
|
||||||
.setText("text")
|
.setText("text")
|
||||||
.setShowAlert(true);
|
.setShowAlert(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getAnswerInlineQuery() {
|
public static BotApiMethod<Boolean> getAnswerInlineQuery() {
|
||||||
return new AnswerInlineQuery()
|
return new AnswerInlineQuery()
|
||||||
.setInlineQueryId("id")
|
.setInlineQueryId("id")
|
||||||
.setPersonal(true)
|
.setPersonal(true)
|
||||||
@ -75,7 +90,7 @@ public final class BotApiMethodHelperFactory {
|
|||||||
.setSwitchPmText("pmText");
|
.setSwitchPmText("pmText");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getEditMessageCaption() {
|
public static BotApiMethod<Serializable> getEditMessageCaption() {
|
||||||
return new EditMessageCaption()
|
return new EditMessageCaption()
|
||||||
.setChatId("ChatId")
|
.setChatId("ChatId")
|
||||||
.setMessageId(1)
|
.setMessageId(1)
|
||||||
@ -84,7 +99,7 @@ public final class BotApiMethodHelperFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static BotApiMethod getEditMessageText() {
|
public static BotApiMethod<Serializable> getEditMessageText() {
|
||||||
return new EditMessageText()
|
return new EditMessageText()
|
||||||
.setChatId("ChatId")
|
.setChatId("ChatId")
|
||||||
.setMessageId(1)
|
.setMessageId(1)
|
||||||
@ -93,13 +108,13 @@ public final class BotApiMethodHelperFactory {
|
|||||||
.setReplyMarkup(getInlineKeyboardMarkup());
|
.setReplyMarkup(getInlineKeyboardMarkup());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getEditMessageReplyMarkup() {
|
public static BotApiMethod<Serializable> getEditMessageReplyMarkup() {
|
||||||
return new EditMessageReplyMarkup()
|
return new EditMessageReplyMarkup()
|
||||||
.setInlineMessageId("12345")
|
.setInlineMessageId("12345")
|
||||||
.setReplyMarkup(getInlineKeyboardMarkup());
|
.setReplyMarkup(getInlineKeyboardMarkup());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getForwardMessage() {
|
public static BotApiMethod<Message> getForwardMessage() {
|
||||||
return new ForwardMessage(54L, 123L, 55)
|
return new ForwardMessage(54L, 123L, 55)
|
||||||
.setFromChatId("From")
|
.setFromChatId("From")
|
||||||
.setChatId("To")
|
.setChatId("To")
|
||||||
@ -107,72 +122,72 @@ public final class BotApiMethodHelperFactory {
|
|||||||
.disableNotification();
|
.disableNotification();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getGetChat() {
|
public static BotApiMethod<Chat> getGetChat() {
|
||||||
return new GetChat()
|
return new GetChat()
|
||||||
.setChatId("12345");
|
.setChatId("12345");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getChatAdministrators() {
|
public static BotApiMethod<ArrayList<ChatMember>> getChatAdministrators() {
|
||||||
return new GetChatAdministrators()
|
return new GetChatAdministrators()
|
||||||
.setChatId("12345");
|
.setChatId("12345");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getChatMember() {
|
public static BotApiMethod<ChatMember> getChatMember() {
|
||||||
return new GetChatMember()
|
return new GetChatMember()
|
||||||
.setChatId("12345")
|
.setChatId("12345")
|
||||||
.setUserId(98765);
|
.setUserId(98765);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getChatMembersCount() {
|
public static BotApiMethod<Integer> getChatMembersCount() {
|
||||||
return new GetChatMembersCount()
|
return new GetChatMembersCount()
|
||||||
.setChatId("12345");
|
.setChatId("12345");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getGetFile() {
|
public static BotApiMethod<File> getGetFile() {
|
||||||
return new GetFile()
|
return new GetFile()
|
||||||
.setFileId("FileId");
|
.setFileId("FileId");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getGetGameHighScores() {
|
public static BotApiMethod<ArrayList<GameHighScore>> getGetGameHighScores() {
|
||||||
return new GetGameHighScores()
|
return new GetGameHighScores()
|
||||||
.setChatId("12345")
|
.setChatId("12345")
|
||||||
.setMessageId(67890)
|
.setMessageId(67890)
|
||||||
.setUserId(98765);
|
.setUserId(98765);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getGetMe() {
|
public static BotApiMethod<User> getGetMe() {
|
||||||
return new GetMe();
|
return new GetMe();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getGetUserProfilePhotos() {
|
public static BotApiMethod<UserProfilePhotos> getGetUserProfilePhotos() {
|
||||||
return new GetUserProfilePhotos()
|
return new GetUserProfilePhotos()
|
||||||
.setUserId(98765)
|
.setUserId(98765)
|
||||||
.setLimit(10)
|
.setLimit(10)
|
||||||
.setOffset(3);
|
.setOffset(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getGetWebhookInfo() {
|
public static BotApiMethod<WebhookInfo> getGetWebhookInfo() {
|
||||||
return new GetWebhookInfo();
|
return new GetWebhookInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getKickChatMember() {
|
public static BotApiMethod<Boolean> getKickChatMember() {
|
||||||
return new KickChatMember()
|
return new KickChatMember()
|
||||||
.setChatId("12345")
|
.setChatId("12345")
|
||||||
.setUserId(98765);
|
.setUserId(98765);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getLeaveChat() {
|
public static BotApiMethod<Boolean> getLeaveChat() {
|
||||||
return new LeaveChat()
|
return new LeaveChat()
|
||||||
.setChatId("12345");
|
.setChatId("12345");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getSendChatAction() {
|
public static BotApiMethod<Boolean> getSendChatAction() {
|
||||||
return new SendChatAction()
|
return new SendChatAction()
|
||||||
.setChatId("12345")
|
.setChatId("12345")
|
||||||
.setAction(ActionType.RECORDVIDEO);
|
.setAction(ActionType.RECORDVIDEO);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getSendContact() {
|
public static BotApiMethod<Message> getSendContact() {
|
||||||
return new SendContact()
|
return new SendContact()
|
||||||
.setChatId("12345")
|
.setChatId("12345")
|
||||||
.setFirstName("First Name")
|
.setFirstName("First Name")
|
||||||
@ -213,24 +228,28 @@ public final class BotApiMethodHelperFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static InlineQueryResult getInlineQueryResultPhoto() {
|
private static InlineQueryResult getInlineQueryResultPhoto() {
|
||||||
return new InlineQueryResultPhoto()
|
return InlineQueryResultPhoto
|
||||||
.setId("1")
|
.builder()
|
||||||
.setPhotoUrl("PhotoUrl")
|
.id("1")
|
||||||
.setPhotoWidth(10)
|
.photoUrl("PhotoUrl")
|
||||||
.setPhotoHeight(20)
|
.photoWidth(10)
|
||||||
.setMimeType("image/jpg")
|
.photoHeight(20)
|
||||||
.setThumbUrl("ThumbUrl")
|
.mimeType("image/jpg")
|
||||||
.setTitle("Title")
|
.thumbUrl("ThumbUrl")
|
||||||
.setDescription("Description")
|
.title("Title")
|
||||||
.setCaption("Caption")
|
.description("Description")
|
||||||
.setInputMessageContent(getInputMessageContent())
|
.caption("Caption")
|
||||||
.setReplyMarkup(getInlineKeyboardMarkup());
|
.inputMessageContent(getInputMessageContent())
|
||||||
|
.replyMarkup(getInlineKeyboardMarkup())
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static InputMessageContent getInputMessageContent() {
|
private static InputMessageContent getInputMessageContent() {
|
||||||
return new InputTextMessageContent()
|
return InputTextMessageContent
|
||||||
.setMessageText("Text")
|
.builder()
|
||||||
.setParseMode(ParseMode.MARKDOWN);
|
.messageText("Text")
|
||||||
|
.parseMode(ParseMode.MARKDOWN)
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static InlineKeyboardMarkup getInlineKeyboardMarkup() {
|
private static InlineKeyboardMarkup getInlineKeyboardMarkup() {
|
||||||
@ -245,13 +264,13 @@ public final class BotApiMethodHelperFactory {
|
|||||||
.setKeyboard(keyboard);
|
.setKeyboard(keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getSendGame() {
|
public static BotApiMethod<Message> getSendGame() {
|
||||||
return new SendGame()
|
return new SendGame()
|
||||||
.setChatId("12345")
|
.setChatId("12345")
|
||||||
.setGameShortName("MyGame");
|
.setGameShortName("MyGame");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getSendLocation() {
|
public static BotApiMethod<Message> getSendLocation() {
|
||||||
return new SendLocation()
|
return new SendLocation()
|
||||||
.setChatId("12345")
|
.setChatId("12345")
|
||||||
.setLatitude(12.5F)
|
.setLatitude(12.5F)
|
||||||
@ -259,7 +278,7 @@ public final class BotApiMethodHelperFactory {
|
|||||||
.setReplyToMessageId(53);
|
.setReplyToMessageId(53);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getSendVenue() {
|
public static BotApiMethod<Message> getSendVenue() {
|
||||||
return new SendVenue()
|
return new SendVenue()
|
||||||
.setChatId("12345")
|
.setChatId("12345")
|
||||||
.setLatitude(12.5F)
|
.setLatitude(12.5F)
|
||||||
@ -270,7 +289,7 @@ public final class BotApiMethodHelperFactory {
|
|||||||
.setFoursquareId("FourId");
|
.setFoursquareId("FourId");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getSetGameScore() {
|
public static BotApiMethod<Serializable> getSetGameScore() {
|
||||||
return new SetGameScore()
|
return new SetGameScore()
|
||||||
.setInlineMessageId("12345")
|
.setInlineMessageId("12345")
|
||||||
.setDisableEditMessage(true)
|
.setDisableEditMessage(true)
|
||||||
@ -278,13 +297,13 @@ public final class BotApiMethodHelperFactory {
|
|||||||
.setUserId(98765);
|
.setUserId(98765);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getUnbanChatMember() {
|
public static BotApiMethod<Boolean> getUnbanChatMember() {
|
||||||
return new UnbanChatMember()
|
return new UnbanChatMember()
|
||||||
.setChatId("12345")
|
.setChatId("12345")
|
||||||
.setUserId(98765);
|
.setUserId(98765);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotApiMethod getSendInvoice() {
|
public static BotApiMethod<Message> getSendInvoice() {
|
||||||
List<LabeledPrice> prices = new ArrayList<>();
|
List<LabeledPrice> prices = new ArrayList<>();
|
||||||
prices.add(new LabeledPrice("LABEL", 1000));
|
prices.add(new LabeledPrice("LABEL", 1000));
|
||||||
|
|
||||||
|
@ -7,16 +7,42 @@ import org.glassfish.jersey.server.ResourceConfig;
|
|||||||
import org.glassfish.jersey.test.JerseyTest;
|
import org.glassfish.jersey.test.JerseyTest;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.telegram.telegrambots.meta.api.methods.*;
|
import org.telegram.telegrambots.meta.api.methods.AnswerCallbackQuery;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.AnswerInlineQuery;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.ForwardMessage;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.GetFile;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.GetMe;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.GetUserProfilePhotos;
|
||||||
import org.telegram.telegrambots.meta.api.methods.games.GetGameHighScores;
|
import org.telegram.telegrambots.meta.api.methods.games.GetGameHighScores;
|
||||||
import org.telegram.telegrambots.meta.api.methods.games.SetGameScore;
|
import org.telegram.telegrambots.meta.api.methods.games.SetGameScore;
|
||||||
import org.telegram.telegrambots.meta.api.methods.groupadministration.*;
|
import org.telegram.telegrambots.meta.api.methods.groupadministration.GetChat;
|
||||||
import org.telegram.telegrambots.meta.api.methods.send.*;
|
import org.telegram.telegrambots.meta.api.methods.groupadministration.GetChatAdministrators;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.groupadministration.GetChatMember;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.groupadministration.GetChatMembersCount;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.groupadministration.KickChatMember;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.groupadministration.LeaveChat;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.groupadministration.UnbanChatMember;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.send.SendChatAction;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.send.SendContact;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.send.SendGame;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.send.SendInvoice;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.send.SendLocation;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.send.SendVenue;
|
||||||
import org.telegram.telegrambots.meta.api.methods.updates.GetWebhookInfo;
|
import org.telegram.telegrambots.meta.api.methods.updates.GetWebhookInfo;
|
||||||
import org.telegram.telegrambots.meta.api.methods.updatingmessages.EditMessageCaption;
|
import org.telegram.telegrambots.meta.api.methods.updatingmessages.EditMessageCaption;
|
||||||
import org.telegram.telegrambots.meta.api.methods.updatingmessages.EditMessageReplyMarkup;
|
import org.telegram.telegrambots.meta.api.methods.updatingmessages.EditMessageReplyMarkup;
|
||||||
import org.telegram.telegrambots.meta.api.methods.updatingmessages.EditMessageText;
|
import org.telegram.telegrambots.meta.api.methods.updatingmessages.EditMessageText;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.Chat;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.ChatMember;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.File;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.Message;
|
||||||
import org.telegram.telegrambots.meta.api.objects.Update;
|
import org.telegram.telegrambots.meta.api.objects.Update;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.User;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.UserProfilePhotos;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.WebhookInfo;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.games.GameHighScore;
|
||||||
import org.telegram.telegrambots.test.Fakes.FakeWebhook;
|
import org.telegram.telegrambots.test.Fakes.FakeWebhook;
|
||||||
import org.telegram.telegrambots.updatesreceivers.RestApi;
|
import org.telegram.telegrambots.updatesreceivers.RestApi;
|
||||||
|
|
||||||
@ -24,6 +50,8 @@ import javax.ws.rs.client.Entity;
|
|||||||
import javax.ws.rs.core.Application;
|
import javax.ws.rs.core.Application;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
@ -55,7 +83,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getSendMessage());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getSendMessage());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Message> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, SendMessage.class);
|
.post(entity, SendMessage.class);
|
||||||
@ -67,7 +95,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getAnswerCallbackQuery());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getAnswerCallbackQuery());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Boolean> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, AnswerCallbackQuery.class);
|
.post(entity, AnswerCallbackQuery.class);
|
||||||
@ -80,7 +108,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getAnswerInlineQuery());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getAnswerInlineQuery());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Boolean> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, AnswerInlineQuery.class);
|
.post(entity, AnswerInlineQuery.class);
|
||||||
@ -93,7 +121,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getEditMessageCaption());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getEditMessageCaption());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Serializable> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, EditMessageCaption.class);
|
.post(entity, EditMessageCaption.class);
|
||||||
@ -109,7 +137,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getEditMessageReplyMarkup());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getEditMessageReplyMarkup());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Serializable> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, EditMessageReplyMarkup.class);
|
.post(entity, EditMessageReplyMarkup.class);
|
||||||
@ -125,7 +153,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getEditMessageText());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getEditMessageText());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Serializable> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, EditMessageText.class);
|
.post(entity, EditMessageText.class);
|
||||||
@ -141,7 +169,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getForwardMessage());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getForwardMessage());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Message> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, ForwardMessage.class);
|
.post(entity, ForwardMessage.class);
|
||||||
@ -155,7 +183,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getGetChat());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getGetChat());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Chat> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, GetChat.class);
|
.post(entity, GetChat.class);
|
||||||
@ -168,7 +196,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getChatAdministrators());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getChatAdministrators());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<ArrayList<ChatMember>> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, GetChatAdministrators.class);
|
.post(entity, GetChatAdministrators.class);
|
||||||
@ -181,7 +209,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getChatMember());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getChatMember());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<ChatMember> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, GetChatMember.class);
|
.post(entity, GetChatMember.class);
|
||||||
@ -194,7 +222,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getChatMembersCount());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getChatMembersCount());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Integer> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, GetChatMembersCount.class);
|
.post(entity, GetChatMembersCount.class);
|
||||||
@ -207,7 +235,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getGetFile());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getGetFile());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<File> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, GetFile.class);
|
.post(entity, GetFile.class);
|
||||||
@ -220,7 +248,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getGetGameHighScores());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getGetGameHighScores());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<ArrayList<GameHighScore>> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, GetGameHighScores.class);
|
.post(entity, GetGameHighScores.class);
|
||||||
@ -233,7 +261,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getGetMe());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getGetMe());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<User> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, GetMe.class);
|
.post(entity, GetMe.class);
|
||||||
@ -246,7 +274,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getGetUserProfilePhotos());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getGetUserProfilePhotos());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<UserProfilePhotos> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, GetUserProfilePhotos.class);
|
.post(entity, GetUserProfilePhotos.class);
|
||||||
@ -259,7 +287,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getGetWebhookInfo());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getGetWebhookInfo());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<WebhookInfo> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, GetWebhookInfo.class);
|
.post(entity, GetWebhookInfo.class);
|
||||||
@ -272,7 +300,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getKickChatMember());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getKickChatMember());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Boolean> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, KickChatMember.class);
|
.post(entity, KickChatMember.class);
|
||||||
@ -285,7 +313,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getLeaveChat());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getLeaveChat());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Boolean> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, LeaveChat.class);
|
.post(entity, LeaveChat.class);
|
||||||
@ -298,7 +326,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getSendChatAction());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getSendChatAction());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Boolean> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, SendChatAction.class);
|
.post(entity, SendChatAction.class);
|
||||||
@ -311,7 +339,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getSendContact());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getSendContact());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Message> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, SendContact.class);
|
.post(entity, SendContact.class);
|
||||||
@ -324,7 +352,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getSendGame());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getSendGame());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Message> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, SendGame.class);
|
.post(entity, SendGame.class);
|
||||||
@ -337,7 +365,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getSendLocation());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getSendLocation());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Message> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, SendLocation.class);
|
.post(entity, SendLocation.class);
|
||||||
@ -350,7 +378,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getSendVenue());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getSendVenue());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Message> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, SendVenue.class);
|
.post(entity, SendVenue.class);
|
||||||
@ -363,7 +391,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getSetGameScore());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getSetGameScore());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Serializable> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, SetGameScore.class);
|
.post(entity, SetGameScore.class);
|
||||||
@ -376,7 +404,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getUnbanChatMember());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getUnbanChatMember());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Boolean> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, UnbanChatMember.class);
|
.post(entity, UnbanChatMember.class);
|
||||||
@ -389,7 +417,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
webhookBot.setReturnValue(BotApiMethodHelperFactory.getSendInvoice());
|
webhookBot.setReturnValue(BotApiMethodHelperFactory.getSendInvoice());
|
||||||
|
|
||||||
Entity<Update> entity = Entity.json(getUpdate());
|
Entity<Update> entity = Entity.json(getUpdate());
|
||||||
BotApiMethod result =
|
BotApiMethod<Message> result =
|
||||||
target("callback/testbot")
|
target("callback/testbot")
|
||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.post(entity, SendInvoice.class);
|
.post(entity, SendInvoice.class);
|
||||||
@ -409,7 +437,7 @@ public class TestRestApi extends JerseyTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String map(BotApiMethod method) {
|
private <T extends Serializable> String map(BotApiMethod<T> method) {
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
try {
|
try {
|
||||||
return mapper.writeValueAsString(method);
|
return mapper.writeValueAsString(method);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user