Merge remote-tracking branch 'github/master'

This commit is contained in:
Andrea Cavalli 2022-11-15 17:28:05 +01:00
commit 7d2abecd88
100 changed files with 2386 additions and 422 deletions

View File

@ -27,18 +27,18 @@ Just import add the library to your project with one of these options:
<dependency> <dependency>
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId> <artifactId>telegrambots</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</dependency> </dependency>
``` ```
2. Using Gradle: 2. Using Gradle:
```gradle ```gradle
implementation 'org.telegram:telegrambots:6.1.0' implementation 'org.telegram:telegrambots:6.3.0'
``` ```
3. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/6.1.0) 3. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/6.3.0)
4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/6.1.0) 4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/6.3.0)
In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`. In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.

View File

@ -1,3 +1,7 @@
### <a id="6.3.0"></a>6.3.0 ###
1. Update Api version [6.3](https://core.telegram.org/bots/api-changelog#November-5-2022)
2. Bug fixing: #1116
### <a id="6.1.0"></a>6.1.0 ### ### <a id="6.1.0"></a>6.1.0 ###
1. Update Api version [6.1](https://core.telegram.org/bots/api-changelog#june-20-2022) 1. Update Api version [6.1](https://core.telegram.org/bots/api-changelog#june-20-2022)
2. Add support for Long when setting the chatId: #1065 2. Add support for Long when setting the chatId: #1065

View File

@ -11,13 +11,13 @@ First you need to acquire the library and add it to your project. There are seve
<dependency> <dependency>
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId> <artifactId>telegrambots</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</dependency> </dependency>
``` ```
* With **Gradle**: * With **Gradle**:
```gradle ```gradle
implementation 'org.telegram:telegrambots:6.1.0' implementation 'org.telegram:telegrambots:6.3.0'
``` ```
2. Don't like the **Maven Central Repository**? It can also be grabbed from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots). 2. Don't like the **Maven Central Repository**? It can also be grabbed from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots).

View File

@ -9,12 +9,12 @@ As with any Java project, you will need to set your dependencies.
<dependency> <dependency>
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId> <artifactId>telegrambots-abilities</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</dependency> </dependency>
``` ```
* **Gradle** * **Gradle**
```gradle ```gradle
implementation 'org.telegram:telegrambots-abilities:6.1.0' implementation 'org.telegram:telegrambots-abilities:6.3.0'
``` ```
* [JitPack](https://jitpack.io/#rubenlagus/TelegramBots) * [JitPack](https://jitpack.io/#rubenlagus/TelegramBots)

16
pom.xml
View File

@ -7,7 +7,7 @@
<groupId>org.warp</groupId> <groupId>org.warp</groupId>
<artifactId>Bots</artifactId> <artifactId>Bots</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>6.1.0</version> <version>6.3.0</version>
<modules> <modules>
<module>telegrambots</module> <module>telegrambots</module>
@ -69,13 +69,13 @@
<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.9.0</junit.version> <junit.version>5.9.1</junit.version>
<mockito.version>4.7.0</mockito.version> <mockito.version>4.8.1</mockito.version>
<mockitojupiter.version>4.7.0</mockitojupiter.version> <mockitojupiter.version>4.8.1</mockitojupiter.version>
<jacksonanotation.version>2.13.2</jacksonanotation.version> <jacksonanotation.version>2.14.0</jacksonanotation.version>
<jackson.version>2.13.2.2</jackson.version> <jackson.version>2.14.0</jackson.version>
<json.version>20220320</json.version> <json.version>20220924</json.version>
<slf4j.version>2.0.0</slf4j.version> <slf4j.version>2.0.3</slf4j.version>
<jakarta.annotation.version>2.1.1</jakarta.annotation.version> <jakarta.annotation.version>2.1.1</jakarta.annotation.version>
<lombok.version>1.18.24</lombok.version> <lombok.version>1.18.24</lombok.version>
<guava.version>31.1-jre</guava.version> <guava.version>31.1-jre</guava.version>

View File

@ -18,14 +18,14 @@ Usage
<dependency> <dependency>
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId> <artifactId>telegrambots-abilities</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</dependency> </dependency>
``` ```
**Gradle** **Gradle**
```gradle ```gradle
implementation 'org.telegram:telegrambots-abilities:6.1.0' implementation 'org.telegram:telegrambots-abilities:6.3.0'
``` ```
**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v5.0.1) **JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v5.0.1)

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.warp</groupId> <groupId>org.warp</groupId>
<artifactId>Bots</artifactId> <artifactId>Bots</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</parent> </parent>
<artifactId>telegrambots-abilities</artifactId> <artifactId>telegrambots-abilities</artifactId>
@ -86,7 +86,7 @@
<dependency> <dependency>
<groupId>org.warp</groupId> <groupId>org.warp</groupId>
<artifactId>telegrambots</artifactId> <artifactId>telegrambots</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>

View File

@ -15,14 +15,14 @@ Usage
<dependency> <dependency>
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>telegrambots-chat-session-bot</artifactId> <artifactId>telegrambots-chat-session-bot</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</dependency> </dependency>
``` ```
**Gradle** **Gradle**
```gradle ```gradle
implementation 'org.telegram:telegrambots-chat-session-bot:6.1.0' implementation 'org.telegram:telegrambots-chat-session-bot:6.3.0'
``` ```
Motivation Motivation

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.warp</groupId> <groupId>org.warp</groupId>
<artifactId>Bots</artifactId> <artifactId>Bots</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</parent> </parent>
<artifactId>telegrambots-chat-session-bot</artifactId> <artifactId>telegrambots-chat-session-bot</artifactId>
@ -78,7 +78,7 @@
<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>
<shiro.version>1.9.1</shiro.version> <shiro.version>1.10.0</shiro.version>
</properties> </properties>
<dependencies> <dependencies>
@ -86,7 +86,7 @@
<dependency> <dependency>
<groupId>org.warp</groupId> <groupId>org.warp</groupId>
<artifactId>telegrambots</artifactId> <artifactId>telegrambots</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-core --> <!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-core -->

View File

@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
<dependency> <dependency>
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>telegrambotsextensions</artifactId> <artifactId>telegrambotsextensions</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</dependency> </dependency>
``` ```
2. Using Gradle: 2. Using Gradle:
```gradle ```gradle
implementation 'org.telegram:telegrambotsextensions:6.1.0' implementation 'org.telegram:telegrambotsextensions:6.3.0'
``` ```

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.warp</groupId> <groupId>org.warp</groupId>
<artifactId>Bots</artifactId> <artifactId>Bots</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</parent> </parent>
<artifactId>telegrambotsextensions</artifactId> <artifactId>telegrambotsextensions</artifactId>
@ -77,7 +77,7 @@
<dependency> <dependency>
<groupId>org.warp</groupId> <groupId>org.warp</groupId>
<artifactId>telegrambots</artifactId> <artifactId>telegrambots</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.warp</groupId> <groupId>org.warp</groupId>
<artifactId>Bots</artifactId> <artifactId>Bots</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</parent> </parent>
<artifactId>telegrambots-meta</artifactId> <artifactId>telegrambots-meta</artifactId>

View File

@ -42,6 +42,7 @@ public class CopyMessage extends BotApiMethod<MessageId> {
public static final String PATH = "copyMessage"; public static final String PATH = "copyMessage";
private static final String CHATID_FIELD = "chat_id"; private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
private static final String FROMCHATID_FIELD = "from_chat_id"; private static final String FROMCHATID_FIELD = "from_chat_id";
private static final String MESSAGEID_FIELD = "message_id"; private static final String MESSAGEID_FIELD = "message_id";
private static final String CAPTION_FIELD = "caption"; private static final String CAPTION_FIELD = "caption";
@ -56,6 +57,12 @@ public class CopyMessage extends BotApiMethod<MessageId> {
@JsonProperty(CHATID_FIELD) @JsonProperty(CHATID_FIELD)
@NonNull @NonNull
private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername) private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
@JsonProperty(MESSAGETHREADID_FIELD)
private Integer messageThreadId;
@JsonProperty(FROMCHATID_FIELD) @JsonProperty(FROMCHATID_FIELD)
@NonNull @NonNull
private String fromChatId; ///< Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername) private String fromChatId; ///< Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)

View File

@ -34,6 +34,7 @@ public class ForwardMessage extends BotApiMethodMessage {
public static final String PATH = "forwardmessage"; public static final String PATH = "forwardmessage";
private static final String CHATID_FIELD = "chat_id"; private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
private static final String FROMCHATID_FIELD = "from_chat_id"; private static final String FROMCHATID_FIELD = "from_chat_id";
private static final String MESSAGEID_FIELD = "message_id"; private static final String MESSAGEID_FIELD = "message_id";
private static final String DISABLENOTIFICATION_FIELD = "disable_notification"; private static final String DISABLENOTIFICATION_FIELD = "disable_notification";
@ -42,6 +43,12 @@ public class ForwardMessage extends BotApiMethodMessage {
@JsonProperty(CHATID_FIELD) @JsonProperty(CHATID_FIELD)
@NonNull @NonNull
private String chatId; ///< Unique identifier for the chat to send the message to (or username for channels) private String chatId; ///< Unique identifier for the chat to send the message to (or username for channels)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
@JsonProperty(MESSAGETHREADID_FIELD)
private Integer messageThreadId;
@JsonProperty(FROMCHATID_FIELD) @JsonProperty(FROMCHATID_FIELD)
@NonNull @NonNull
private String fromChatId; ///< Unique identifier for the chat where the original message was sent User or GroupChat id private String fromChatId; ///< Unique identifier for the chat where the original message was sent User or GroupChat id

View File

@ -0,0 +1,80 @@
package org.telegram.telegrambots.meta.api.methods.forum;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBoolean;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/**
* @author Ruben Bermudez
* @version 6.3
* Use this method to close an open topic in a forum supergroup chat.
* The bot must be an administrator in the chat for this to work and must have
* the can_manage_topics administrator rights, unless it is the creator of the topic.
*
* Returns True on success.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CloseForumTopic extends BotApiMethodBoolean {
public static final String PATH = "closeForumTopic";
private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
/**
* Unique identifier for the target chat or username
* of the target supergroup (in the format @supergroupusername)
*/
@JsonProperty(CHATID_FIELD)
@NonNull
private String chatId;
/**
* Unique identifier for the target message thread of the forum topic
*/
@JsonProperty(MESSAGETHREADID_FIELD)
@NonNull
private Integer messageThreadId;
@Tolerate
public void setChatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
}
@Override
public void validate() throws TelegramApiValidationException {
if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
if (messageThreadId <= 0) {
throw new TelegramApiValidationException("Message Thread Id can't be empty", this);
}
}
@Override
public String getMethod() {
return PATH;
}
public static class CloseForumTopicBuilder {
@Tolerate
public CloseForumTopicBuilder chatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
return this;
}
}
}

View File

@ -0,0 +1,103 @@
package org.telegram.telegrambots.meta.api.methods.forum;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.forum.ForumTopic;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/**
* @author Ruben Bermudez
* @version 6.3
* Use this method to create a topic in a forum supergroup chat.
* The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights.
* Returns information about the created topic as a ForumTopic object.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@RequiredArgsConstructor
@AllArgsConstructor
@Builder
public class CreateForumTopic extends BotApiMethod<ForumTopic> {
public static final String PATH = "createForumTopic";
private static final String CHATID_FIELD = "chat_id";
private static final String NAME_FIELD = "name";
private static final String ICONCOLOR_FIELD = "icon_color";
private static final String ICONCUSTOMEMOJIID_FIELD = "icon_custom_emoji_id";
/**
* Unique identifier for the target chat or username
* of the target supergroup (in the format @supergroupusername)
*/
@JsonProperty(CHATID_FIELD)
@NonNull
private String chatId;
/**
* Topic name, 1-128 characters
*/
@JsonProperty(NAME_FIELD)
@NonNull
private String name;
/**
* Optional.
* Color of the topic icon in RGB format. Currently,
* must be one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F
*/
@JsonProperty(ICONCOLOR_FIELD)
private Integer iconColor;
/**
* Optional.
* Unique identifier of the custom emoji shown as the topic icon.
* Use getForumTopicIconStickers to get all allowed custom emoji identifiers
*/
@JsonProperty(ICONCUSTOMEMOJIID_FIELD)
private String iconCustomEmojiId;
@Tolerate
public void setChatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
}
@Override
public void validate() throws TelegramApiValidationException {
if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
if (name.isEmpty() || name.length() > 128) {
throw new TelegramApiValidationException("Name must be between 1 and 128 characters", this);
}
}
@Override
public String getMethod() {
return PATH;
}
@Override
public ForumTopic deserializeResponse(String answer) throws TelegramApiRequestException {
return deserializeResponse(answer, ForumTopic.class);
}
public static class CreateForumTopicBuilder {
@Tolerate
public CreateForumTopicBuilder chatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
return this;
}
}
}

View File

@ -0,0 +1,80 @@
package org.telegram.telegrambots.meta.api.methods.forum;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBoolean;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/**
* @author Ruben Bermudez
* @version 6.3
* Use this method to delete a forum topic along with all its messages in a
* forum supergroup chat. The bot must be an administrator in the chat
* for this to work and must have the can_delete_messages administrator rights.
*
* Returns True on success.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class DeleteForumTopic extends BotApiMethodBoolean {
public static final String PATH = "deleteForumTopic";
private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
/**
* Unique identifier for the target chat or username
* of the target supergroup (in the format @supergroupusername)
*/
@JsonProperty(CHATID_FIELD)
@NonNull
private String chatId;
/**
* Unique identifier for the target message thread of the forum topic
*/
@JsonProperty(MESSAGETHREADID_FIELD)
@NonNull
private Integer messageThreadId;
@Tolerate
public void setChatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
}
@Override
public void validate() throws TelegramApiValidationException {
if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
if (messageThreadId <= 0) {
throw new TelegramApiValidationException("Message Thread Id can't be empty", this);
}
}
@Override
public String getMethod() {
return PATH;
}
public static class DeleteForumTopicBuilder {
@Tolerate
public DeleteForumTopicBuilder chatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
return this;
}
}
}

View File

@ -0,0 +1,102 @@
package org.telegram.telegrambots.meta.api.methods.forum;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBoolean;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/**
* @author Ruben Bermudez
* @version 6.3
* Use this method to edit name and icon of a topic in a forum supergroup chat.
* The bot must be an administrator in the chat for this to work and must have
* can_manage_topics administrator rights, unless it is the creator of the topic.
*
* Returns True on success.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class EditForumTopic extends BotApiMethodBoolean {
public static final String PATH = "editForumTopic";
private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
private static final String NAME_FIELD = "name";
private static final String ICONCUSTOMEMOJIID_FIELD = "icon_custom_emoji_id";
/**
* Unique identifier for the target chat or username
* of the target supergroup (in the format @supergroupusername)
*/
@JsonProperty(CHATID_FIELD)
@NonNull
private String chatId;
/**
* Unique identifier for the target message thread of the forum topic
*/
@JsonProperty(MESSAGETHREADID_FIELD)
@NonNull
private Integer messageThreadId;
/**
* Topic name, 1-128 characters
*/
@JsonProperty(NAME_FIELD)
@NonNull
private String name;
/**
* Optional.
* Unique identifier of the custom emoji shown as the topic icon.
* Use getForumTopicIconStickers to get all allowed custom emoji identifiers
*/
@JsonProperty(ICONCUSTOMEMOJIID_FIELD)
@NonNull
private String iconCustomEmojiId;
@Tolerate
public void setChatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
}
@Override
public void validate() throws TelegramApiValidationException {
if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
if (name.isEmpty() || name.length() > 128) {
throw new TelegramApiValidationException("Name must be between 1 and 128 characters", this);
}
if (messageThreadId <= 0) {
throw new TelegramApiValidationException("Message Thread Id can't be empty", this);
}
if (iconCustomEmojiId.isEmpty()) {
throw new TelegramApiValidationException("Icon Custom Emoji Id can't be empty", this);
}
}
@Override
public String getMethod() {
return PATH;
}
public static class EditForumTopicBuilder {
@Tolerate
public EditForumTopicBuilder chatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
return this;
}
}
}

View File

@ -0,0 +1,45 @@
package org.telegram.telegrambots.meta.api.methods.forum;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.stickers.Sticker;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import java.util.ArrayList;
/**
* @author Ruben Bermudez
* @version 6.3
* Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters.
* Returns an Array of Sticker objects.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@Builder
public class GetForumTopicIconStickers extends BotApiMethod<ArrayList<Sticker>> {
private static final String PATH = "getForumTopicIconStickers";
@Override
public void validate() throws TelegramApiValidationException {
}
@Override
public String getMethod() {
return PATH;
}
@Override
public ArrayList<Sticker> deserializeResponse(String answer) throws TelegramApiRequestException {
return deserializeResponseArray(answer, Sticker.class);
}
}

View File

@ -0,0 +1,81 @@
package org.telegram.telegrambots.meta.api.methods.forum;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBoolean;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/**
* @author Ruben Bermudez
* @version 6.3
* Use this method to reopen a closed topic in a forum supergroup chat.
* The bot must be an administrator in the chat for this to work and must
* have the can_manage_topics administrator rights,
* unless it is the creator of the topic.
*
* Returns True on success.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ReopenForumTopic extends BotApiMethodBoolean {
public static final String PATH = "reopenForumTopic";
private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
/**
* Unique identifier for the target chat or username
* of the target supergroup (in the format @supergroupusername)
*/
@JsonProperty(CHATID_FIELD)
@NonNull
private String chatId;
/**
* Unique identifier for the target message thread of the forum topic
*/
@JsonProperty(MESSAGETHREADID_FIELD)
@NonNull
private Integer messageThreadId;
@Tolerate
public void setChatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
}
@Override
public void validate() throws TelegramApiValidationException {
if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
if (messageThreadId <= 0) {
throw new TelegramApiValidationException("Message Thread Id can't be empty", this);
}
}
@Override
public String getMethod() {
return PATH;
}
public static class ReopenForumTopicBuilder {
@Tolerate
public ReopenForumTopicBuilder chatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
return this;
}
}
}

View File

@ -0,0 +1,80 @@
package org.telegram.telegrambots.meta.api.methods.forum;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBoolean;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/**
* @author Ruben Bermudez
* @version 6.3
* Use this method to clear the list of pinned messages in a forum topic.
* The bot must be an administrator in the chat for this to work and must
* have the can_pin_messages administrator right in the supergroup.
*
* Returns True on success.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class UnpinAllForumTopicMessages extends BotApiMethodBoolean {
public static final String PATH = "unpinAllForumTopicMessages";
private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
/**
* Unique identifier for the target chat or username
* of the target supergroup (in the format @supergroupusername)
*/
@JsonProperty(CHATID_FIELD)
@NonNull
private String chatId;
/**
* Unique identifier for the target message thread of the forum topic
*/
@JsonProperty(MESSAGETHREADID_FIELD)
@NonNull
private Integer messageThreadId;
@Tolerate
public void setChatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
}
@Override
public void validate() throws TelegramApiValidationException {
if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
if (messageThreadId <= 0) {
throw new TelegramApiValidationException("Message Thread Id can't be empty", this);
}
}
@Override
public String getMethod() {
return PATH;
}
public static class UnpinAllForumTopicMessagesBuilder {
@Tolerate
public UnpinAllForumTopicMessagesBuilder chatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
return this;
}
}
}

View File

@ -46,6 +46,7 @@ public class PromoteChatMember extends BotApiMethodBoolean {
private static final String ISANONYMOUS_FIELD = "is_anonymous"; private static final String ISANONYMOUS_FIELD = "is_anonymous";
private static final String CANMANAGECHAT_FIELD = "can_manage_chat"; private static final String CANMANAGECHAT_FIELD = "can_manage_chat";
private static final String CANMANAGEVIDEOCHATS_FIELD = "can_manage_video_chats"; private static final String CANMANAGEVIDEOCHATS_FIELD = "can_manage_video_chats";
private static final String CANMANAGETOPICS_FIELD = "can_manage_topics";
@JsonProperty(CHATID_FIELD) @JsonProperty(CHATID_FIELD)
@NonNull @NonNull
@ -87,6 +88,12 @@ public class PromoteChatMember extends BotApiMethodBoolean {
*/ */
@JsonProperty(CANMANAGEVIDEOCHATS_FIELD) @JsonProperty(CANMANAGEVIDEOCHATS_FIELD)
private Boolean canManageVideoChats; private Boolean canManageVideoChats;
/**
* Optional.
* True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only
*/
@JsonProperty(CANMANAGETOPICS_FIELD)
private Boolean canManageTopics;
@Tolerate @Tolerate
public void setChatId(@NonNull Long chatId) { public void setChatId(@NonNull Long chatId) {

View File

@ -40,7 +40,7 @@ public class SetChatTitle extends BotApiMethodBoolean {
private String chatId; ///< Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername) private String chatId; ///< Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
@JsonProperty(TITLE_FIELD) @JsonProperty(TITLE_FIELD)
@NonNull @NonNull
private String title; ///< Required. New chat title, 1-255 characters private String title; ///< Required. New chat title, 1-128 characters
@Tolerate @Tolerate
public void setChatId(@NonNull Long chatId) { public void setChatId(@NonNull Long chatId) {

View File

@ -1,7 +1,6 @@
package org.telegram.telegrambots.meta.api.methods.invoices; package org.telegram.telegrambots.meta.api.methods.invoices;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
@ -14,20 +13,17 @@ import lombok.Setter;
import lombok.Singular; import lombok.Singular;
import lombok.ToString; import lombok.ToString;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodMessage;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice; import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import java.io.IOException;
import java.util.List; import java.util.List;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 6.1 * @version 6.1
* Use this method to create a link for an invoice. On success, the created link is returned. * Use this method to create a link for an invoice.
* Retruns the created invoice link as String on success
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -37,7 +33,7 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Builder @Builder
public class CreateInvoiceLink extends BotApiMethodMessage { public class CreateInvoiceLink extends BotApiMethod<String> {
public static final String PATH = "createInvoiceLink"; public static final String PATH = "createInvoiceLink";
public static final String TITLE_FIELD = "title"; public static final String TITLE_FIELD = "title";
@ -164,4 +160,9 @@ public class CreateInvoiceLink extends BotApiMethodMessage {
throw new TelegramApiValidationException("No more that 4 suggested tips allowed", this); throw new TelegramApiValidationException("No more that 4 suggested tips allowed", this);
} }
} }
@Override
public String deserializeResponse(String answer) throws TelegramApiRequestException {
return deserializeResponse(answer, String.class);
}
} }

View File

@ -1,7 +1,6 @@
package org.telegram.telegrambots.meta.api.methods.invoices; package org.telegram.telegrambots.meta.api.methods.invoices;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
@ -14,16 +13,11 @@ import lombok.Setter;
import lombok.Singular; import lombok.Singular;
import lombok.ToString; import lombok.ToString;
import lombok.experimental.Tolerate; import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodMessage; import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodMessage;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice; import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import java.io.IOException;
import java.util.List; import java.util.List;
/** /**
@ -43,6 +37,7 @@ public class SendInvoice extends BotApiMethodMessage {
public static final String PATH = "sendinvoice"; public static final String PATH = "sendinvoice";
private static final String CHATID_FIELD = "chat_id"; private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
private static final String TITLE_FIELD = "title"; private static final String TITLE_FIELD = "title";
private static final String DESCRIPTION_FIELD = "description"; private static final String DESCRIPTION_FIELD = "description";
private static final String PAYLOAD_FIELD = "payload"; private static final String PAYLOAD_FIELD = "payload";
@ -73,6 +68,12 @@ public class SendInvoice extends BotApiMethodMessage {
@JsonProperty(CHATID_FIELD) @JsonProperty(CHATID_FIELD)
@NonNull @NonNull
private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername) private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
@JsonProperty(MESSAGETHREADID_FIELD)
private Integer messageThreadId;
@JsonProperty(TITLE_FIELD) @JsonProperty(TITLE_FIELD)
@NonNull @NonNull
private String title; ///< Product name private String title; ///< Product name

View File

@ -40,6 +40,7 @@ public class SendPoll extends BotApiMethodMessage {
public static final String PATH = "sendPoll"; public static final String PATH = "sendPoll";
private static final String CHATID_FIELD = "chat_id"; private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
private static final String QUESTION_FIELD = "question"; private static final String QUESTION_FIELD = "question";
private static final String OPTIONS_FIELD = "options"; private static final String OPTIONS_FIELD = "options";
private static final String ISANONYMOUS_FIELD = "is_anonymous"; private static final String ISANONYMOUS_FIELD = "is_anonymous";
@ -65,6 +66,12 @@ public class SendPoll extends BotApiMethodMessage {
@JsonProperty(CHATID_FIELD) @JsonProperty(CHATID_FIELD)
@NonNull @NonNull
private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername) private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
@JsonProperty(MESSAGETHREADID_FIELD)
private Integer messageThreadId;
@JsonProperty(QUESTION_FIELD) @JsonProperty(QUESTION_FIELD)
@NonNull @NonNull
private String question; ///< Poll question, 1-300 characters private String question; ///< Poll question, 1-300 characters

View File

@ -41,6 +41,7 @@ public class SendAnimation extends PartialBotApiMethod<Message> {
public static final String PATH = "sendAnimation"; public static final String PATH = "sendAnimation";
public static final String CHATID_FIELD = "chat_id"; public static final String CHATID_FIELD = "chat_id";
public static final String MESSAGETHREADID_FIELD = "message_thread_id";
public static final String ANIMATION_FIELD = "animation"; public static final String ANIMATION_FIELD = "animation";
public static final String DURATION_FIELD = "duration"; public static final String DURATION_FIELD = "duration";
public static final String WIDTH_FIELD = "width"; public static final String WIDTH_FIELD = "width";
@ -62,6 +63,11 @@ public class SendAnimation extends PartialBotApiMethod<Message> {
* Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation * Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation
* from the Internet, or upload a new animation using multipart/form-data. * from the Internet, or upload a new animation using multipart/form-data.
*/ */
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
private Integer messageThreadId;
@NonNull @NonNull
private InputFile animation; private InputFile animation;
private Integer duration; ///< Optional. Duration of sent animation in seconds private Integer duration; ///< Optional. Duration of sent animation in seconds

View File

@ -43,6 +43,7 @@ public class SendAudio extends PartialBotApiMethod<Message> {
public static final String DURATION_FIELD = "duration"; public static final String DURATION_FIELD = "duration";
public static final String CHATID_FIELD = "chat_id"; public static final String CHATID_FIELD = "chat_id";
public static final String MESSAGETHREADID_FIELD = "message_thread_id";
public static final String AUDIO_FIELD = "audio"; public static final String AUDIO_FIELD = "audio";
public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id"; public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
public static final String DISABLENOTIFICATION_FIELD = "disable_notification"; public static final String DISABLENOTIFICATION_FIELD = "disable_notification";
@ -58,6 +59,11 @@ public class SendAudio extends PartialBotApiMethod<Message> {
@NonNull @NonNull
private String chatId; ///< Unique identifier for the chat to send the message to (or Username fro channels) private String chatId; ///< Unique identifier for the chat to send the message to (or Username fro channels)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
private Integer messageThreadId;
@NonNull @NonNull
private InputFile audio; ///< Audio file to send. file_id as String to resend an audio that is already on the Telegram servers or Url to upload it private InputFile audio; ///< Audio file to send. file_id as String to resend an audio that is already on the Telegram servers or Url to upload it
private Integer replyToMessageId; ///< Optional. If the message is a reply, ID of the original message private Integer replyToMessageId; ///< Optional. If the message is a reply, ID of the original message

View File

@ -33,6 +33,7 @@ public class SendContact extends BotApiMethodMessage {
public static final String PATH = "sendContact"; public static final String PATH = "sendContact";
private static final String CHATID_FIELD = "chat_id"; private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
private static final String PHONE_NUMBER_FIELD = "phone_number"; private static final String PHONE_NUMBER_FIELD = "phone_number";
private static final String FIRST_NAME_FIELD = "first_name"; private static final String FIRST_NAME_FIELD = "first_name";
private static final String LAST_NAME_FIELD = "last_name"; private static final String LAST_NAME_FIELD = "last_name";
@ -46,6 +47,12 @@ public class SendContact extends BotApiMethodMessage {
@JsonProperty(CHATID_FIELD) @JsonProperty(CHATID_FIELD)
@NonNull @NonNull
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
@JsonProperty(MESSAGETHREADID_FIELD)
private Integer messageThreadId;
@JsonProperty(PHONE_NUMBER_FIELD) @JsonProperty(PHONE_NUMBER_FIELD)
@NonNull @NonNull
private String phoneNumber; ///< User's phone number private String phoneNumber; ///< User's phone number

View File

@ -38,6 +38,7 @@ public class SendDice extends BotApiMethodMessage {
public static final String PATH = "sendDice"; public static final String PATH = "sendDice";
private static final String CHATID_FIELD = "chat_id"; private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
private static final String EMOJI_FIELD = "emoji"; private static final String EMOJI_FIELD = "emoji";
private static final String DISABLENOTIFICATION_FIELD = "disable_notification"; private static final String DISABLENOTIFICATION_FIELD = "disable_notification";
private static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id"; private static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
@ -45,9 +46,18 @@ public class SendDice extends BotApiMethodMessage {
private static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; private static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply";
private static final String PROTECTCONTENT_FIELD = "protect_content"; private static final String PROTECTCONTENT_FIELD = "protect_content";
/**
* Unique identifier for the target chat or username of the target channel (in the format @channelusername)
*/
@JsonProperty(CHATID_FIELD) @JsonProperty(CHATID_FIELD)
@NonNull @NonNull
private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername) private String chatId;
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
@JsonProperty(MESSAGETHREADID_FIELD)
private Integer messageThreadId;
/** /**
* Optional. * Optional.
* *

View File

@ -38,6 +38,7 @@ public class SendDocument extends PartialBotApiMethod<Message> {
public static final String PATH = "senddocument"; public static final String PATH = "senddocument";
public static final String CHATID_FIELD = "chat_id"; public static final String CHATID_FIELD = "chat_id";
public static final String MESSAGETHREADID_FIELD = "message_thread_id";
public static final String DOCUMENT_FIELD = "document"; public static final String DOCUMENT_FIELD = "document";
public static final String CAPTION_FIELD = "caption"; public static final String CAPTION_FIELD = "caption";
public static final String DISABLENOTIFICATION_FIELD = "disable_notification"; public static final String DISABLENOTIFICATION_FIELD = "disable_notification";
@ -52,6 +53,11 @@ public class SendDocument extends PartialBotApiMethod<Message> {
@NonNull @NonNull
private String chatId; ///< Unique identifier for the chat to send the message to or Username for the channel to send the message to private String chatId; ///< Unique identifier for the chat to send the message to or Username for the channel to send the message to
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
private Integer messageThreadId;
@NonNull @NonNull
private InputFile document; ///< File file to send. file_id as String to resend a file that is already on the Telegram servers or Url to upload it private InputFile document; ///< File file to send. file_id as String to resend a file that is already on the Telegram servers or Url to upload it
private String caption; ///< Optional. Document caption (may also be used when resending documents by file_id), 0-200 characters private String caption; ///< Optional. Document caption (may also be used when resending documents by file_id), 0-200 characters

View File

@ -49,6 +49,8 @@ public class SendGame extends BotApiMethodMessage {
public static final String PATH = "sendGame"; public static final String PATH = "sendGame";
private static final String CHATID_FIELD = "chat_id"; private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
private static final String GAMESHORTNAME_FIELD = "game_short_name"; private static final String GAMESHORTNAME_FIELD = "game_short_name";
private static final String DISABLENOTIFICATION_FIELD = "disable_notification"; private static final String DISABLENOTIFICATION_FIELD = "disable_notification";
private static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id"; private static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
@ -59,6 +61,12 @@ public class SendGame extends BotApiMethodMessage {
@JsonProperty(CHATID_FIELD) @JsonProperty(CHATID_FIELD)
@NonNull @NonNull
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
@JsonProperty(MESSAGETHREADID_FIELD)
private Integer messageThreadId;
@JsonProperty(GAMESHORTNAME_FIELD) @JsonProperty(GAMESHORTNAME_FIELD)
@NonNull @NonNull
private String gameShortName; ///< Short name of the game private String gameShortName; ///< Short name of the game

View File

@ -32,6 +32,8 @@ public class SendLocation extends BotApiMethodMessage {
public static final String PATH = "sendlocation"; public static final String PATH = "sendlocation";
private static final String CHATID_FIELD = "chat_id"; private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
private static final String LATITUDE_FIELD = "latitude"; private static final String LATITUDE_FIELD = "latitude";
private static final String LONGITUDE_FIELD = "longitude"; private static final String LONGITUDE_FIELD = "longitude";
private static final String DISABLENOTIFICATION_FIELD = "disable_notification"; private static final String DISABLENOTIFICATION_FIELD = "disable_notification";
@ -47,6 +49,12 @@ public class SendLocation extends BotApiMethodMessage {
@JsonProperty(CHATID_FIELD) @JsonProperty(CHATID_FIELD)
@NonNull @NonNull
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
@JsonProperty(MESSAGETHREADID_FIELD)
private Integer messageThreadId;
@JsonProperty(LATITUDE_FIELD) @JsonProperty(LATITUDE_FIELD)
@NonNull @NonNull
private Double latitude; ///< Latitude of location private Double latitude; ///< Latitude of location

View File

@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods.send; package org.telegram.telegrambots.meta.api.methods.send;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -44,23 +43,24 @@ public class SendMediaGroup extends PartialBotApiMethod<ArrayList<Message>> {
public static final String PATH = "sendMediaGroup"; public static final String PATH = "sendMediaGroup";
public static final String CHATID_FIELD = "chat_id"; public static final String CHATID_FIELD = "chat_id";
public static final String MESSAGETHREADID_FIELD = "message_thread_id";
public static final String MEDIA_FIELD = "media"; public static final String MEDIA_FIELD = "media";
public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id"; public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
public static final String DISABLENOTIFICATION_FIELD = "disable_notification"; public static final String DISABLENOTIFICATION_FIELD = "disable_notification";
public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply";
public static final String PROTECTCONTENT_FIELD = "protect_content"; public static final String PROTECTCONTENT_FIELD = "protect_content";
@JsonProperty(CHATID_FIELD)
@NonNull @NonNull
private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername) private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername)
@JsonProperty(MEDIA_FIELD) /**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
private Integer messageThreadId;
@NonNull @NonNull
private List<InputMedia> medias; ///< A JSON-serialized array describing photos and videos to be sent, must include 210 items private List<InputMedia> medias; ///< A JSON-serialized array describing photos and videos to be sent, must include 210 items
@JsonProperty(REPLYTOMESSAGEID_FIELD)
private Integer replyToMessageId; ///< Optional. If the messages are a reply, ID of the original message private Integer replyToMessageId; ///< Optional. If the messages are a reply, ID of the original message
@JsonProperty(DISABLENOTIFICATION_FIELD)
private Boolean disableNotification; ///< Optional. Sends the messages silently. Users will receive a notification with no sound. private Boolean disableNotification; ///< Optional. Sends the messages silently. Users will receive a notification with no sound.
@JsonProperty(ALLOWSENDINGWITHOUTREPLY_FIELD)
private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving

View File

@ -38,6 +38,7 @@ public class SendMessage extends BotApiMethodMessage {
public static final String PATH = "sendmessage"; public static final String PATH = "sendmessage";
private static final String CHATID_FIELD = "chat_id"; private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
private static final String TEXT_FIELD = "text"; private static final String TEXT_FIELD = "text";
private static final String PARSEMODE_FIELD = "parse_mode"; private static final String PARSEMODE_FIELD = "parse_mode";
private static final String DISABLEWEBPAGEPREVIEW_FIELD = "disable_web_page_preview"; private static final String DISABLEWEBPAGEPREVIEW_FIELD = "disable_web_page_preview";
@ -51,6 +52,12 @@ public class SendMessage extends BotApiMethodMessage {
@JsonProperty(CHATID_FIELD) @JsonProperty(CHATID_FIELD)
@NonNull @NonNull
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
@JsonProperty(MESSAGETHREADID_FIELD)
private Integer messageThreadId;
@JsonProperty(TEXT_FIELD) @JsonProperty(TEXT_FIELD)
@NonNull @NonNull
private String text; ///< Text of the message to be sent private String text; ///< Text of the message to be sent

View File

@ -39,6 +39,7 @@ public class SendPhoto extends PartialBotApiMethod<Message> {
public static final String PATH = "sendphoto"; public static final String PATH = "sendphoto";
public static final String CHATID_FIELD = "chat_id"; public static final String CHATID_FIELD = "chat_id";
public static final String MESSAGETHREADID_FIELD = "message_thread_id";
public static final String PHOTO_FIELD = "photo"; public static final String PHOTO_FIELD = "photo";
public static final String CAPTION_FIELD = "caption"; public static final String CAPTION_FIELD = "caption";
public static final String DISABLENOTIFICATION_FIELD = "disable_notification"; public static final String DISABLENOTIFICATION_FIELD = "disable_notification";
@ -51,6 +52,11 @@ public class SendPhoto extends PartialBotApiMethod<Message> {
@NonNull @NonNull
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
private Integer messageThreadId;
@NonNull @NonNull
private InputFile photo; ///< Photo to send. file_id as String to resend a photo that is already on the Telegram servers or URL to upload it private InputFile photo; ///< Photo to send. file_id as String to resend a photo that is already on the Telegram servers or URL to upload it
private String caption; ///< Optional Photo caption (may also be used when resending photos by file_id). private String caption; ///< Optional Photo caption (may also be used when resending photos by file_id).

View File

@ -35,6 +35,7 @@ public class SendSticker extends PartialBotApiMethod<Message> {
public static final String PATH = "sendsticker"; public static final String PATH = "sendsticker";
public static final String CHATID_FIELD = "chat_id"; public static final String CHATID_FIELD = "chat_id";
public static final String MESSAGETHREADID_FIELD = "message_thread_id";
public static final String STICKER_FIELD = "sticker"; public static final String STICKER_FIELD = "sticker";
public static final String DISABLENOTIFICATION_FIELD = "disable_notification"; public static final String DISABLENOTIFICATION_FIELD = "disable_notification";
public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id"; public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
@ -44,6 +45,11 @@ public class SendSticker extends PartialBotApiMethod<Message> {
@NonNull @NonNull
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
private Integer messageThreadId;
@NonNull @NonNull
private InputFile sticker; ///< Sticker file to send. file_id as String to resend a sticker that is already on the Telegram servers or URL to upload it private InputFile sticker; ///< Sticker file to send. file_id as String to resend a sticker that is already on the Telegram servers or URL to upload it
private Boolean disableNotification; ///< Optional. Sends the message silently. Users will receive a notification with no sound. private Boolean disableNotification; ///< Optional. Sends the message silently. Users will receive a notification with no sound.

View File

@ -33,6 +33,7 @@ public class SendVenue extends BotApiMethodMessage {
public static final String PATH = "sendVenue"; public static final String PATH = "sendVenue";
private static final String CHATID_FIELD = "chat_id"; private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
private static final String LATITUDE_FIELD = "latitude"; private static final String LATITUDE_FIELD = "latitude";
private static final String LONGITUDE_FIELD = "longitude"; private static final String LONGITUDE_FIELD = "longitude";
private static final String TITLE_FIELD = "title"; private static final String TITLE_FIELD = "title";
@ -50,6 +51,12 @@ public class SendVenue extends BotApiMethodMessage {
@JsonProperty(CHATID_FIELD) @JsonProperty(CHATID_FIELD)
@NonNull @NonNull
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
@JsonProperty(MESSAGETHREADID_FIELD)
private Integer messageThreadId;
@JsonProperty(LATITUDE_FIELD) @JsonProperty(LATITUDE_FIELD)
@NonNull @NonNull
private Double latitude; ///< Latitude of venue location private Double latitude; ///< Latitude of venue location

View File

@ -39,6 +39,7 @@ public class SendVideo extends PartialBotApiMethod<Message> {
public static final String PATH = "sendvideo"; public static final String PATH = "sendvideo";
public static final String CHATID_FIELD = "chat_id"; public static final String CHATID_FIELD = "chat_id";
public static final String MESSAGETHREADID_FIELD = "message_thread_id";
public static final String VIDEO_FIELD = "video"; public static final String VIDEO_FIELD = "video";
public static final String DURATION_FIELD = "duration"; public static final String DURATION_FIELD = "duration";
public static final String CAPTION_FIELD = "caption"; public static final String CAPTION_FIELD = "caption";
@ -56,6 +57,11 @@ public class SendVideo extends PartialBotApiMethod<Message> {
@NonNull @NonNull
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
private Integer messageThreadId;
@NonNull @NonNull
private InputFile video; ///< Video to send. file_id as String to resend a video that is already on the Telegram servers or URL to upload it private InputFile video; ///< Video to send. file_id as String to resend a video that is already on the Telegram servers or URL to upload it
private Integer duration; ///< Optional. Duration of sent video in seconds private Integer duration; ///< Optional. Duration of sent video in seconds

View File

@ -36,6 +36,7 @@ public class SendVideoNote extends PartialBotApiMethod<Message> {
public static final String PATH = "sendvideonote"; public static final String PATH = "sendvideonote";
public static final String CHATID_FIELD = "chat_id"; public static final String CHATID_FIELD = "chat_id";
public static final String MESSAGETHREADID_FIELD = "message_thread_id";
public static final String VIDEONOTE_FIELD = "video_note"; public static final String VIDEONOTE_FIELD = "video_note";
public static final String DURATION_FIELD = "duration"; public static final String DURATION_FIELD = "duration";
public static final String LENGTH_FIELD = "length"; public static final String LENGTH_FIELD = "length";
@ -48,6 +49,11 @@ public class SendVideoNote extends PartialBotApiMethod<Message> {
@NonNull @NonNull
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
private Integer messageThreadId;
@NonNull @NonNull
private InputFile videoNote; ///< Videonote to send. file_id as String to resend a video that is already on the Telegram servers. private InputFile videoNote; ///< Videonote to send. file_id as String to resend a video that is already on the Telegram servers.
private Integer duration; ///< Optional. Duration of sent video in seconds private Integer duration; ///< Optional. Duration of sent video in seconds

View File

@ -40,6 +40,7 @@ public class SendVoice extends PartialBotApiMethod<Message> {
public static final String PATH = "sendvoice"; public static final String PATH = "sendvoice";
public static final String CHATID_FIELD = "chat_id"; public static final String CHATID_FIELD = "chat_id";
public static final String MESSAGETHREADID_FIELD = "message_thread_id";
public static final String VOICE_FIELD = "voice"; public static final String VOICE_FIELD = "voice";
public static final String DISABLENOTIFICATION_FIELD = "disable_notification"; public static final String DISABLENOTIFICATION_FIELD = "disable_notification";
public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id"; public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
@ -53,6 +54,11 @@ public class SendVoice extends PartialBotApiMethod<Message> {
@NonNull @NonNull
private String chatId; ///< Unique identifier for the chat sent message to (Or username for channels) private String chatId; ///< Unique identifier for the chat sent message to (Or username for channels)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
private Integer messageThreadId;
@NonNull @NonNull
private InputFile voice; ///< Audio file to send. You can either pass a file_id as String to resend an audio that is already on the Telegram servers, or upload a new audio file using multipart/form-data. private InputFile voice; ///< Audio file to send. You can either pass a file_id as String to resend an audio that is already on the Telegram servers, or upload a new audio file using multipart/form-data.
private Boolean disableNotification; ///< Optional. Sends the message silently. Users will receive a notification with no sound. private Boolean disableNotification; ///< Optional. Sends the message silently. Users will receive a notification with no sound.

View File

@ -24,6 +24,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* - Bots granted can_post_messages permissions can delete outgoing messages in channels. * - Bots granted can_post_messages permissions can delete outgoing messages in channels.
* - If the bot is an administrator of a group, it can delete any message there. * - If the bot is an administrator of a group, it can delete any message there.
* - If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there. * - If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.
* - Service messages about a supergroup, channel, or forum topic creation can't be deleted
* Returns True on success. * Returns True on success.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)

View File

@ -10,9 +10,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* This object represents an audio file
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* This object represents an audio file
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -32,18 +32,28 @@ public class Audio implements BotApiObject {
private static final String THUMB_FIELD = "thumb"; private static final String THUMB_FIELD = "thumb";
private static final String FILENAME_FIELD = "file_name"; private static final String FILENAME_FIELD = "file_name";
/**
* Identifier for this file, which can be used to download or reuse the file
*/
@JsonProperty(FILEID_FIELD) @JsonProperty(FILEID_FIELD)
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file private String fileId;
/** /**
* 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)
private String fileUniqueId; private String fileUniqueId;
/**
* Integer Duration of the audio in seconds as defined by sender
*/
@JsonProperty(DURATION_FIELD) @JsonProperty(DURATION_FIELD)
private Integer duration; ///< Integer Duration of the audio in seconds as defined by sender private Integer duration;
/**
* Optional.
* MIME type of the file as defined by sender
*/
@JsonProperty(MIMETYPE_FIELD) @JsonProperty(MIMETYPE_FIELD)
private String mimeType; ///< Optional. MIME type of the file as defined by sender private String mimeType;
/** /**
* Optional. * Optional.
* File size in bytes. * File size in bytes.
@ -52,12 +62,28 @@ public class Audio implements BotApiObject {
*/ */
@JsonProperty(FILESIZE_FIELD) @JsonProperty(FILESIZE_FIELD)
private Long fileSize; private Long fileSize;
/**
* Optional.
* Title of the audio as defined by sender or by audio tags
*/
@JsonProperty(TITLE_FIELD) @JsonProperty(TITLE_FIELD)
private String title; ///< Optional. Title of the audio as defined by sender or by audio tags private String title;
/**
* Optional.
* Performer of the audio as defined by sender or by audio tags
*/
@JsonProperty(PERFORMER_FIELD) @JsonProperty(PERFORMER_FIELD)
private String performer; ///< Optional. Performer of the audio as defined by sender or by audio tags private String performer;
/**
* Optional.
* Thumbnail of the album cover to which the music file belongs
*/
@JsonProperty(THUMB_FIELD) @JsonProperty(THUMB_FIELD)
private PhotoSize thumb; ///< Optional. Thumbnail of the album cover to which the music file belongs private PhotoSize thumb;
/**
* Optional.
* Original filename as defined by sender
*/
@JsonProperty(FILENAME_FIELD) @JsonProperty(FILENAME_FIELD)
private String fileName; ///< Optional. Original filename as defined by sender private String fileName;
} }

View File

@ -10,8 +10,6 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* @author Ruben Bermudez
* @version 1.0
* This object represents an incoming callback query from a * This object represents an incoming callback query from a
* callback button in an inline keyboard. * callback button in an inline keyboard.
* If the button that originated the query was attached to a message sent by the bot, * If the button that originated the query was attached to a message sent by the bot,
@ -22,6 +20,8 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
* until you call answerCallbackQuery. It is, therefore, necessary to react by * until you call answerCallbackQuery. It is, therefore, necessary to react by
* calling answerCallbackQuery even if no notification to the user is needed * calling answerCallbackQuery even if no notification to the user is needed
* (e.g., without specifying any of the optional parameters). * (e.g., without specifying any of the optional parameters).
* @author Ruben Bermudez
* @version 1.0
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -39,10 +39,16 @@ public class CallbackQuery implements BotApiObject {
private static final String GAMESHORTNAME_FIELD = "game_short_name"; private static final String GAMESHORTNAME_FIELD = "game_short_name";
private static final String CHAT_INSTANCE_FIELD = "chat_instance"; private static final String CHAT_INSTANCE_FIELD = "chat_instance";
/**
* Unique identifier for this query
*/
@JsonProperty(ID_FIELD) @JsonProperty(ID_FIELD)
private String id; ///< Unique identifier for this query private String id;
/**
* Sender
*/
@JsonProperty(FROM_FIELD) @JsonProperty(FROM_FIELD)
private User from; ///< Sender private User from;
/** /**
* Optional. * Optional.
* Message with the callback button that originated the query. * Message with the callback button that originated the query.
@ -51,8 +57,12 @@ public class CallbackQuery implements BotApiObject {
*/ */
@JsonProperty(MESSAGE_FIELD) @JsonProperty(MESSAGE_FIELD)
private Message message; private Message message;
/**
* Optional.
* Identifier of the message sent via the bot in inline mode, that originated the query
*/
@JsonProperty(INLINE_MESSAGE_ID_FIELD) @JsonProperty(INLINE_MESSAGE_ID_FIELD)
private String inlineMessageId; ///< Optional. Identifier of the message sent via the bot in inline mode, that originated the query private String inlineMessageId;
/** /**
* *
* Optional. Data associated with the callback button. * Optional. Data associated with the callback button.

View File

@ -12,10 +12,12 @@ import lombok.Setter;
import lombok.ToString; import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
import java.util.List;
/** /**
* This object represents a Telegram chat with an user or a group
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 6.1 * @version 6.1
* This object represents a Telegram chat with an user or a group
*/ */
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ -50,6 +52,9 @@ public class Chat implements BotApiObject {
private static final String JOINTOSENDMESSAGES_FIELD = "join_to_send_messages"; private static final String JOINTOSENDMESSAGES_FIELD = "join_to_send_messages";
private static final String JOINBYREQUEST_FIELD = "join_by_request"; private static final String JOINBYREQUEST_FIELD = "join_by_request";
private static final String HASRESTRICTEDVOICEANDVIDEOMESSAGES_FIELD = "has_restricted_voice_and_video_messages"; private static final String HASRESTRICTEDVOICEANDVIDEOMESSAGES_FIELD = "has_restricted_voice_and_video_messages";
private static final String ISFORUM_FIELD = "is_forum";
private static final String ACTIVEUSERNAMES_FIELD = "active_usernames";
private static final String EMOJISTATUSCUSTOMEMOJIID_FIELD = "emoji_status_custom_emoji_id";
private static final String USERCHATTYPE = "private"; private static final String USERCHATTYPE = "private";
private static final String GROUPCHATTYPE = "group"; private static final String GROUPCHATTYPE = "group";
@ -74,32 +79,79 @@ public class Chat implements BotApiObject {
*/ */
@JsonProperty(ID_FIELD) @JsonProperty(ID_FIELD)
@NonNull @NonNull
private Long id; ///< Unique identifier for this chat, not exceeding 1e13 by absolute value private Long id;
/**
* Type of the chat, one of private, group or channel or "supergroup"
*/
@JsonProperty(TYPE_FIELD) @JsonProperty(TYPE_FIELD)
@NonNull @NonNull
private String type; ///< Type of the chat, one of private, group or channel or "supergroup" private String type;
/**
* Optional.
* Title of the chat, only for channels and group chat
*/
@JsonProperty(TITLE_FIELD) @JsonProperty(TITLE_FIELD)
private String title; ///< Optional. Title of the chat, only for channels and group chat private String title;
/**
* Optional
* Username of the chat, only for private chats and channels if available
*/
@JsonProperty(FIRSTNAME_FIELD) @JsonProperty(FIRSTNAME_FIELD)
private String firstName; ///< Optional. Username of the chat, only for private chats and channels if available private String firstName;
/**
* Optional.
* Interlocutor's first name for private chats
*/
@JsonProperty(LASTNAME_FIELD) @JsonProperty(LASTNAME_FIELD)
private String lastName; ///< Optional. Interlocutor's first name for private chats private String lastName;
/**
* Optional.
* Interlocutor's last name for private chats
*/
@JsonProperty(USERNAME_FIELD) @JsonProperty(USERNAME_FIELD)
private String userName; ///< Optional. Interlocutor's last name for private chats private String userName;
/**
* Optional.
* Chat photo. Returned only in getChat.
*/
@JsonProperty(PHOTO_FIELD) @JsonProperty(PHOTO_FIELD)
private ChatPhoto photo; ///< Optional. Chat photo. Returned only in getChat. private ChatPhoto photo;
/**
* Optional.
* Description, for groups, supergroups and channel chats. Returned only in getChat.
*/
@JsonProperty(DESCRIPTION_FIELD) @JsonProperty(DESCRIPTION_FIELD)
private String description; ///< Optional. Description, for groups, supergroups and channel chats. Returned only in getChat. private String description;
/**
* Optional.
* Primary invite link, for groups, supergroups and channel chats. Returned only in getChat.
*/
@JsonProperty(INVITELINK_FIELD) @JsonProperty(INVITELINK_FIELD)
private String inviteLink; ///< Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat. private String inviteLink;
/**
* Optional.
* The most recent pinned message (by sending date). Returned only in getChat.
*/
@JsonProperty(PINNEDMESSAGE_FIELD) @JsonProperty(PINNEDMESSAGE_FIELD)
private Message pinnedMessage; ///< Optional. The most recent pinned message (by sending date). Returned only in getChat. private Message pinnedMessage;
/**
* Optional.
* For supergroups, name of Group sticker set. Returned only in getChat.
*/
@JsonProperty(STICKERSETNAME_FIELD) @JsonProperty(STICKERSETNAME_FIELD)
private String stickerSetName; ///< Optional. For supergroups, name of Group sticker set. Returned only in getChat. private String stickerSetName;
/**
* Optional.
* True, if the bot can change group the sticker set. Returned only in getChat.
*/
@JsonProperty(CANSETSTICKERSET_FIELD) @JsonProperty(CANSETSTICKERSET_FIELD)
private Boolean canSetStickerSet; ///< Optional. True, if the bot can change group the sticker set. Returned only in getChat. private Boolean canSetStickerSet;
/**
* Optional.
* Default chat member permissions, for groups and supergroups. Returned only in getChat.
*/
@JsonProperty(PERMISSIONS_FIELD) @JsonProperty(PERMISSIONS_FIELD)
private ChatPermissions permissions; ///< Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat. private ChatPermissions permissions;
/** /**
* Optional. * Optional.
* For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user. * For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user.
@ -107,8 +159,12 @@ public class Chat implements BotApiObject {
*/ */
@JsonProperty(SLOWMODEDELAY_FIELD) @JsonProperty(SLOWMODEDELAY_FIELD)
private Integer slowModeDelay; private Integer slowModeDelay;
/**
* Optional.
* Bio of the other party in a private chat. Returned only in getChat.
*/
@JsonProperty(BIO_FIELD) @JsonProperty(BIO_FIELD)
private String bio; ///< Optional. Bio of the other party in a private chat. Returned only in getChat. private String bio;
/** /**
* Optional. * Optional.
* Unique identifier for the linked chat, * Unique identifier for the linked chat,
@ -121,10 +177,16 @@ public class Chat implements BotApiObject {
*/ */
@JsonProperty(LINKEDCHATID_FIELD) @JsonProperty(LINKEDCHATID_FIELD)
private Long linkedChatId; private Long linkedChatId;
/**
* Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.
*/
@JsonProperty(LOCATION_FIELD) @JsonProperty(LOCATION_FIELD)
private ChatLocation location; ///< Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat. private ChatLocation location;
/**
* Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat.
*/
@JsonProperty(MESSAGEAUTODELETETIME_FIELD) @JsonProperty(MESSAGEAUTODELETETIME_FIELD)
private Integer messageAutoDeleteTime; ///< Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat. private Integer messageAutoDeleteTime;
/** /**
* Optional. * Optional.
* True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. * True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user.
@ -161,6 +223,29 @@ public class Chat implements BotApiObject {
@JsonProperty(HASRESTRICTEDVOICEANDVIDEOMESSAGES_FIELD) @JsonProperty(HASRESTRICTEDVOICEANDVIDEOMESSAGES_FIELD)
private Boolean hasRestrictedVoiceAndVideoMessages; private Boolean hasRestrictedVoiceAndVideoMessages;
/**
* Optional.
* True, if the supergroup chat is a forum (has topics enabled)
*/
@JsonProperty(ISFORUM_FIELD)
private Boolean isForum;
/**
* Optional.
* If non-empty, the list of all active chat usernames; for private chats, supergroups and channels.
* Returned only in getChat.
*/
@JsonProperty(ACTIVEUSERNAMES_FIELD)
private List<String> activeUsernames;
/**
* Optional.
* Custom emoji identifier of emoji status of the other party in a private chat.
* Returned only in getChat.
*/
@JsonProperty(EMOJISTATUSCUSTOMEMOJIID_FIELD)
private String emojiStatusCustomEmojiId;
@JsonProperty(IS_VERIFIED_FIELD) @JsonProperty(IS_VERIFIED_FIELD)
private Boolean isVerified; ///< Optional. Extra. private Boolean isVerified; ///< Optional. Extra.
@JsonProperty(IS_PREMIUM_FIELD) @JsonProperty(IS_PREMIUM_FIELD)

View File

@ -10,10 +10,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* Represents an invite link for a chat.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 5.1 * @version 5.1
*
* Represents an invite link for a chat.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -38,25 +37,45 @@ public class ChatInviteLink implements BotApiObject {
*/ */
@JsonProperty(INVITELINK_FIELD) @JsonProperty(INVITELINK_FIELD)
private String inviteLink; private String inviteLink;
/**
* Creator of the link
*/
@JsonProperty(CREATOR_FIELD) @JsonProperty(CREATOR_FIELD)
private User creator; ///< Creator of the link private User creator;
/**
* True, if the link is primary
*/
@JsonProperty(ISPRIMARY_FIELD) @JsonProperty(ISPRIMARY_FIELD)
private Boolean isPrimary; ///< True, if the link is primary private Boolean isPrimary;
/**
* True, if the link is revoked
*/
@JsonProperty(ISREVOKED_FIELD) @JsonProperty(ISREVOKED_FIELD)
private Boolean isRevoked; ///< True, if the link is revoked private Boolean isRevoked;
@JsonProperty(EXPIREDATE_FIELD) /**
private Integer expireDate; ///< Optional. Point in time (Unix timestamp) when the link will expire or has been expired * Optional.
* Point in time (Unix timestamp) when the link will expire or has been expired
*/
@JsonProperty(EXPIREDATE_FIELD)
private Integer expireDate;
/** /**
* Optional. * Optional.
*
* Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 * Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
*/ */
@JsonProperty(MEMBERLIMIT_FIELD) @JsonProperty(MEMBERLIMIT_FIELD)
private Integer memberLimit; private Integer memberLimit;
/**
* Optional.
* Invite link name
*/
@JsonProperty(NAME_FIELD) @JsonProperty(NAME_FIELD)
private String name; ///< Optional. Invite link name private String name;
/**
* Optional.
* Number of pending join requests created using this link
*/
@JsonProperty(PENDINGJOINREQUESTCOUNT_FIELD) @JsonProperty(PENDINGJOINREQUESTCOUNT_FIELD)
private Integer pendingJoinRequestCount; ///< Optional. Number of pending join requests created using this link private Integer pendingJoinRequestCount;
/** /**
* True, if users joining the chat via the link need to be approved by chat administrators * True, if users joining the chat via the link need to be approved by chat administrators
*/ */

View File

@ -5,10 +5,9 @@ import lombok.*;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* Represents a join request sent to a chat.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 5.4 * @version 5.4
*
* Represents a join request sent to a chat.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -23,15 +22,31 @@ public class ChatJoinRequest implements BotApiObject {
private static final String BIO_FIELD = "bio"; private static final String BIO_FIELD = "bio";
private static final String INVITELINK_FIELD = "invite_link"; private static final String INVITELINK_FIELD = "invite_link";
/**
* Chat to which the request was sent
*/
@JsonProperty(CHAT_FIELD) @JsonProperty(CHAT_FIELD)
private Chat chat; ///< Chat to which the request was sent private Chat chat;
/**
* User that sent the join request
*/
@JsonProperty(FROM_FIELD) @JsonProperty(FROM_FIELD)
private User user; ///< User that sent the join request private User user;
/**
* Date the request was sent in Unix time
*/
@JsonProperty(DATE_FIELD) @JsonProperty(DATE_FIELD)
private Integer date; ///< Date the request was sent in Unix time private Integer date;
/**
* Optional.
* Bio of the user.
*/
@JsonProperty(BIO_FIELD) @JsonProperty(BIO_FIELD)
private String bio; ///< Optional. Bio of the user. private String bio;
/**
* Optional.
* Chat invite link that was used by the user to send the join request
*/
@JsonProperty(INVITELINK_FIELD) @JsonProperty(INVITELINK_FIELD)
private ChatInviteLink inviteLink; ///< Optional. Chat invite link that was used by the user to send the join request private ChatInviteLink inviteLink;
} }

View File

@ -10,9 +10,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* Represents a location to which a chat is connected.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 5.0 * @version 5.0
* Represents a location to which a chat is connected.
*/ */
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ -26,8 +26,14 @@ public class ChatLocation implements BotApiObject {
private static final String LOCATION_FIELD = "location"; private static final String LOCATION_FIELD = "location";
private static final String ADDRESS_FIELD = "address"; private static final String ADDRESS_FIELD = "address";
/**
* The location to which the supergroup is connected
*/
@JsonProperty(LOCATION_FIELD) @JsonProperty(LOCATION_FIELD)
private Location location; ///< The location to which the supergroup is connected private Location location;
/**
* Location address; 1-64 characters, as defined by the chat owner
*/
@JsonProperty(ADDRESS_FIELD) @JsonProperty(ADDRESS_FIELD)
private String address; ///< Location address; 1-64 characters, as defined by the chat owner private String address;
} }

View File

@ -29,17 +29,36 @@ public class ChatMemberUpdated implements BotApiObject {
private static final String NEWCHATMEMBER_FIELD = "new_chat_member"; private static final String NEWCHATMEMBER_FIELD = "new_chat_member";
private static final String INVITELINK_FIELD = "invite_link"; private static final String INVITELINK_FIELD = "invite_link";
/**
* Chat the user belongs to
*/
@JsonProperty(CHAT_FIELD) @JsonProperty(CHAT_FIELD)
private Chat chat; ///< Chat the user belongs to private Chat chat;
/**
* Performer of the action, which resulted in the change
*/
@JsonProperty(FROM_FIELD) @JsonProperty(FROM_FIELD)
private User from; ///< Performer of the action, which resulted in the change private User from;
/**
* Date the change was done in Unix time
*/
@JsonProperty(DATE_FIELD) @JsonProperty(DATE_FIELD)
private Integer date; ///< Date the change was done in Unix time private Integer date;
/**
* Previous information about the chat member
*/
@JsonProperty(OLDCHATMEMBER_FIELD) @JsonProperty(OLDCHATMEMBER_FIELD)
private ChatMember oldChatMember; ///< Previous information about the chat member private ChatMember oldChatMember;
/**
* New information about the chat member
*/
@JsonProperty(NEWCHATMEMBER_FIELD) @JsonProperty(NEWCHATMEMBER_FIELD)
private ChatMember newChatMember; ///< New information about the chat member private ChatMember newChatMember;
/**
* Optional.
* Chat invite link, which was used by the user to join the chat; for joining by invite link events only.
*/
@JsonProperty(INVITELINK_FIELD) @JsonProperty(INVITELINK_FIELD)
private ChatInviteLink inviteLink; ///< Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events only. private ChatInviteLink inviteLink;
} }

View File

@ -11,11 +11,11 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* @author Ruben Bermudez
* @version 4.4
* Use this method to change the description of a group, supergroup or channel. * Use this method to change the description of a group, supergroup or channel.
* The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. * The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
* Returns True on success. * Returns True on success.
* @author Ruben Bermudez
* @version 4.4
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -34,20 +34,52 @@ public class ChatPermissions implements BotApiObject {
private static final String CAN_INVITE_USERS_FIELD = "can_invite_users"; private static final String CAN_INVITE_USERS_FIELD = "can_invite_users";
private static final String CAN_PIN_MESSAGES_FIELD = "can_pin_messages"; private static final String CAN_PIN_MESSAGES_FIELD = "can_pin_messages";
/**
* Optional.
* True, if the user is allowed to send text messages, contacts, locations and venues
*/
@JsonProperty(CAN_SEND_MESSAGES_FIELD) @JsonProperty(CAN_SEND_MESSAGES_FIELD)
private Boolean canSendMessages; ///< Optional. True, if the user is allowed to send text messages, contacts, locations and venues private Boolean canSendMessages;
/**
* Optional.
* True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages
*/
@JsonProperty(CAN_SEND_MEDIA_MESSAGES_FIELD) @JsonProperty(CAN_SEND_MEDIA_MESSAGES_FIELD)
private Boolean canSendMediaMessages; ///< Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages private Boolean canSendMediaMessages;
/**
* Optional.
* True, if the user is allowed to send polls, implies can_send_messages
*/
@JsonProperty(CAN_SEND_POLLS_FIELD) @JsonProperty(CAN_SEND_POLLS_FIELD)
private Boolean canSendPolls; ///< Optional. True, if the user is allowed to send polls, implies can_send_messages private Boolean canSendPolls;
/**
* Optional.
* True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages
*/
@JsonProperty(CAN_SEND_OTHER_MESSAGES_FIELD) @JsonProperty(CAN_SEND_OTHER_MESSAGES_FIELD)
private Boolean canSendOtherMessages; ///< Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages private Boolean canSendOtherMessages;
/**
* Optional.
* True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages
*/
@JsonProperty(CAN_ADD_WEB_PAGE_PREVIEWS_FIELD) @JsonProperty(CAN_ADD_WEB_PAGE_PREVIEWS_FIELD)
private Boolean canAddWebPagePreviews; ///< Optional. True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages private Boolean canAddWebPagePreviews;
/**
* Optional.
* True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups
*/
@JsonProperty(CAN_CHANGE_INFO_FIELD) @JsonProperty(CAN_CHANGE_INFO_FIELD)
private Boolean canChangeInfo; ///< Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups private Boolean canChangeInfo;
/**
* Optional.
* True, if the user is allowed to invite new users to the chat
*/
@JsonProperty(CAN_INVITE_USERS_FIELD) @JsonProperty(CAN_INVITE_USERS_FIELD)
private Boolean canInviteUsers; ///< Optional. True, if the user is allowed to invite new users to the chat private Boolean canInviteUsers;
/**
* Optional.
* True, if the user is allowed to pin messages. Ignored in public supergroups
*/
@JsonProperty(CAN_PIN_MESSAGES_FIELD) @JsonProperty(CAN_PIN_MESSAGES_FIELD)
private Boolean canPinMessages; ///< Optional. True, if the user is allowed to pin messages. Ignored in public supergroups private Boolean canPinMessages;
} }

View File

@ -10,9 +10,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* This object represents a phone contact.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* This object represents a phone contact.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -28,12 +28,22 @@ public class Contact implements BotApiObject {
private static final String USERID_FIELD = "user_id"; private static final String USERID_FIELD = "user_id";
private static final String VCARD_FIELD = "vcard"; private static final String VCARD_FIELD = "vcard";
/**
* Contact's phone number
*/
@JsonProperty(PHONENUMBER_FIELD) @JsonProperty(PHONENUMBER_FIELD)
private String phoneNumber; ///< Contact's phone number private String phoneNumber;
/**
* Contact's first name
*/
@JsonProperty(FIRSTNAME_FIELD) @JsonProperty(FIRSTNAME_FIELD)
private String firstName; ///< Contact's first name private String firstName;
/**
* Optional.
* Contact's last name
*/
@JsonProperty(LASTNAME_FIELD) @JsonProperty(LASTNAME_FIELD)
private String lastName; ///< Optional. Contact's last name private String lastName;
/** /**
* Optional. * Optional.
* Contact's user identifier in Telegram. * Contact's user identifier in Telegram.
@ -41,8 +51,16 @@ public class Contact implements BotApiObject {
* @apiNote This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. * @apiNote This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it.
* But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. * But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
*/ */
/**
* Optional.
* Contact's user identifier in Telegram
*/
@JsonProperty(USERID_FIELD) @JsonProperty(USERID_FIELD)
private Long userId; ///< Optional. Contact's user identifier in Telegram private Long userId;
/**
* Optional.
* Additional data about the contact in the form of a vCard
*/
@JsonProperty(VCARD_FIELD) @JsonProperty(VCARD_FIELD)
private String vCard; ///< Optional. Additional data about the contact in the form of a vCard private String vCard;
} }

View File

@ -10,9 +10,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* This object represents an animated emoji that displays a random value.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 4.7 * @version 4.7
* This object represents an animated emoji that displays a random value.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -32,6 +32,9 @@ public class Dice implements BotApiObject {
*/ */
@JsonProperty(VALUE_FIELD) @JsonProperty(VALUE_FIELD)
private Integer value; private Integer value;
/**
* Emoji on which the dice throw animation is based
*/
@JsonProperty(EMOJI_FIELD) @JsonProperty(EMOJI_FIELD)
private String emoji; ///< Emoji on which the dice throw animation is based private String emoji;
} }

View File

@ -10,10 +10,10 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* @author Ruben Bermudez
* @version 1.0
* This object represents a general file (as opposed to photos and audio files). * This object represents a general file (as opposed to photos and audio files).
* Telegram users can send files of any type of up to 1.5 GB in size. * Telegram users can send files of any type of up to 1.5 GB in size.
* @author Ruben Bermudez
* @version 1.0
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -30,20 +30,34 @@ public class Document implements BotApiObject {
private static final String MIMETYPE_FIELD = "mime_type"; private static final String MIMETYPE_FIELD = "mime_type";
private static final String FILESIZE_FIELD = "file_size"; private static final String FILESIZE_FIELD = "file_size";
/**
* Identifier for this file, which can be used to download or reuse the file
*/
@JsonProperty(FILEID_FIELD) @JsonProperty(FILEID_FIELD)
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file private String fileId;
/** /**
* 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)
private String fileUniqueId; private String fileUniqueId;
/**
* Document thumbnail as defined by sender
*/
@JsonProperty(THUMB_FIELD) @JsonProperty(THUMB_FIELD)
private PhotoSize thumb; ///< Document thumbnail as defined by sender private PhotoSize thumb;
/**
* Optional.
* Original filename as defined by sender
*/
@JsonProperty(FILENAME_FIELD) @JsonProperty(FILENAME_FIELD)
private String fileName; ///< Optional. Original filename as defined by sender private String fileName;
/**
* Optional.
* Mime type of a file as defined by sender
*/
@JsonProperty(MIMETYPE_FIELD) @JsonProperty(MIMETYPE_FIELD)
private String mimeType; ///< Optional. Mime type of a file as defined by sender private String mimeType;
/** /**
* Optional. * Optional.
* File size in bytes. * File size in bytes.

View File

@ -1,26 +1,68 @@
package org.telegram.telegrambots.meta.api.objects; package org.telegram.telegrambots.meta.api.objects;
/** /**
* Types of messages entities
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* Types of messages entities
*/ */
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
public class EntityType { public class EntityType {
public static final String MENTION = "mention"; ///< @username /**
public static final String HASHTAG = "hashtag"; ///< #hashtag * @username
public static final String CASHTAG = "cashtag"; ///< $USD */
public static final String BOTCOMMAND = "bot_command"; ///< /botcommand public static final String MENTION = "mention";
public static final String URL = "url"; ///< http://url.url /**
public static final String EMAIL = "email"; ///< email@email.com * #hashtag
public static final String PHONENUMBER = "phone_number"; ///< +4299999999 */
public static final String BOLD = "bold"; ///< Bold text public static final String HASHTAG = "hashtag";
public static final String ITALIC = "italic"; ///< Italic text /**
public static final String CODE = "code"; ///< Monowidth string * $USD
public static final String PRE = "pre"; ///< Monowidth block */
public static final String TEXTLINK = "text_link"; ///< Clickable urls public static final String CASHTAG = "cashtag";
public static final String TEXTMENTION = "text_mention"; ///< for users without usernames /**
public static final String SPOILER = "spoiler"; ///< spoiler message * /botcommand
*/
public static final String BOTCOMMAND = "bot_command";
/**
* http://url.url
*/
public static final String URL = "url";
/**
* email@email.com
*/
public static final String EMAIL = "email";
/**
* +4299999999
*/
public static final String PHONENUMBER = "phone_number";
/**
* Bold text
*/
public static final String BOLD = "bold";
/**
* Italic text
*/
public static final String ITALIC = "italic";
/**
* Monowidth string
*/
public static final String CODE = "code";
/**
* Monowidth block
*/
public static final String PRE = "pre";
/**
* Clickable urls
*/
public static final String TEXTLINK = "text_link";
/**
* for users without usernames
*/
public static final String TEXTMENTION = "text_mention";
/**
* spoiler message
*/
public static final String SPOILER = "spoiler";
private EntityType() { private EntityType() {
} }

View File

@ -13,9 +13,9 @@ import java.security.InvalidParameterException;
import java.text.MessageFormat; import java.text.MessageFormat;
/** /**
* This object represents a file ready to be downloaded
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* This object represents a file ready to be downloaded
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -29,8 +29,11 @@ public class File implements BotApiObject {
private static final String FILE_SIZE_FIELD = "file_size"; private static final String FILE_SIZE_FIELD = "file_size";
private static final String FILE_PATH_FIELD = "file_path"; private static final String FILE_PATH_FIELD = "file_path";
/**
* Identifier for this file, which can be used to download or reuse the file
*/
@JsonProperty(FILEID_FIELD) @JsonProperty(FILEID_FIELD)
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file private String fileId;
/** /**
* 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.
@ -45,8 +48,11 @@ public class File implements BotApiObject {
*/ */
@JsonProperty(FILE_SIZE_FIELD) @JsonProperty(FILE_SIZE_FIELD)
private Long fileSize; private Long fileSize;
/**
* Optional. File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file.
*/
@JsonProperty(FILE_PATH_FIELD) @JsonProperty(FILE_PATH_FIELD)
private String filePath; ///< Optional. File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file. private String filePath;
public String getFileUrl(String botToken) { public String getFileUrl(String botToken) {
return getFileUrl(botToken, filePath); return getFileUrl(botToken, filePath);

View File

@ -14,10 +14,9 @@ import java.io.File;
import java.io.InputStream; import java.io.InputStream;
/** /**
* Input file used to upload a file to Telegram server and use it afterwards
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 4.0.0 * @version 4.0.0
*
* Input file used to upload a file to Telegram server and use it afterwards
*/ */
@SuppressWarnings({"WeakerAccess", "UnusedReturnValue"}) @SuppressWarnings({"WeakerAccess", "UnusedReturnValue"})
@JsonSerialize(using = InputFileSerializer.class, as = String.class) @JsonSerialize(using = InputFileSerializer.class, as = String.class)
@ -29,14 +28,26 @@ public class InputFile implements Validable, BotApiObject {
private String attachName; private String attachName;
/**
* Name of the media to upload
*/
@JsonIgnore @JsonIgnore
private String mediaName; ///< Name of the media to upload private String mediaName;
/**
* New media file
*/
@JsonIgnore @JsonIgnore
private File newMediaFile; ///< New media file private File newMediaFile;
/**
* New media stream
*/
@JsonIgnore @JsonIgnore
private InputStream newMediaStream; ///< New media stream private InputStream newMediaStream;
/**
* True if the file is new, false if it is a file_id
*/
@JsonIgnore @JsonIgnore
private boolean isNew; ///< True if the file is new, false if it is a file_id private boolean isNew;
public InputFile(String attachName) { public InputFile(String attachName) {
this(); this();

View File

@ -11,9 +11,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* This object represents a point on the map.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* This object represents a point on the map.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -30,12 +30,18 @@ public class Location implements BotApiObject {
private static final String HEADING_FIELD = "heading"; private static final String HEADING_FIELD = "heading";
private static final String PROXMITYALERTRADIUS_FIELD = "proximity_alert_radius"; private static final String PROXMITYALERTRADIUS_FIELD = "proximity_alert_radius";
/**
* Longitude as defined by sender
*/
@JsonProperty(LONGITUDE_FIELD) @JsonProperty(LONGITUDE_FIELD)
@NonNull @NonNull
private Double longitude; ///< Longitude as defined by sender private Double longitude;
/**
* Latitude as defined by sender
*/
@JsonProperty(LATITUDE_FIELD) @JsonProperty(LATITUDE_FIELD)
@NonNull @NonNull
private Double latitude; ///< Latitude as defined by sender private Double latitude;
/** /**
* Optional. * Optional.
* The radius of uncertainty for the location, measured in meters; 0-1500 * The radius of uncertainty for the location, measured in meters; 0-1500

View File

@ -9,6 +9,9 @@ import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import lombok.ToString; import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
import org.telegram.telegrambots.meta.api.objects.forum.ForumTopicClosed;
import org.telegram.telegrambots.meta.api.objects.forum.ForumTopicCreated;
import org.telegram.telegrambots.meta.api.objects.forum.ForumTopicReopened;
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;
import org.telegram.telegrambots.meta.api.objects.passport.PassportData; import org.telegram.telegrambots.meta.api.objects.passport.PassportData;
@ -27,9 +30,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* This object represents a message.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* This object represents a message.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -39,6 +42,7 @@ import java.util.List;
@AllArgsConstructor @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 MESSAGETHREADID_FIELD = "message_thread_id";
private static final String FROM_FIELD = "from"; private static final String FROM_FIELD = "from";
private static final String DATE_FIELD = "date"; private static final String DATE_FIELD = "date";
private static final String CHAT_FIELD = "chat"; private static final String CHAT_FIELD = "chat";
@ -97,84 +101,191 @@ public class Message implements BotApiObject {
private static final String VIDEOCHATSTARTED_FIELD = "video_chat_started"; private static final String VIDEOCHATSTARTED_FIELD = "video_chat_started";
private static final String VIDEOCHATENDED_FIELD = "video_chat_ended"; private static final String VIDEOCHATENDED_FIELD = "video_chat_ended";
private static final String VIDEOCHATPARTICIPANTSINVITED_FIELD = "video_chat_participants_invited"; private static final String VIDEOCHATPARTICIPANTSINVITED_FIELD = "video_chat_participants_invited";
private static final String ISTOPICMESSAGE_FIELD = "is_topic_message";
private static final String FORUMTOPICCREATED_FIELD = "forum_topic_created";
private static final String FORUMTOPICCLOSED_FIELD = "forum_topic_closed";
private static final String FORUMTOPICREOPENED_FIELD = "forum_topic_reopened";
private static final String VIEWS_FIELD = "views"; private static final String VIEWS_FIELD = "views";
private static final String OUTGOING_FIELD = "outgoing"; private static final String OUTGOING_FIELD = "outgoing";
/**
* Integer Unique message identifier
*/
@JsonProperty(MESSAGEID_FIELD) @JsonProperty(MESSAGEID_FIELD)
private Integer messageId; ///< Integer Unique message identifier private Integer messageId;
/**
* Optional.
* Unique identifier of a message thread or a forum topic to which the message belongs;
* for supergroups only
*/
@JsonProperty(MESSAGETHREADID_FIELD)
private Integer messageThreadId;
/**
* Optional.
* Sender, can be empty for messages sent to channels
*/
@JsonProperty(FROM_FIELD) @JsonProperty(FROM_FIELD)
private User from; ///< Optional. Sender, can be empty for messages sent to channels private User from;
/**
* Date the message was sent in Unix time
*/
@JsonProperty(DATE_FIELD) @JsonProperty(DATE_FIELD)
private Integer date; ///< Date the message was sent in Unix time private Integer date;
/**
* Conversation the message belongs to
*/
@JsonProperty(CHAT_FIELD) @JsonProperty(CHAT_FIELD)
private Chat chat; ///< Conversation the message belongs to private Chat chat;
/**
* Optional.
* For forwarded messages, sender of the original message
*/
@JsonProperty(FORWARDFROM_FIELD) @JsonProperty(FORWARDFROM_FIELD)
private User forwardFrom; ///< Optional. For forwarded messages, sender of the original message private User forwardFrom;
/** /**
* Optional. * Optional.
* For messages forwarded from channels or from anonymous administrators, information about the original sender chat * For messages forwarded from channels or from anonymous administrators, information about the original sender chat
*/ */
@JsonProperty(FORWARDFROMCHAT_FIELD) @JsonProperty(FORWARDFROMCHAT_FIELD)
private Chat forwardFromChat; private Chat forwardFromChat;
@JsonProperty(FORWARDDATE_FIELD)
private Integer forwardDate; ///< Optional. For forwarded messages, date the original message was sent
@JsonProperty(TEXT_FIELD)
private String text; ///< Optional. For text messages, the actual UTF-8 text of the message
/** /**
* Optional. For text messages, special entities like usernames, URLs, * Optional.
* For forwarded messages, date the original message was sent
*/
@JsonProperty(FORWARDDATE_FIELD)
private Integer forwardDate;
/**
* Optional.
* For text messages, the actual UTF-8 text of the message
*/
@JsonProperty(TEXT_FIELD)
private String text;
/**
* Optional.
* For text messages, special entities like usernames, URLs,
* bot commands, etc. that appear in the text * bot commands, etc. that appear in the text
*/ */
@JsonProperty(ENTITIES_FIELD) @JsonProperty(ENTITIES_FIELD)
private List<MessageEntity> entities; private List<MessageEntity> entities;
/** /**
* Optional. For messages with a caption, special entities like usernames, * Optional.
* For messages with a caption, special entities like usernames,
* URLs, bot commands, etc. that appear in the caption * URLs, bot commands, etc. that appear in the caption
*/ */
@JsonProperty(CAPTIONENTITIES_FIELD) @JsonProperty(CAPTIONENTITIES_FIELD)
private List<MessageEntity> captionEntities; private List<MessageEntity> captionEntities;
@JsonProperty(AUDIO_FIELD)
private Audio audio; ///< Optional. Message is an audio file, information about the file
@JsonProperty(DOCUMENT_FIELD)
private Document document; ///< Optional. Message is a general file, information about the file
@JsonProperty(PHOTO_FIELD)
private List<PhotoSize> photo; ///< Optional. Message is a photo, available sizes of the photo
@JsonProperty(STICKER_FIELD)
private Sticker sticker; ///< Optional. Message is a sticker, information about the sticker
@JsonProperty(VIDEO_FIELD)
private Video video; ///< Optional. Message is a video, information about the video
@JsonProperty(CONTACT_FIELD)
private Contact contact; ///< Optional. Message is a shared contact, information about the contact
@JsonProperty(LOCATION_FIELD)
private Location location; ///< Optional. Message is a shared location, information about the location
@JsonProperty(VENUE_FIELD)
private Venue venue; ///< Optional. Message is a venue, information about the venue
/** /**
* Optional. Message is an animation, information about the animation. * Optional.
* Message is an audio file, information about the file
*/
@JsonProperty(AUDIO_FIELD)
private Audio audio;
/**
* Optional.
* Message is a general file, information about the file
*/
@JsonProperty(DOCUMENT_FIELD)
private Document document;
/**
* Optional.
* Message is a photo, available sizes of the photo
*/
@JsonProperty(PHOTO_FIELD)
private List<PhotoSize> photo;
/**
* Optional.
* Message is a sticker, information about the sticker
*/
@JsonProperty(STICKER_FIELD)
private Sticker sticker;
/**
* Optional.
* Message is a video, information about the video
*/
@JsonProperty(VIDEO_FIELD)
private Video video;
/**
* Optional.
* Message is a shared contact, information about the contact
*/
@JsonProperty(CONTACT_FIELD)
private Contact contact;
/**
* Optional.
* Message is a shared location, information about the location
*/
@JsonProperty(LOCATION_FIELD)
private Location location;
/**
* Optional.
* Message is a venue, information about the venue
*/
@JsonProperty(VENUE_FIELD)
private Venue venue;
/**
* Optional.
* Message is an animation, information about the animation.
* For backward compatibility, when this field is set, the document field will be also set * For backward compatibility, when this field is set, the document field will be also set
*/ */
@JsonProperty(ANIMATION_FIELD) @JsonProperty(ANIMATION_FIELD)
private Animation animation; private Animation animation;
/**
* Optional.
* Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply.
*/
@JsonProperty(PINNED_MESSAGE_FIELD) @JsonProperty(PINNED_MESSAGE_FIELD)
private Message pinnedMessage; ///< Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. private Message pinnedMessage;
/**
* Optional.
* New members were added to the group or supergroup, information about them (the bot itself may be one of these members)
*/
@JsonProperty(NEWCHATMEMBERS_FIELD) @JsonProperty(NEWCHATMEMBERS_FIELD)
private List<User> newChatMembers; ///< Optional. New members were added to the group or supergroup, information about them (the bot itself may be one of these members) private List<User> newChatMembers;
/**
* Optional.
* A member was removed from the group, information about them (this member may be bot itself)
*/
@JsonProperty(LEFTCHATMEMBER_FIELD) @JsonProperty(LEFTCHATMEMBER_FIELD)
private User leftChatMember; ///< Optional. A member was removed from the group, information about them (this member may be bot itself) private User leftChatMember;
/**
* Optional.
* A chat title was changed to this value
*/
@JsonProperty(NEWCHATTITLE_FIELD) @JsonProperty(NEWCHATTITLE_FIELD)
private String newChatTitle; ///< Optional. A chat title was changed to this value private String newChatTitle;
/**
* Optional.
* A chat photo was change to this value
*/
@JsonProperty(NEWCHATPHOTO_FIELD) @JsonProperty(NEWCHATPHOTO_FIELD)
private List<PhotoSize> newChatPhoto; ///< Optional. A chat photo was change to this value private List<PhotoSize> newChatPhoto;
/**
* Optional.
* Informs that the chat photo was deleted
*/
@JsonProperty(DELETECHATPHOTO_FIELD) @JsonProperty(DELETECHATPHOTO_FIELD)
private Boolean deleteChatPhoto; ///< Optional. Informs that the chat photo was deleted private Boolean deleteChatPhoto;
/**
* Optional.
* Informs that the group has been created
*/
@JsonProperty(GROUPCHATCREATED_FIELD) @JsonProperty(GROUPCHATCREATED_FIELD)
private Boolean groupchatCreated; ///< Optional. Informs that the group has been created private Boolean groupchatCreated;
@JsonProperty(REPLYTOMESSAGE_FIELD) @JsonProperty(REPLYTOMESSAGE_FIELD)
private Message replyToMessage; private Message replyToMessage;
/**
* Optional.
* Message is a voice message, information about the file
*/
@JsonProperty(VOICE_FIELD) @JsonProperty(VOICE_FIELD)
private Voice voice; ///< Optional. Message is a voice message, information about the file private Voice voice;
/**
* Optional.
* Caption for the document, photo or video, 0-200 characters
*/
@JsonProperty(CAPTION_FIELD) @JsonProperty(CAPTION_FIELD)
private String caption; ///< Optional. Caption for the document, photo or video, 0-200 characters private String caption;
/** /**
* Optional. Service message: the supergroup has been created. * Optional. Service message: the supergroup has been created.
* This field cant be received in a message coming through updates, * This field cant be received in a message coming through updates,
@ -201,7 +312,7 @@ public class Message implements BotApiObject {
* float type are safe for storing this identifier. * float type are safe for storing this identifier.
*/ */
@JsonProperty(MIGRATETOCHAT_FIELD) @JsonProperty(MIGRATETOCHAT_FIELD)
private Long migrateToChatId; ///< Optional. The chat has been migrated to a chat with specified identifier, not exceeding 1e13 by absolute value private Long migrateToChatId;
/** /**
* Optional. The supergroup has been migrated from a group with the specified identifier. * Optional. The supergroup has been migrated from a group with the specified identifier.
* This number may be greater than 32 bits and some programming languages * This number may be greater than 32 bits and some programming languages
@ -210,37 +321,85 @@ public class Message implements BotApiObject {
* float type are safe for storing this identifier. * float type are safe for storing this identifier.
*/ */
@JsonProperty(MIGRATEFROMCHAT_FIELD) @JsonProperty(MIGRATEFROMCHAT_FIELD)
private Long migrateFromChatId; ///< Optional. The chat has been migrated from a chat with specified identifier, not exceeding 1e13 by absolute value private Long migrateFromChatId;
/**
* Optional.
* Date the message was last edited in Unix time
*/
@JsonProperty(EDITDATE_FIELD) @JsonProperty(EDITDATE_FIELD)
private Integer editDate; ///< Optional. Date the message was last edited in Unix time private Integer editDate;
/**
* Optional.
* Message is a game, information about the game
*/
@JsonProperty(GAME_FIELD) @JsonProperty(GAME_FIELD)
private Game game; ///< Optional. Message is a game, information about the game private Game game;
/**
* Optional.
* For forwarded channel posts, identifier of the original message in the channel
*/
@JsonProperty(FORWARDFROMMESSAGEID_FIELD) @JsonProperty(FORWARDFROMMESSAGEID_FIELD)
private Integer forwardFromMessageId; ///< Optional. For forwarded channel posts, identifier of the original message in the channel private Integer forwardFromMessageId;
/**
* Optional.
* Message is an invoice for a payment, information about the invoice.
*/
@JsonProperty(INVOICE_FIELD) @JsonProperty(INVOICE_FIELD)
private Invoice invoice; ///< Optional. Message is an invoice for a payment, information about the invoice. private Invoice invoice;
/**
* Optional.
* Message is a service message about a successful payment, information about the payment.
*/
@JsonProperty(SUCCESSFUL_PAYMENT_FIELD) @JsonProperty(SUCCESSFUL_PAYMENT_FIELD)
private SuccessfulPayment successfulPayment; ///< Optional. Message is a service message about a successful payment, information about the payment. private SuccessfulPayment successfulPayment;
/**
* Optional.
* Message is a video note, information about the video message
*/
@JsonProperty(VIDEO_NOTE_FIELD) @JsonProperty(VIDEO_NOTE_FIELD)
private VideoNote videoNote; ///< Optional. Message is a video note, information about the video message private VideoNote videoNote;
/** /**
* Optional. * Optional.
* Signature of the post author for messages in channels, or the custom title of an anonymous group administrator * Signature of the post author for messages in channels, or the custom title of an anonymous group administrator
*/ */
@JsonProperty(AUTHORSIGNATURE_FIELD) @JsonProperty(AUTHORSIGNATURE_FIELD)
private String authorSignature; private String authorSignature;
/**
* Optional.
* Post author signature for messages forwarded from channel chats
*/
@JsonProperty(FORWARDSIGNATURE_FIELD) @JsonProperty(FORWARDSIGNATURE_FIELD)
private String forwardSignature; ///< Optional. Post author signature for messages forwarded from channel chats private String forwardSignature;
/**
* Optional.
* The unique identifier of a media message group this message belongs to
*/
@JsonProperty(MEDIAGROUPID_FIELD) @JsonProperty(MEDIAGROUPID_FIELD)
private String mediaGroupId; ///< Optional. The unique identifier of a media message group this message belongs to private String mediaGroupId;
/**
* Optional.
* The domain name of the website on which the user has logged in
*/
@JsonProperty(CONNECTEDWEBSITE_FIELD) @JsonProperty(CONNECTEDWEBSITE_FIELD)
private String connectedWebsite; ///< Optional. The domain name of the website on which the user has logged in private String connectedWebsite;
/**
* Optional.
* Telegram Passport data
*/
@JsonProperty(PASSPORTDATA_FIELD) @JsonProperty(PASSPORTDATA_FIELD)
private PassportData passportData; ///< Optional. Telegram Passport data private PassportData passportData;
/**
* Optional.
* Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages.
*/
@JsonProperty(FORWARDSENDERNAME_FIELD) @JsonProperty(FORWARDSENDERNAME_FIELD)
private String forwardSenderName; ///< Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages. private String forwardSenderName;
/**
* Optional.
* Message is a native poll, information about the poll
*/
@JsonProperty(POLL_FIELD) @JsonProperty(POLL_FIELD)
private Poll poll; ///< Optional. Message is a native poll, information about the poll private Poll poll;
/** /**
* Inline keyboard attached to the message. * Inline keyboard attached to the message.
* *
@ -248,10 +407,18 @@ public class Message implements BotApiObject {
*/ */
@JsonProperty(REPLY_MARKUP_FIELD) @JsonProperty(REPLY_MARKUP_FIELD)
private InlineKeyboardMarkup replyMarkup; private InlineKeyboardMarkup replyMarkup;
/**
* Optional.
* Message is a dice with random value from 1 to 6
*/
@JsonProperty(DICE_FIELD) @JsonProperty(DICE_FIELD)
private Dice dice; // Optional. Message is a dice with random value from 1 to 6 private Dice dice;
/**
* Optional.
* Bot through which the message was sent
*/
@JsonProperty(VIABOT_FIELD) @JsonProperty(VIABOT_FIELD)
private User viaBot; // Optional. Bot through which the message was sent private User viaBot;
/** /**
* Optional. * Optional.
* Sender of the message, sent on behalf of a chat. The channel itself for channel messages. * Sender of the message, sent on behalf of a chat. The channel itself for channel messages.
@ -267,26 +434,78 @@ public class Message implements BotApiObject {
*/ */
@JsonProperty(PROXIMITYALERTTRIGGERED_FIELD) @JsonProperty(PROXIMITYALERTTRIGGERED_FIELD)
private ProximityAlertTriggered proximityAlertTriggered; private ProximityAlertTriggered proximityAlertTriggered;
/**
* Optional.
* Service message: auto-delete timer settings changed in the chat
*/
@JsonProperty(MESSAGEAUTODELETETIMERCHANGED_FIELD) @JsonProperty(MESSAGEAUTODELETETIMERCHANGED_FIELD)
private MessageAutoDeleteTimerChanged messageAutoDeleteTimerChanged; ///< Optional. Service message: auto-delete timer settings changed in the chat private MessageAutoDeleteTimerChanged messageAutoDeleteTimerChanged;
@JsonProperty(ISAUTOMATICFORWARD_FIELD)
/** /**
* Optional. * Optional.
* True, if the message is a channel post that was automatically forwarded to the connected discussion group * True, if the message is a channel post that was automatically forwarded to the connected discussion group
*/ */
@JsonProperty(ISAUTOMATICFORWARD_FIELD)
private Boolean isAutomaticForward; private Boolean isAutomaticForward;
/**
* Optional.
* True, if the message can't be forwarded
*/
@JsonProperty(HASPROTECTEDCONTENT_FIELD) @JsonProperty(HASPROTECTEDCONTENT_FIELD)
private Boolean hasProtectedContent; ///< Optional. True, if the message can't be forwarded private Boolean hasProtectedContent;
/**
* Optional.
* Service message: data sent by a web app
*/
@JsonProperty(WEBAPPDATA_FIELD) @JsonProperty(WEBAPPDATA_FIELD)
private WebAppData webAppData; ///< Optional. Service message: data sent by a web app private WebAppData webAppData;
/**
* Optional.
* Service message: video chat started
*/
@JsonProperty(VIDEOCHATSTARTED_FIELD) @JsonProperty(VIDEOCHATSTARTED_FIELD)
private VideoChatStarted videoChatStarted; ///< Optional. Service message: video chat started private VideoChatStarted videoChatStarted;
/**
* Optional.
* Service message: video chat ended
*/
@JsonProperty(VIDEOCHATENDED_FIELD) @JsonProperty(VIDEOCHATENDED_FIELD)
private VideoChatEnded videoChatEnded; ///< Optional. Service message: video chat ended private VideoChatEnded videoChatEnded;
/**
* Optional.
* Service message: new participants invited to a video chat
*/
@JsonProperty(VIDEOCHATPARTICIPANTSINVITED_FIELD) @JsonProperty(VIDEOCHATPARTICIPANTSINVITED_FIELD)
private VideoChatParticipantsInvited videoChatParticipantsInvited; ///< Optional. Service message: new participants invited to a video chat private VideoChatParticipantsInvited videoChatParticipantsInvited;
/**
* Optional.
* Service message: video chat scheduled
*/
@JsonProperty(VIDEOCHATSCHEDULED_FIELD) @JsonProperty(VIDEOCHATSCHEDULED_FIELD)
private VideoChatScheduled videoChatScheduled; ///< Optional. Service message: video chat scheduled private VideoChatScheduled videoChatScheduled;
/**
* Optional.
* True, if the message is sent to a forum topic
*/
@JsonProperty(ISTOPICMESSAGE_FIELD)
private Boolean isTopicMessage;
/**
* Optional.
* Service message: forum topic created
*/
@JsonProperty(FORUMTOPICCREATED_FIELD)
private ForumTopicCreated forumTopicCreated;
/**
* Optional.
* Service message: forum topic closed
*/
@JsonProperty(FORUMTOPICCLOSED_FIELD)
private ForumTopicClosed forumTopicClosed;
/**
* Optional.
* Service message: forum topic reopened
*/
@JsonProperty(FORUMTOPICREOPENED_FIELD)
private ForumTopicReopened forumTopicReopened;
@JsonProperty(OUTGOING_FIELD) @JsonProperty(OUTGOING_FIELD)
private Boolean outgoing; ///< Optional. Extra. private Boolean outgoing; ///< Optional. Extra.
@ -318,6 +537,11 @@ public class Message implements BotApiObject {
return sticker != null; return sticker != null;
} }
@JsonIgnore
public boolean isTopicMessage() {
return isTopicMessage != null && isTopicMessage;
}
@JsonIgnore @JsonIgnore
public boolean isGroupMessage() { public boolean isGroupMessage() {
return chat.isGroupChat(); return chat.isGroupChat();
@ -485,4 +709,19 @@ public class Message implements BotApiObject {
private boolean hasVideoChatParticipantsInvited() { private boolean hasVideoChatParticipantsInvited() {
return videoChatParticipantsInvited != null; return videoChatParticipantsInvited != null;
} }
@JsonIgnore
private boolean hasForumTopicCreated() {
return forumTopicCreated != null;
}
@JsonIgnore
private boolean hasForumTopicClosed() {
return forumTopicClosed != null;
}
@JsonIgnore
private boolean hasForumTopicReopened() {
return forumTopicReopened != null;
}
} }

View File

@ -10,10 +10,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* This object represents a service message about a change in auto-delete timer settings.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 5.1 * @version 5.1
*
* This object represents a service message about a change in auto-delete timer settings.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -24,6 +23,9 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
public class MessageAutoDeleteTimerChanged implements BotApiObject { public class MessageAutoDeleteTimerChanged implements BotApiObject {
private static final String MESSAGEAUTODELETETIME_FIELD = "message_auto_delete_time"; private static final String MESSAGEAUTODELETETIME_FIELD = "message_auto_delete_time";
/**
* New auto-delete time for messages in the chat
*/
@JsonProperty(MESSAGEAUTODELETETIME_FIELD) @JsonProperty(MESSAGEAUTODELETETIME_FIELD)
private Integer messageAutoDeleteTime; ///< New auto-delete time for messages in the chat private Integer messageAutoDeleteTime;
} }

View File

@ -21,10 +21,10 @@ import org.telegram.telegrambots.meta.MemoizedUTF16Substring;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* @author Ruben Bermudez
* @version 1.0
* This object represents one special entity in a text message. For example, hashtags, * This object represents one special entity in a text message. For example, hashtags,
* usernames, URL. * usernames, URL.
* @author Ruben Bermudez
* @version 1.0
*/ */
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ -67,18 +67,36 @@ public class MessageEntity implements BotApiObject {
@JsonProperty(TYPE_FIELD) @JsonProperty(TYPE_FIELD)
@NonNull @NonNull
private String type; private String type;
/**
* Offset in UTF-16 code units to the start of the entity
*/
@JsonProperty(OFFSET_FIELD) @JsonProperty(OFFSET_FIELD)
@NonNull @NonNull
private Integer offset; ///< Offset in UTF-16 code units to the start of the entity private Integer offset;
/**
* Length of the entity in UTF-16 code units
*/
@JsonProperty(LENGTH_FIELD) @JsonProperty(LENGTH_FIELD)
@NonNull @NonNull
private Integer length; ///< Length of the entity in UTF-16 code units private Integer length;
/**
* Optional.
* For text_link only, url that will be opened after user taps on the text
*/
@JsonProperty(URL_FIELD) @JsonProperty(URL_FIELD)
private String url; ///< Optional. For text_link only, url that will be opened after user taps on the text private String url;
/**
* Optional.
* For text_mention only, the mentioned user
*/
@JsonProperty(USER_FIELD) @JsonProperty(USER_FIELD)
private User user; ///< Optional. For text_mention only, the mentioned user private User user;
/**
* Optional.
* For pre only, the programming language of the entity text
*/
@JsonProperty(LANGUAGE_FIELD) @JsonProperty(LANGUAGE_FIELD)
private String language; ///< Optional. For pre only, the programming language of the entity text private String language;
/** /**
* Optional. * Optional.
* For custom_emoji only, unique identifier of the custom emoji. * For custom_emoji only, unique identifier of the custom emoji.
@ -86,6 +104,9 @@ public class MessageEntity implements BotApiObject {
*/ */
@JsonProperty(CUSTOMEMOJI_FIELD) @JsonProperty(CUSTOMEMOJI_FIELD)
private String customEmojiId; private String customEmojiId;
/**
* Text present in the entity. Computed from offset and length
*/
@Setter(AccessLevel.NONE) @Setter(AccessLevel.NONE)
@JsonIgnore @JsonIgnore
private MemoizedUTF16Substring text; ///< Text present in the entity. Computed from offset and length private MemoizedUTF16Substring text; ///< Text present in the entity. Computed from offset and length

View File

@ -10,9 +10,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* This object represents a unique message identifier.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 5.0 * @version 5.0
* This object represents a unique message identifier.
*/ */
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ -25,7 +25,10 @@ public class MessageId implements BotApiObject {
private static final String MESSAGEID_FIELD = "message_id"; private static final String MESSAGEID_FIELD = "message_id";
/**
* Unique message identifier
*/
@JsonProperty(MESSAGEID_FIELD) @JsonProperty(MESSAGEID_FIELD)
private Long messageId; ///< Unique message identifier private Long messageId;
} }

View File

@ -10,9 +10,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* This object represents one size of a photo or a file / sticker thumbnail.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* This object represents one size of a photo or a file / sticker thumbnail.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -31,20 +31,36 @@ public class PhotoSize implements BotApiObject {
private static final String DATE_FIELD = "date"; private static final String DATE_FIELD = "date";
/**
* Identifier for this file, which can be used to download or reuse the file
*/
@JsonProperty(FILEID_FIELD) @JsonProperty(FILEID_FIELD)
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file private String fileId;
/** /**
* 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)
private String fileUniqueId; private String fileUniqueId;
/**
* Photo width
*/
@JsonProperty(WIDTH_FIELD) @JsonProperty(WIDTH_FIELD)
private Integer width; ///< Photo width private Integer width;
/**
* Photo height
*/
@JsonProperty(HEIGHT_FIELD) @JsonProperty(HEIGHT_FIELD)
private Integer height; ///< Photo height private Integer height;
/**
* Optional.
* File size
*/
@JsonProperty(FILESIZE_FIELD) @JsonProperty(FILESIZE_FIELD)
private Integer fileSize; ///< Optional. File size private Integer fileSize;
/**
* Undocumented field. Optional. Can contain the path to download the file directly without calling to getFile
*/
@JsonProperty(FILEPATH_FIELD) @JsonProperty(FILEPATH_FIELD)
private String filePath; ///< Undocumented field. Optional. Can contain the path to download the file directly without calling to getFile private String filePath; ///< Undocumented field. Optional. Can contain the path to download the file directly without calling to getFile

View File

@ -10,10 +10,10 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* @author Ruben Bermudez
* @version 5.0
* This object represents the content of a service message, * This object represents the content of a service message,
* sent whenever a user in the chat triggers a proximity alert set by another user. * sent whenever a user in the chat triggers a proximity alert set by another user.
* @author Ruben Bermudez
* @version 5.0
*/ */
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ -28,10 +28,19 @@ public class ProximityAlertTriggered implements BotApiObject {
private static final String WATCHER_FIELD = "watcher"; private static final String WATCHER_FIELD = "watcher";
private static final String DISTANCE_FIELD = "distance"; private static final String DISTANCE_FIELD = "distance";
/**
* User that triggered the alert
*/
@JsonProperty(TRAVELER_FIELD) @JsonProperty(TRAVELER_FIELD)
private User traveler; ///< User that triggered the alert private User traveler;
/**
* User that set the alert
*/
@JsonProperty(WATCHER_FIELD) @JsonProperty(WATCHER_FIELD)
private User watcher; ///< User that set the alert private User watcher;
/**
* The distance between the users
*/
@JsonProperty(DISTANCE_FIELD) @JsonProperty(DISTANCE_FIELD)
private Integer distance; ///< The distance between the users private Integer distance;
} }

View File

@ -28,9 +28,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* Contains information about why a request was unsuccessfull.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* Contains information about why a request was unsuccessfull.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter

View File

@ -17,12 +17,10 @@ import org.telegram.telegrambots.meta.api.objects.polls.Poll;
import org.telegram.telegrambots.meta.api.objects.polls.PollAnswer; import org.telegram.telegrambots.meta.api.objects.polls.PollAnswer;
/** /**
* This object represents an incoming update.
* @apiNote Only one of the optional parameters can be present in any given update.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
*
* This object represents an incoming update.
*
* @apiNote Only one of the optional parameters can be present in any given update.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -51,24 +49,64 @@ public class Update implements BotApiObject {
@JsonProperty(UPDATEID_FIELD) @JsonProperty(UPDATEID_FIELD)
private Integer updateId; private Integer updateId;
/**
* Optional.
* New incoming message of any kind text, photo, sticker, etc.
*/
@JsonProperty(MESSAGE_FIELD) @JsonProperty(MESSAGE_FIELD)
private Message message; ///< Optional. New incoming message of any kind text, photo, sticker, etc. private Message message;
/**
* Optional.
* New incoming inline query
*/
@JsonProperty(INLINEQUERY_FIELD) @JsonProperty(INLINEQUERY_FIELD)
private InlineQuery inlineQuery; ///< Optional. New incoming inline query private InlineQuery inlineQuery;
/**
* Optional.
* The result of an inline query that was chosen by a user and sent to their chat partner
*/
@JsonProperty(CHOSENINLINEQUERY_FIELD) @JsonProperty(CHOSENINLINEQUERY_FIELD)
private ChosenInlineQuery chosenInlineQuery; ///< Optional. The result of a inline query that was chosen by a user and sent to their chat partner private ChosenInlineQuery chosenInlineQuery;
/**
* Optional.
* New incoming callback query
*/
@JsonProperty(CALLBACKQUERY_FIELD) @JsonProperty(CALLBACKQUERY_FIELD)
private CallbackQuery callbackQuery; ///< Optional. New incoming callback query private CallbackQuery callbackQuery;
/**
* Optional.
* New version of a message that is known to the bot and was edited
*/
@JsonProperty(EDITEDMESSAGE_FIELD) @JsonProperty(EDITEDMESSAGE_FIELD)
private Message editedMessage; ///< Optional. New version of a message that is known to the bot and was edited private Message editedMessage;
/**
* Optional.
* New incoming channel post of any kind text, photo, sticker, etc.
*/
@JsonProperty(CHANNELPOST_FIELD) @JsonProperty(CHANNELPOST_FIELD)
private Message channelPost; ///< Optional. New incoming channel post of any kind text, photo, sticker, etc. private Message channelPost;
/**
* Optional.
* New version of a channel post that is known to the bot and was edited
*/
@JsonProperty(EDITEDCHANNELPOST_FIELD) @JsonProperty(EDITEDCHANNELPOST_FIELD)
private Message editedChannelPost; ///< Optional. New version of a channel post that is known to the bot and was edited private Message editedChannelPost;
/**
* Optional.
* New incoming shipping query. Only for invoices with flexible price
*/
@JsonProperty(SHIPPING_QUERY_FIELD) @JsonProperty(SHIPPING_QUERY_FIELD)
private ShippingQuery shippingQuery; ///< Optional. New incoming shipping query. Only for invoices with flexible price private ShippingQuery shippingQuery;
/**
* Optional.
* New incoming pre-checkout query. Contains full information about checkout
*/
@JsonProperty(PRE_CHECKOUT_QUERY_FIELD) @JsonProperty(PRE_CHECKOUT_QUERY_FIELD)
private PreCheckoutQuery preCheckoutQuery; ///< Optional. New incoming pre-checkout query. Contains full information about checkout private PreCheckoutQuery preCheckoutQuery;
/**
* Optional.
* New poll state. Bots receive only updates about polls, which are sent by the bot.
*/
@JsonProperty(POLL_FIELD) @JsonProperty(POLL_FIELD)
private Poll poll; ///< Optional. New poll state. Bots receive only updates about polls, which are sent by the bot. private Poll poll; ///< Optional. New poll state. Bots receive only updates about polls, which are sent by the bot.
@JsonProperty(EXTRA_SUPER_CHAT_INFO_FIELD) @JsonProperty(EXTRA_SUPER_CHAT_INFO_FIELD)
@ -85,7 +123,6 @@ public class Update implements BotApiObject {
private PollAnswer pollAnswer; private PollAnswer pollAnswer;
/** /**
* Optional. * Optional.
*
* The bot's chat member status was updated in a chat. * The bot's chat member status was updated in a chat.
* For private chats, this update is received only when the bot is blocked or unblocked by the user. * For private chats, this update is received only when the bot is blocked or unblocked by the user.
*/ */
@ -93,7 +130,6 @@ public class Update implements BotApiObject {
private ChatMemberUpdated myChatMember; private ChatMemberUpdated myChatMember;
/** /**
* Optional. * Optional.
*
* A chat member's status was updated in a chat. * A chat member's status was updated in a chat.
* The bot must be an administrator in the chat and must explicitly specify chat_member in the list of allowed_updates to receive these updates. * The bot must be an administrator in the chat and must explicitly specify chat_member in the list of allowed_updates to receive these updates.
*/ */

View File

@ -12,9 +12,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* This object represents a Telegram user or bot.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 6.1 * @version 6.1
* This object represents a Telegram user or bot.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -51,29 +51,59 @@ public class User implements BotApiObject {
*/ */
@JsonProperty(ID_FIELD) @JsonProperty(ID_FIELD)
@NonNull @NonNull
private Long id; ///< Unique identifier for this user or bot private Long id;
/**
* Users or bots first name
*/
@JsonProperty(FIRSTNAME_FIELD) @JsonProperty(FIRSTNAME_FIELD)
@NonNull @NonNull
private String firstName; ///< Users or bots first name private String firstName;
/**
* True, if this user is a bot
*/
@JsonProperty(ISBOT_FIELD) @JsonProperty(ISBOT_FIELD)
@NonNull @NonNull
private Boolean isBot; ///< True, if this user is a bot private Boolean isBot;
/**
* Optional. Users or bots last name
*/
@JsonProperty(LASTNAME_FIELD) @JsonProperty(LASTNAME_FIELD)
private String lastName; ///< Optional. Users or bots last name private String lastName;
/**
* Optional. Users or bots username
*/
@JsonProperty(USERNAME_FIELD) @JsonProperty(USERNAME_FIELD)
private String userName; ///< Optional. Users or bots username private String userName;
/**
* Optional. IETF language tag of the user's language
*/
@JsonProperty(LANGUAGECODE_FIELD) @JsonProperty(LANGUAGECODE_FIELD)
private String languageCode; ///< Optional. IETF language tag of the user's language private String languageCode;
/**
* Optional. True, if the bot can be invited to groups. Returned only in getMe.
*/
@JsonProperty(CANJOINGROUPS_FIELD) @JsonProperty(CANJOINGROUPS_FIELD)
private Boolean canJoinGroups; ///< Optional. True, if the bot can be invited to groups. Returned only in getMe. private Boolean canJoinGroups;
/**
* Optional. True, if privacy mode is disabled for the bot. Returned only in getMe.
*/
@JsonProperty(CANREADALLGROUPMESSAGES_FIELD) @JsonProperty(CANREADALLGROUPMESSAGES_FIELD)
private Boolean canReadAllGroupMessages; ///< Optional. True, if privacy mode is disabled for the bot. Returned only in getMe. private Boolean canReadAllGroupMessages;
/**
* Optional. True, if the bot supports inline queries. 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 this user is a Telegram Premium user
*/
@JsonProperty(ISPREMIUM_FIELD) @JsonProperty(ISPREMIUM_FIELD)
private Boolean isPremium; ///< Optional. True, if this user is a Telegram Premium user private Boolean isPremium;
/**
* Optional. True, if this user added the bot to the attachment menu
*/
@JsonProperty(ADDEDTOATTACHMENTMENU_FIELD) @JsonProperty(ADDEDTOATTACHMENTMENU_FIELD)
private Boolean addedToAttachmentMenu; ///< Optional. True, if this user added the bot to the attachment menu private Boolean addedToAttachmentMenu;
@JsonProperty(IS_VERIFIED_FIELD) @JsonProperty(IS_VERIFIED_FIELD)
private Boolean isVerified; ///< Optional. Extra. private Boolean isVerified; ///< Optional. Extra.

View File

@ -13,9 +13,9 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
import java.util.List; import java.util.List;
/** /**
* This object represent a user's profile pictures.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* This object represent a user's profile pictures.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -28,8 +28,14 @@ public class UserProfilePhotos implements BotApiObject {
private static final String TOTALCOUNT_FIELD = "total_count"; private static final String TOTALCOUNT_FIELD = "total_count";
private static final String PHOTOS_FIELD = "photos"; private static final String PHOTOS_FIELD = "photos";
/**
* Total number of profile pictures the target user has
*/
@JsonProperty(TOTALCOUNT_FIELD) @JsonProperty(TOTALCOUNT_FIELD)
private Integer totalCount; ///< Total number of profile pictures the target user has private Integer totalCount;
/**
* Requested profile pictures (in up to 4 sizes each)
*/
@JsonProperty(PHOTOS_FIELD) @JsonProperty(PHOTOS_FIELD)
private List<List<PhotoSize>> photos; ///< Requested profile pictures (in up to 4 sizes each) private List<List<PhotoSize>> photos;
} }

View File

@ -11,9 +11,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* This object represents a venue.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* This object represents a venue.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -30,18 +30,43 @@ public class Venue implements BotApiObject {
private static final String GOOGLEPLACEID_FIELD = "google_place_id"; private static final String GOOGLEPLACEID_FIELD = "google_place_id";
private static final String GOOGLEPLACETYPE_FIELD = "google_place_type"; private static final String GOOGLEPLACETYPE_FIELD = "google_place_type";
/**
* Venue location
*/
@JsonProperty(LOCATION_FIELD) @JsonProperty(LOCATION_FIELD)
private Location location; ///< Venue location private Location location;
/**
* Name of the venue
*/
@JsonProperty(TITLE_FIELD) @JsonProperty(TITLE_FIELD)
private String title; ///< Name of the venue private String title;
/**
* Address of the venue
*/
@JsonProperty(ADDRESS_FIELD) @JsonProperty(ADDRESS_FIELD)
private String address; ///< Address of the venue private String address;
/**
* Optional.
* Foursquare identifier of the venue
*/
@JsonProperty(FOURSQUAREID_FIELD) @JsonProperty(FOURSQUAREID_FIELD)
private String foursquareId; ///< Optional. Foursquare identifier of the venue private String foursquareId;
/**
* Optional.
* Foursquare type of the venue.
*/
@JsonProperty(FOURSQUARETYPE_FIELD) @JsonProperty(FOURSQUARETYPE_FIELD)
private String foursquareType; ///< Optional. Foursquare type of the venue. private String foursquareType;
/**
* Optional.
* Google Places identifier of the venue
*/
@JsonProperty(GOOGLEPLACEID_FIELD) @JsonProperty(GOOGLEPLACEID_FIELD)
private String googlePlaceId; ///< Optional. Google Places identifier of the venue private String googlePlaceId;
/**
* Optional.
* Google Places type of the venue. (See supported types.)
*/
@JsonProperty(GOOGLEPLACETYPE_FIELD) @JsonProperty(GOOGLEPLACETYPE_FIELD)
private String googlePlaceType; ///< Optional. Google Places type of the venue. (See supported types.) private String googlePlaceType;
} }

View File

@ -10,9 +10,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* This object represents a video file.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* This object represents a video file.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -32,24 +32,43 @@ public class Video implements BotApiObject {
private static final String FILESIZE_FIELD = "file_size"; private static final String FILESIZE_FIELD = "file_size";
private static final String FILENAME_FIELD = "file_name"; private static final String FILENAME_FIELD = "file_name";
/**
* Identifier for this file, which can be used to download or reuse the file
*/
@JsonProperty(FILEID_FIELD) @JsonProperty(FILEID_FIELD)
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file private String fileId;
/** /**
* 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)
private String fileUniqueId; private String fileUniqueId;
/**
* Video width as defined by sender
*/
@JsonProperty(WIDTH_FIELD) @JsonProperty(WIDTH_FIELD)
private Integer width; ///< Video width as defined by sender private Integer width;
/**
* Video height as defined by sender
*/
@JsonProperty(HEIGHT_FIELD) @JsonProperty(HEIGHT_FIELD)
private Integer height; ///< Video height as defined by sender private Integer height;
/**
* Duration of the video in seconds as defined by sender
*/
@JsonProperty(DURATION_FIELD) @JsonProperty(DURATION_FIELD)
private Integer duration; ///< Duration of the video in seconds as defined by sender private Integer duration;
/**
* Video thumbnail
*/
@JsonProperty(THUMB_FIELD) @JsonProperty(THUMB_FIELD)
private PhotoSize thumb; ///< Video thumbnail private PhotoSize thumb;
/**
* Optional.
* Mime type of file as defined by sender
*/
@JsonProperty(MIMETYPE_FIELD) @JsonProperty(MIMETYPE_FIELD)
private String mimeType; ///< Optional. Mime type of a file as defined by sender private String mimeType;
/** /**
* Optional. * Optional.
* File size in bytes. * File size in bytes.
@ -58,6 +77,10 @@ public class Video implements BotApiObject {
*/ */
@JsonProperty(FILESIZE_FIELD) @JsonProperty(FILESIZE_FIELD)
private Long fileSize; private Long fileSize;
/**
* Optional.
* Original filename as defined by sender
*/
@JsonProperty(FILENAME_FIELD) @JsonProperty(FILENAME_FIELD)
private String fileName; ///< Optional. Original filename as defined by sender private String fileName;
} }

View File

@ -10,10 +10,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* This object represents a video message (available in Telegram apps as of v.4.0).
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
*
* This object represents a video message (available in Telegram apps as of v.4.0).
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -29,20 +28,37 @@ public class VideoNote implements BotApiObject {
private static final String THUMB_FIELD = "thumb"; private static final String THUMB_FIELD = "thumb";
private static final String FILESIZE_FIELD = "file_size"; private static final String FILESIZE_FIELD = "file_size";
/**
* Identifier for this file, which can be used to download or reuse the file
*/
@JsonProperty(FILEID_FIELD) @JsonProperty(FILEID_FIELD)
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file private String fileId;
/** /**
* 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)
private String fileUniqueId; private String fileUniqueId;
/**
* Video width and height as defined by sender
*/
@JsonProperty(LENGTH_FIELD) @JsonProperty(LENGTH_FIELD)
private Integer length; ///< Video width and height as defined by sender private Integer length;
/**
* Duration of the video in seconds as defined by sender
*/
@JsonProperty(DURATION_FIELD) @JsonProperty(DURATION_FIELD)
private Integer duration; ///< Duration of the video in seconds as defined by sender private Integer duration;
/**
* Optional.
* Video thumbnail
*/
@JsonProperty(THUMB_FIELD) @JsonProperty(THUMB_FIELD)
private PhotoSize thumb; ///< Optional. Video thumbnail private PhotoSize thumb;
/**
* Optional.
* File size
*/
@JsonProperty(FILESIZE_FIELD) @JsonProperty(FILESIZE_FIELD)
private Integer fileSize; ///< Optional. File size private Integer fileSize;
} }

View File

@ -10,9 +10,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* This object represents a voice note
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* This object represents a voice note
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -27,18 +27,28 @@ public class Voice implements BotApiObject {
private static final String MIMETYPE_FIELD = "mime_type"; private static final String MIMETYPE_FIELD = "mime_type";
private static final String FILESIZE_FIELD = "file_size"; private static final String FILESIZE_FIELD = "file_size";
/**
* Identifier for this file, which can be used to download or reuse the file
*/
@JsonProperty(FILEID_FIELD) @JsonProperty(FILEID_FIELD)
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file private String fileId;
/** /**
* 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)
private String fileUniqueId; private String fileUniqueId;
/**
* Integer Duration of the audio in seconds as defined by sender
*/
@JsonProperty(DURATION_FIELD) @JsonProperty(DURATION_FIELD)
private Integer duration; ///< Integer Duration of the audio in seconds as defined by sender private Integer duration;
/**
* Optional.
* MIME type of the file as defined by sender
*/
@JsonProperty(MIMETYPE_FIELD) @JsonProperty(MIMETYPE_FIELD)
private String mimeType; ///< Optional. MIME type of the file as defined by sender private String mimeType;
/** /**
* Optional. * Optional.
* File size in bytes. * File size in bytes.

View File

@ -12,9 +12,9 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
import java.util.List; import java.util.List;
/** /**
* Contains information about the current status of a webhook.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 2.4 * @version 2.4
* Contains information about the current status of a webhook.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -34,22 +34,51 @@ public class WebhookInfo implements BotApiObject {
private static final String IPADDRESS_FIELD = "ip_address"; private static final String IPADDRESS_FIELD = "ip_address";
private static final String LASTSYNCHRONIZATIONERRORDATE_FIELD = "last_synchronization_error_date"; private static final String LASTSYNCHRONIZATIONERRORDATE_FIELD = "last_synchronization_error_date";
/**
* Webhook URL, may be empty if webhook is not set up
*/
@JsonProperty(URL_FIELD) @JsonProperty(URL_FIELD)
private String url; ///< Webhook URL, may be empty if webhook is not set up private String url;
/**
* True, if a custom certificate was provided for webhook certificate checks
*/
@JsonProperty(HASCUSTOMCERTIFICATE_FIELD) @JsonProperty(HASCUSTOMCERTIFICATE_FIELD)
private Boolean hasCustomCertificate; ///< True, if a custom certificate was provided for webhook certificate checks private Boolean hasCustomCertificate;
/**
* Number updates awaiting delivery
*/
@JsonProperty(PENDINGUPDATECOUNT_FIELD) @JsonProperty(PENDINGUPDATECOUNT_FIELD)
private Integer pendingUpdatesCount; ///< Number updates awaiting delivery private Integer pendingUpdatesCount;
/**
* Optional.
* Unix time for the most recent error that happened when trying to deliver an update via webhook
*/
@JsonProperty(LASTERRORDATE_FIELD) @JsonProperty(LASTERRORDATE_FIELD)
private Integer lastErrorDate; ///< Optional. Unix time for the most recent error that happened when trying to deliver an update via webhook private Integer lastErrorDate;
/**
* Optional.
* Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook
*/
@JsonProperty(LASTERRORMESSAGE_FIELD) @JsonProperty(LASTERRORMESSAGE_FIELD)
private String lastErrorMessage; ///< Optional. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook private String lastErrorMessage;
/**
* Optional.
* Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery
*/
@JsonProperty(MAXCONNECTIONS_FIELD) @JsonProperty(MAXCONNECTIONS_FIELD)
private Integer maxConnections; ///< Optional. Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery private Integer maxConnections;
/**
* Optional.
* A list of update types the bot is subscribed to. Defaults to all update types
*/
@JsonProperty(ALLOWEDUPDATES_FIELD) @JsonProperty(ALLOWEDUPDATES_FIELD)
private List<String> allowedUpdates; ///< Optional. A list of update types the bot is subscribed to. Defaults to all update types private List<String> allowedUpdates;
/**
* Optional.
* Currently used webhook IP address
*/
@JsonProperty(IPADDRESS_FIELD) @JsonProperty(IPADDRESS_FIELD)
private String ipAddress; ///< Optional. Currently used webhook IP address private String ipAddress;
/** /**
* Optional. * Optional.
* Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters * Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters

View File

@ -5,10 +5,9 @@ import lombok.*;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* Represents rights of an administrator in a chat.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 6.0 * @version 6.0
*
* Represents rights of an administrator in a chat.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -30,9 +29,13 @@ public class ChatAdministratorRights implements BotApiObject {
private static final String CANPOSTMESSAGES_FIELD = "can_post_messages"; private static final String CANPOSTMESSAGES_FIELD = "can_post_messages";
private static final String CANEDITMESSAGES_FIELD = "can_edit_messages"; private static final String CANEDITMESSAGES_FIELD = "can_edit_messages";
private static final String CANPINMESSAGES_FIELD = "can_pin_messages"; private static final String CANPINMESSAGES_FIELD = "can_pin_messages";
private static final String CANMANAGETOPICS_FIELD = "can_manage_topics";
/**
* True, if the user's presence in the chat is hidden
*/
@JsonProperty(ISANONYMOUS_FIELD) @JsonProperty(ISANONYMOUS_FIELD)
private Boolean isAnonymous; ///< True, if the user's presence in the chat is hidden private Boolean isAnonymous;
/** /**
* True, if the administrator can access the chat event log, chat statistics, * True, if the administrator can access the chat event log, chat statistics,
* message statistics in channels, see channel members, see anonymous administrators * message statistics in channels, see channel members, see anonymous administrators
@ -41,12 +44,21 @@ public class ChatAdministratorRights implements BotApiObject {
*/ */
@JsonProperty(CANMANAGECHAT_FIELD) @JsonProperty(CANMANAGECHAT_FIELD)
private Boolean canManageChat; private Boolean canManageChat;
/**
* True, if the administrator can delete messages of other users
*/
@JsonProperty(CANDELETEMESSAGES_FIELD) @JsonProperty(CANDELETEMESSAGES_FIELD)
private Boolean canDeleteMessages; ///< True, if the administrator can delete messages of other users private Boolean canDeleteMessages;
/**
* True, if the administrator can manage video chats
*/
@JsonProperty(CANMANAGEVIDEOCHATS_FIELD) @JsonProperty(CANMANAGEVIDEOCHATS_FIELD)
private Boolean canManageVideoChats; ///< True, if the administrator can manage video chats private Boolean canManageVideoChats;
/**
* True, if the administrator can restrict, ban or unban chat members
*/
@JsonProperty(CANRESTRICTMEMBERS_FIELD) @JsonProperty(CANRESTRICTMEMBERS_FIELD)
private Boolean canRestrictMembers; ///< True, if the administrator can restrict, ban or unban chat members private Boolean canRestrictMembers;
/** /**
* True, if the administrator can add new administrators with a subset of * True, if the administrator can add new administrators with a subset of
* their own privileges or demote administrators that he has promoted, * their own privileges or demote administrators that he has promoted,
@ -54,15 +66,38 @@ public class ChatAdministratorRights implements BotApiObject {
*/ */
@JsonProperty(CANPROMOTEMEMBERS_FIELD) @JsonProperty(CANPROMOTEMEMBERS_FIELD)
private Boolean canPromoteMembers; private Boolean canPromoteMembers;
/**
* True, if the user is allowed to change the chat title, photo and other settings
*/
@JsonProperty(CANCHANGEINFO_FIELD) @JsonProperty(CANCHANGEINFO_FIELD)
private Boolean canChangeInfo; ///< True, if the user is allowed to change the chat title, photo and other settings private Boolean canChangeInfo;
/**
* True, if the user is allowed to invite new users to the chat
*/
@JsonProperty(CANINVITEUSERS_FIELD) @JsonProperty(CANINVITEUSERS_FIELD)
private Boolean canInviteUsers; ///< True, if the user is allowed to invite new users to the chat private Boolean canInviteUsers;
/**
* Optional.
* True, if the administrator can post in the channel; channels only
*/
@JsonProperty(CANPOSTMESSAGES_FIELD) @JsonProperty(CANPOSTMESSAGES_FIELD)
private Boolean canPostMessages; ///< Optional. True, if the administrator can post in the channel; channels only private Boolean canPostMessages;
/**
* Optional.
* True, if the administrator can edit messages of other users and can pin messages; channels only
*/
@JsonProperty(CANEDITMESSAGES_FIELD) @JsonProperty(CANEDITMESSAGES_FIELD)
private Boolean canEditMessages; ///< Optional. True, if the administrator can edit messages of other users and can pin messages; channels only private Boolean canEditMessages;
/**
* Optional.
* True, if the user is allowed to pin messages; groups and supergroups only
*/
@JsonProperty(CANPINMESSAGES_FIELD) @JsonProperty(CANPINMESSAGES_FIELD)
private Boolean canPinMessages; ///< Optional. True, if the user is allowed to pin messages; groups and supergroups only private Boolean canPinMessages;
/**
* Optional.
* True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only
*/
@JsonProperty(CANMANAGETOPICS_FIELD)
private Boolean canManageTopics;
} }

View File

@ -43,6 +43,7 @@ public class ChatMemberAdministrator implements ChatMember {
private static final String CANINVITEUSERS_FIELD = "can_invite_users"; private static final String CANINVITEUSERS_FIELD = "can_invite_users";
private static final String CANPINMESSAGES_FIELD = "can_pin_messages"; private static final String CANPINMESSAGES_FIELD = "can_pin_messages";
private static final String CANMANAGEVIDEOCHATS_FIELD = "can_manage_video_chats"; private static final String CANMANAGEVIDEOCHATS_FIELD = "can_manage_video_chats";
private static final String CANMANAGETOPICS_FIELD = "can_manage_topics";
/** /**
* The member's status in the chat, always administrator * The member's status in the chat, always administrator
@ -124,4 +125,10 @@ public class ChatMemberAdministrator implements ChatMember {
*/ */
@JsonProperty(CANMANAGEVIDEOCHATS_FIELD) @JsonProperty(CANMANAGEVIDEOCHATS_FIELD)
private Boolean canManageVideoChats; private Boolean canManageVideoChats;
/**
* Optional.
* True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only
*/
@JsonProperty(CANMANAGETOPICS_FIELD)
private Boolean canManageTopics;
} }

View File

@ -40,6 +40,7 @@ public class ChatMemberRestricted implements ChatMember {
private static final String CANSENDOTHERMESSAGES_FIELD = "can_send_other_messages"; private static final String CANSENDOTHERMESSAGES_FIELD = "can_send_other_messages";
private static final String CANADDWEBPAGEPREVIEWS_FIELD = "can_add_web_page_previews"; private static final String CANADDWEBPAGEPREVIEWS_FIELD = "can_add_web_page_previews";
private static final String UNTILDATE_FIELD = "until_date"; private static final String UNTILDATE_FIELD = "until_date";
private static final String CANMANAGETOPICS_FIELD = "can_manage_topics";
/** /**
* The member's status in the chat, always restricted * The member's status in the chat, always restricted
@ -101,4 +102,9 @@ public class ChatMemberRestricted implements ChatMember {
*/ */
@JsonProperty(UNTILDATE_FIELD) @JsonProperty(UNTILDATE_FIELD)
private Integer untilDate; private Integer untilDate;
/**
* True, if the user is allowed to create forum topics
*/
@JsonProperty(CANMANAGETOPICS_FIELD)
private Boolean canManageTopics;
} }

View File

@ -14,9 +14,9 @@ import org.telegram.telegrambots.meta.api.interfaces.Validable;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/** /**
* This object represents a bot command.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 4.7 * @version 4.7
* This object represents a bot command.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -34,10 +34,13 @@ public class BotCommand implements BotApiObject, Validable {
*/ */
@JsonProperty(COMMAND_FIELD) @JsonProperty(COMMAND_FIELD)
@NonNull @NonNull
private String command; ///< Value of the dice, 1-6 private String command;
/**
* Description of the command, 3-256 characters.
*/
@JsonProperty(DESCRIPTION_FIELD) @JsonProperty(DESCRIPTION_FIELD)
@NonNull @NonNull
private String description; ///< Description of the command, 3-256 characters. private String description;
@Override @Override
public void validate() throws TelegramApiValidationException { public void validate() throws TelegramApiValidationException {

View File

@ -0,0 +1,51 @@
package org.telegram.telegrambots.meta.api.objects.forum;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/**
* This object represents a forum topic.
* @author Ruben Bermudez
* @version 6.3
*/
@SuppressWarnings("WeakerAccess")
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class ForumTopic implements BotApiObject {
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
private static final String NAME_FIELD = "name";
private static final String ICONCOLOR_FIELD = "icon_color";
private static final String ICONCUSTOMEMOJIID_FIELD = "icon_custom_emoji_id";
/**
* Unique identifier of the forum topic
*/
@JsonProperty(MESSAGETHREADID_FIELD)
private Integer messageThreadId;
/**
* Name of the topic
*/
@JsonProperty(NAME_FIELD)
private String name;
/**
* Color of the topic icon in RGB format
*/
@JsonProperty(ICONCOLOR_FIELD)
private Integer iconColor;
/**
* Optional.
* Unique identifier of the custom emoji shown as the topic icon
*/
@JsonProperty(ICONCUSTOMEMOJIID_FIELD)
private String iconCustomEmojiId;
}

View File

@ -0,0 +1,24 @@
package org.telegram.telegrambots.meta.api.objects.forum;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/**
* This object represents a service message about a forum topic closed in the chat.
* Currently holds no information.
* @author Ruben Bermudez
* @version 6.3
*/
@SuppressWarnings("WeakerAccess")
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
public class ForumTopicClosed implements BotApiObject {
}

View File

@ -0,0 +1,47 @@
package org.telegram.telegrambots.meta.api.objects.forum;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/**
* This object represents a service message about a new forum topic created in the chat.
* @author Ruben Bermudez
* @version 6.1
*/
@SuppressWarnings("WeakerAccess")
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class ForumTopicCreated implements BotApiObject {
private static final String NAME_FIELD = "name";
private static final String ICONCOLOR_FIELD = "icon_color";
private static final String ICONCUSTOMEMOJIID_FIELD = "icon_custom_emoji_id";
/**
* Name of the topic
*/
@JsonProperty(NAME_FIELD)
private String name;
/**
* Color of the topic icon in RGB format
*/
@JsonProperty(ICONCOLOR_FIELD)
private Integer iconColor;
/**
* Optional.
* Unique identifier of the custom emoji shown as the topic icon
*/
@JsonProperty(ICONCUSTOMEMOJIID_FIELD)
private String iconCustomEmojiId;
}

View File

@ -0,0 +1,24 @@
package org.telegram.telegrambots.meta.api.objects.forum;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/**
* This object represents a service message about a forum topic reopened in the chat.
* Currently holds no information.
* @author Ruben Bermudez
* @version 6.3
*/
@SuppressWarnings("WeakerAccess")
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
public class ForumTopicReopened implements BotApiObject {
}

View File

@ -29,9 +29,9 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
import org.telegram.telegrambots.meta.api.objects.PhotoSize; import org.telegram.telegrambots.meta.api.objects.PhotoSize;
/** /**
* This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 2.4 * @version 2.4
* This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -51,9 +51,12 @@ public class Animation implements BotApiObject {
private static final String MIMETYPE_FIELD = "mime_type"; private static final String MIMETYPE_FIELD = "mime_type";
private static final String FILESIZE_FIELD = "file_size"; private static final String FILESIZE_FIELD = "file_size";
/**
* Identifier for this file, which can be used to download or reuse the file
*/
@JsonProperty(FILEID_FIELD) @JsonProperty(FILEID_FIELD)
@NonNull @NonNull
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file private String fileId;
/** /**
* 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.
@ -61,21 +64,42 @@ public class Animation implements BotApiObject {
@JsonProperty(FILEUNIQUEID_FIELD) @JsonProperty(FILEUNIQUEID_FIELD)
@NonNull @NonNull
private String fileUniqueId; private String fileUniqueId;
/**
* Video width as defined by sender
*/
@JsonProperty(WIDTH_FIELD) @JsonProperty(WIDTH_FIELD)
@NonNull @NonNull
private Integer width; ///< Video width as defined by sender private Integer width;
/**
* Video height as defined by sender
*/
@JsonProperty(HEIGHT_FIELD) @JsonProperty(HEIGHT_FIELD)
@NonNull @NonNull
private Integer height; ///< Video height as defined by sender private Integer height;
/**
* Duration of the video in seconds as defined by sender
*/
@JsonProperty(DURATION_FIELD) @JsonProperty(DURATION_FIELD)
@NonNull @NonNull
private Integer duration; ///< Duration of the video in seconds as defined by sender private Integer duration;
/**
* Optional.
* Animation thumbnail as defined by sender
*/
@JsonProperty(THUMB_FIELD) @JsonProperty(THUMB_FIELD)
private PhotoSize thumb; ///< Optional. Animation thumbnail as defined by sender private PhotoSize thumb;
/**
* Optional.
* Original animation filename as defined by sender
*/
@JsonProperty(FILENAME_FIELD) @JsonProperty(FILENAME_FIELD)
private String fileName; ///< Optional. Original animation filename as defined by sender private String fileName;
/**
* Optional.
* MIME type of the file as defined by sender
*/
@JsonProperty(MIMETYPE_FIELD) @JsonProperty(MIMETYPE_FIELD)
private String mimetype; ///< Optional. MIME type of the file as defined by sender private String mimetype;
/** /**
* Optional. * Optional.
* File size in bytes. * File size in bytes.

View File

@ -32,9 +32,9 @@ import org.telegram.telegrambots.meta.api.objects.PhotoSize;
import java.util.List; import java.util.List;
/** /**
* This object represents a game.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 2.4 * @version 2.4
* This object represents a game.
* @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.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ -53,15 +53,24 @@ public class Game implements BotApiObject {
private static final String TEXT_FIELD = "text"; private static final String TEXT_FIELD = "text";
private static final String TEXTENTITIES_FIELD = "text_entities"; private static final String TEXTENTITIES_FIELD = "text_entities";
/**
* Title of the game
*/
@JsonProperty(TITLE_FIELD) @JsonProperty(TITLE_FIELD)
@NonNull @NonNull
private String title; ///< Title of the game private String title;
/**
* Description of the game
*/
@JsonProperty(DESCRIPTION_FIELD) @JsonProperty(DESCRIPTION_FIELD)
@NonNull @NonNull
private String description; ///< Description of the game private String description;
/**
* Photo
*/
@JsonProperty(PHOTO_FIELD) @JsonProperty(PHOTO_FIELD)
@NonNull @NonNull
private List<PhotoSize> photo; ///< Photo private List<PhotoSize> 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.
* Can be automatically edited to include current high scores for the game * Can be automatically edited to include current high scores for the game
@ -76,8 +85,12 @@ public class Game implements BotApiObject {
*/ */
@JsonProperty(TEXTENTITIES_FIELD) @JsonProperty(TEXTENTITIES_FIELD)
private List<MessageEntity> entities; private List<MessageEntity> entities;
/**
* Optional.
* Animation
*/
@JsonProperty(ANIMATION_FIELD) @JsonProperty(ANIMATION_FIELD)
private Animation animation; ///< Optional. Animation private Animation animation;
public boolean hasEntities() { public boolean hasEntities() {
return entities != null && !entities.isEmpty(); return entities != null && !entities.isEmpty();

View File

@ -29,9 +29,9 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
import org.telegram.telegrambots.meta.api.objects.User; import org.telegram.telegrambots.meta.api.objects.User;
/** /**
* This object represents one row of a game high scores table
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* This object represents one row of a game high scores table
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -44,13 +44,22 @@ public class GameHighScore implements BotApiObject {
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";
/**
* Position in the game high score table
*/
@JsonProperty(POSITION_FIELD) @JsonProperty(POSITION_FIELD)
@NonNull @NonNull
private Integer position; ///< Position in the game high score table private Integer position;
/**
* User
*/
@JsonProperty(USER_FIELD) @JsonProperty(USER_FIELD)
@NonNull @NonNull
private User user; ///< User private User user;
/**
* Score
*/
@JsonProperty(SCORE_FIELD) @JsonProperty(SCORE_FIELD)
@NonNull @NonNull
private Integer score; ///< Score private Integer score;
} }

View File

@ -19,9 +19,9 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import java.util.List; import java.util.List;
/** /**
* Represents the content of a text message to be sent as the result of an inline query.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* Represents the content of a text message to be sent as the result of an inline query.
*/ */
@JsonDeserialize @JsonDeserialize
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ -55,12 +55,18 @@ public class InputInvoiceMessageContent implements InputMessageContent {
private static final String SENDEMAILTOPROVIDER_FIELD = "send_email_to_provider"; private static final String SENDEMAILTOPROVIDER_FIELD = "send_email_to_provider";
private static final String ISFLEXIBLE_FIELD = "is_flexible"; private static final String ISFLEXIBLE_FIELD = "is_flexible";
/**
* Product name, 1-32 characters
*/
@JsonProperty(TITLE_FIELD) @JsonProperty(TITLE_FIELD)
@NonNull @NonNull
private String title; ///< Product name, 1-32 characters private String title;
/**
* Product description, 1-255 characters
*/
@JsonProperty(DESCRIPTION_FIELD) @JsonProperty(DESCRIPTION_FIELD)
@NonNull @NonNull
private String description; ///< Product description, 1-255 characters private String description;
/** /**
* Bot-defined invoice payload, 1-128 bytes. * Bot-defined invoice payload, 1-128 bytes.
* This will not be displayed to the user, use for your internal processes. * This will not be displayed to the user, use for your internal processes.
@ -68,12 +74,18 @@ public class InputInvoiceMessageContent implements InputMessageContent {
@JsonProperty(PAYLOAD_FIELD) @JsonProperty(PAYLOAD_FIELD)
@NonNull @NonNull
private String payload; private String payload;
/**
* Payment provider token, obtained via Botfather
*/
@JsonProperty(PROVIDERTOKEN_FIELD) @JsonProperty(PROVIDERTOKEN_FIELD)
@NonNull @NonNull
private String providerToken; ///< Payment provider token, obtained via Botfather private String providerToken;
/**
* Three-letter ISO 4217 currency code, see more on currencies
*/
@JsonProperty(CURRENCY_FIELD) @JsonProperty(CURRENCY_FIELD)
@NonNull @NonNull
private String currency; ///< Three-letter ISO 4217 currency code, see more on currencies private String currency;
/** /**
* Price breakdown, a JSON-serialized list of components * Price breakdown, a JSON-serialized list of components
* (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) * (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
@ -114,26 +126,66 @@ public class InputInvoiceMessageContent implements InputMessageContent {
*/ */
@JsonProperty(PHOTOURL_FIELD) @JsonProperty(PHOTOURL_FIELD)
private String photoUrl; private String photoUrl;
/**
* Optional.
* Photo size
*/
@JsonProperty(PHOTOSIZE_FIELD) @JsonProperty(PHOTOSIZE_FIELD)
private Integer photoSize; ///< Optional. Photo size private Integer photoSize;
/**
* Optional.
* Photo width
*/
@JsonProperty(PHOTOWIDTH_FIELD) @JsonProperty(PHOTOWIDTH_FIELD)
private Integer photoWidth; ///< Optional. Photo width private Integer photoWidth;
/**
* Optional.
* Photo height
*/
@JsonProperty(PHOTOHEIGHT_FIELD) @JsonProperty(PHOTOHEIGHT_FIELD)
private Integer photoHeight; ///< Optional. Photo height private Integer photoHeight;
/**
* Optional.
* Pass True, if you require the user's full name to complete the order
*/
@JsonProperty(NEEDNAME_FIELD) @JsonProperty(NEEDNAME_FIELD)
private Boolean needName; ///< Optional. Pass True, if you require the user's full name to complete the order private Boolean needName;
/**
* Optional.
* Pass True, if you require the user's phone number to complete the order
*/
@JsonProperty(NEEDPHONENUMBER_FIELD) @JsonProperty(NEEDPHONENUMBER_FIELD)
private Boolean needPhoneNumber; ///< Optional. Pass True, if you require the user's phone number to complete the order private Boolean needPhoneNumber;
/**
* Optional.
* Pass True, if you require the user's email address to complete the order
*/
@JsonProperty(NEEDEMAIL_FIELD) @JsonProperty(NEEDEMAIL_FIELD)
private Boolean needEmail; ///< Optional. Pass True, if you require the user's email address to complete the order private Boolean needEmail;
/**
* Optional.
* Pass True, if you require the user's shipping address to complete the order
*/
@JsonProperty(NEEDSHIPPINGADDRESS_FIELD) @JsonProperty(NEEDSHIPPINGADDRESS_FIELD)
private Boolean needShippingAddress; ///< Optional. Pass True, if you require the user's shipping address to complete the order private Boolean needShippingAddress;
/**
* Optional.
* Pass True, if user's phone number should be sent to provider
*/
@JsonProperty(SENDPHONENUMBERTOPROVIDER_FIELD) @JsonProperty(SENDPHONENUMBERTOPROVIDER_FIELD)
private Boolean sendPhoneNumberToProvider; ///< Optional. Pass True, if user's phone number should be sent to provider private Boolean sendPhoneNumberToProvider;
/**
* Optional.
* Pass True, if user's email address should be sent to provider
*/
@JsonProperty(SENDEMAILTOPROVIDER_FIELD) @JsonProperty(SENDEMAILTOPROVIDER_FIELD)
private Boolean sendEmailToProvider; ///< Optional. Pass True, if user's email address should be sent to provider private Boolean sendEmailToProvider;
/**
* Optional.
* Pass True, if the final price depends on the shipping method
*/
@JsonProperty(ISFLEXIBLE_FIELD) @JsonProperty(ISFLEXIBLE_FIELD)
private Boolean isFlexible; ///< Optional. Pass True, if the final price depends on the shipping method private Boolean isFlexible;
@Override @Override
public void validate() throws TelegramApiValidationException { public void validate() throws TelegramApiValidationException {

View File

@ -14,9 +14,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/** /**
* Represents the content of a location message to be sent as the result of an inline query.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* Represents the content of a location message to be sent as the result of an inline query.
* @apiNote This will only work in Telegram versions released after 9 April, 2016. Older clients will * @apiNote This will only work in Telegram versions released after 9 April, 2016. Older clients will
* ignore them. * ignore them.
*/ */
@ -38,14 +38,24 @@ public class InputLocationMessageContent implements InputMessageContent {
private static final String HEADING_FIELD = "heading"; private static final String HEADING_FIELD = "heading";
private static final String PROXIMITYALERTRADIUS_FIELD = "proximity_alert_radius"; private static final String PROXIMITYALERTRADIUS_FIELD = "proximity_alert_radius";
/**
* Latitude of the location in degrees
*/
@JsonProperty(LATITUDE_FIELD) @JsonProperty(LATITUDE_FIELD)
@NonNull @NonNull
private Double latitude; ///< Latitude of the location in degrees private Double latitude;
/**
* Longitude of the location in degrees
*/
@JsonProperty(LONGITUDE_FIELD) @JsonProperty(LONGITUDE_FIELD)
@NonNull @NonNull
private Double longitude; ///< Longitude of the location in degrees private Double longitude;
/**
* Optional.
* Period in seconds for which the location can be updated, should be between 60 and 86400.
*/
@JsonProperty(LIVEPERIOD_FIELD) @JsonProperty(LIVEPERIOD_FIELD)
private Integer livePeriod; ///< Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. private Integer livePeriod;
/** /**
* Optional. * Optional.
* The radius of uncertainty for the location, measured in meters; 0-1500 * The radius of uncertainty for the location, measured in meters; 0-1500

View File

@ -37,15 +37,30 @@ public class InputTextMessageContent implements InputMessageContent {
private static final String DISABLEWEBPAGEPREVIEW_FIELD = "disable_web_page_preview"; private static final String DISABLEWEBPAGEPREVIEW_FIELD = "disable_web_page_preview";
private static final String ENTITIES_FIELD = "entities"; private static final String ENTITIES_FIELD = "entities";
/**
* Text of a message to be sent, 1-4096 characters
*/
@JsonProperty(MESSAGETEXT_FIELD) @JsonProperty(MESSAGETEXT_FIELD)
@NonNull @NonNull
private String messageText; ///< Text of a message to be sent, 1-4096 characters private String messageText;
/**
* Optional.
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
*/
@JsonProperty(PARSEMODE_FIELD) @JsonProperty(PARSEMODE_FIELD)
private String parseMode; ///< Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. private String parseMode;
/**
* Optional.
* Disables link previews for links in the sent message
*/
@JsonProperty(DISABLEWEBPAGEPREVIEW_FIELD) @JsonProperty(DISABLEWEBPAGEPREVIEW_FIELD)
private Boolean disableWebPagePreview; ///< Optional. Disables link previews for links in the sent message private Boolean disableWebPagePreview;
/**
* Optional.
* List of special entities that appear in message text, which can be specified instead of parse_mode
*/
@JsonProperty(ENTITIES_FIELD) @JsonProperty(ENTITIES_FIELD)
private List<MessageEntity> entities; ///< Optional. List of special entities that appear in message text, which can be specified instead of parse_mode private List<MessageEntity> entities;
@Override @Override
public void validate() throws TelegramApiValidationException { public void validate() throws TelegramApiValidationException {

View File

@ -14,9 +14,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/** /**
* Represents the content of a venue message to be sent as the result of an inline query.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* Represents the content of a venue message to be sent as the result of an inline query.
* @apiNote This will only work in Telegram versions released after 9 April, 2016. Older clients will * @apiNote This will only work in Telegram versions released after 9 April, 2016. Older clients will
* ignore them. * ignore them.
*/ */
@ -40,26 +40,50 @@ public class InputVenueMessageContent implements InputMessageContent {
private static final String GOOGLEPLACEID_FIELD = "google_place_id"; private static final String GOOGLEPLACEID_FIELD = "google_place_id";
private static final String GOOGLEPLACETYPE_FIELD = "google_place_type"; private static final String GOOGLEPLACETYPE_FIELD = "google_place_type";
/**
* Latitude of the venue in degrees
*/
@JsonProperty(LATITUDE_FIELD) @JsonProperty(LATITUDE_FIELD)
@NonNull @NonNull
private Float latitude; ///< Latitude of the venue in degrees private Float latitude;
/**
* Longitude of the venue in degrees
*/
@JsonProperty(LONGITUDE_FIELD) @JsonProperty(LONGITUDE_FIELD)
@NonNull @NonNull
private Float longitude; ///< Longitude of the venue in degrees private Float longitude;
/**
* Name of the venue
*/
@JsonProperty(TITLE_FIELD) @JsonProperty(TITLE_FIELD)
@NonNull @NonNull
private String title; ///< Name of the venue private String title;
/**
* Address of the venue
*/
@JsonProperty(ADDRESS_FIELD) @JsonProperty(ADDRESS_FIELD)
@NonNull @NonNull
private String address; ///< Address of the venue private String address;
/**
* Optional. Foursquare identifier of the venue, if known
*/
@JsonProperty(FOURSQUAREID_FIELD) @JsonProperty(FOURSQUAREID_FIELD)
private String foursquareId; ///< Optional. Foursquare identifier of the venue, if known private String foursquareId;
/**
* Optional. Foursquare type of the venue, if known.
*/
@JsonProperty(FOURSQUARETYPE_FIELD) @JsonProperty(FOURSQUARETYPE_FIELD)
private String foursquareType; ///< Optional. Foursquare type of the venue, if known. private String foursquareType;
/**
* Optional. Google Places identifier of the venue
*/
@JsonProperty(GOOGLEPLACEID_FIELD) @JsonProperty(GOOGLEPLACEID_FIELD)
private String googlePlaceId; ///< Optional. Google Places identifier of the venue private String googlePlaceId;
/**
* Optional. Google Places type of the venue. (See supported types.)
*/
@JsonProperty(GOOGLEPLACETYPE_FIELD) @JsonProperty(GOOGLEPLACETYPE_FIELD)
private String googlePlaceType; ///< Optional. Google Places type of the venue. (See supported types.) private String googlePlaceType;
@Override @Override
public void validate() throws TelegramApiValidationException { public void validate() throws TelegramApiValidationException {

View File

@ -15,9 +15,9 @@ import org.telegram.telegrambots.meta.api.interfaces.Validable;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/** /**
* This object describes the position on faces where a mask should be placed by default.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 3.2 * @version 3.2
* This object describes the position on faces where a mask should be placed by default.
*/ */
@JsonTypeInfo(use=JsonTypeInfo.Id.NONE) @JsonTypeInfo(use=JsonTypeInfo.Id.NONE)
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ -33,18 +33,30 @@ public class MaskPosition implements Validable, BotApiObject {
private static final String YSHIFT_FIELD = "y_shift"; private static final String YSHIFT_FIELD = "y_shift";
private static final String SCALE_FIELD = "scale"; private static final String SCALE_FIELD = "scale";
/**
* The part of the face relative to which the mask should be placed. One of forehead, eyes, mouth, or chin.
*/
@JsonProperty(POINT_FIELD) @JsonProperty(POINT_FIELD)
@NonNull @NonNull
private String point; ///< The part of the face relative to which the mask should be placed. One of forehead, eyes, mouth, or chin. private String point;
/**
* Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position.
*/
@JsonProperty(XSHIFT_FIELD) @JsonProperty(XSHIFT_FIELD)
@NonNull @NonNull
private Float xShift; ///< Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position. private Float xShift;
/**
* Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position.
*/
@JsonProperty(YSHIFT_FIELD) @JsonProperty(YSHIFT_FIELD)
@NonNull @NonNull
private Float yShift; ///< Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position. private Float yShift;
/**
* Mask scaling coefficient. For example, 2.0 means double size.
*/
@JsonProperty(SCALE_FIELD) @JsonProperty(SCALE_FIELD)
@NonNull @NonNull
private Float scale; ///< Mask scaling coefficient. For example, 2.0 means double size. private Float scale;
@Override @Override
public void validate() throws TelegramApiValidationException { public void validate() throws TelegramApiValidationException {

View File

@ -12,9 +12,9 @@ import org.telegram.telegrambots.meta.api.objects.File;
import org.telegram.telegrambots.meta.api.objects.PhotoSize; import org.telegram.telegrambots.meta.api.objects.PhotoSize;
/** /**
* This object represents a sticker.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 6.1 * @version 6.1
* This object represents a sticker.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -39,8 +39,11 @@ public class Sticker implements BotApiObject {
private static final String PREMIUMANIMATION_FIELD = "premium_animation"; private static final String PREMIUMANIMATION_FIELD = "premium_animation";
private static final String CUSTOMEMOJIID_FIELD = "custom_emoji_id"; private static final String CUSTOMEMOJIID_FIELD = "custom_emoji_id";
/**
* Identifier for this file, which can be used to download or reuse the file
*/
@JsonProperty(FILEID_FIELD) @JsonProperty(FILEID_FIELD)
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file private String fileId;
/** /**
* 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.
@ -53,27 +56,67 @@ public class Sticker implements BotApiObject {
*/ */
@JsonProperty(TYPE_FIELD) @JsonProperty(TYPE_FIELD)
private String type; private String type;
/**
* Sticker width
*/
@JsonProperty(WIDTH_FIELD) @JsonProperty(WIDTH_FIELD)
private Integer width; ///< Sticker width private Integer width;
/**
* Sticker height
*/
@JsonProperty(HEIGHT_FIELD) @JsonProperty(HEIGHT_FIELD)
private Integer height; ///< Sticker height private Integer height;
/**
* Optional.
* Sticker thumbnail in .webp or .jpg format
*/
@JsonProperty(THUMB_FIELD) @JsonProperty(THUMB_FIELD)
private PhotoSize thumb; ///< Optional. Sticker thumbnail in .webp or .jpg format private PhotoSize thumb;
/**
* Optional.
* File size
*/
@JsonProperty(FILESIZE_FIELD) @JsonProperty(FILESIZE_FIELD)
private Integer fileSize; ///< Optional. File size private Integer fileSize;
/**
* Optional.
* Emoji associated with the sticker
*/
@JsonProperty(EMOJI_FIELD) @JsonProperty(EMOJI_FIELD)
private String emoji; ///< Optional. Emoji associated with the sticker private String emoji;
/**
* Optional.
* Name of the sticker set to which the sticker belongs
*/
@JsonProperty(SETNAME_FIELD) @JsonProperty(SETNAME_FIELD)
private String setName; ///< Optional. Name of the sticker set to which the sticker belongs private String setName;
/**
* Optional.
* For mask stickers, the position where the mask should be placed
*/
@JsonProperty(MASKPOSITON_FIELD) @JsonProperty(MASKPOSITON_FIELD)
private MaskPosition maskPosition; ///< Optional. For mask stickers, the position where the mask should be placed private MaskPosition maskPosition;
/**
* True, if the sticker is animated
*/
@JsonProperty(ISANIMATED_FIELD) @JsonProperty(ISANIMATED_FIELD)
private Boolean isAnimated; ///< True, if the sticker is animated private Boolean isAnimated;
/**
* True, if the sticker is a video sticker
*/
@JsonProperty(ISVIDEO_FIELD) @JsonProperty(ISVIDEO_FIELD)
private Boolean isVideo; ///< True, if the sticker is a video sticker private Boolean isVideo;
/**
* Optional.
* Premium animation for the sticker, if the sticker is premium
*/
@JsonProperty(PREMIUMANIMATION_FIELD) @JsonProperty(PREMIUMANIMATION_FIELD)
private File premiumAnimation; ///< Optional. Premium animation for the sticker, if the sticker is premium private File premiumAnimation;
/**
* Optional.
* For custom emoji stickers, unique identifier of the custom emoji
*/
@JsonProperty(CUSTOMEMOJIID_FIELD) @JsonProperty(CUSTOMEMOJIID_FIELD)
private String customEmojiId; ///< Optional. For custom emoji stickers, unique identifier of the custom emoji private String customEmojiId;
} }

View File

@ -13,9 +13,9 @@ import org.telegram.telegrambots.meta.api.objects.PhotoSize;
import java.util.List; import java.util.List;
/** /**
* This object represents a sticker set.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* This object represents a sticker set.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -33,12 +33,21 @@ public class StickerSet implements BotApiObject {
private static final String ISVIDEO_FIELD = "is_video"; private static final String ISVIDEO_FIELD = "is_video";
private static final String THUMB_FIELD = "thumb"; private static final String THUMB_FIELD = "thumb";
/**
* Type of stickers in the set, currently one of regular, mask, custom_emoji
*/
@JsonProperty(STICKERS_FIELD) @JsonProperty(STICKERS_FIELD)
private String stickerType; ///< Type of stickers in the set, currently one of regular, mask, custom_emoji private String stickerType;
/**
* Sticker set name
*/
@JsonProperty(NAME_FIELD) @JsonProperty(NAME_FIELD)
private String name; ///< Sticker set name private String name;
/**
* Sticker set title
*/
@JsonProperty(TITLE_FIELD) @JsonProperty(TITLE_FIELD)
private String title; ///< Sticker set title private String title;
/** /**
* True, if the sticker set contains animated stickers * True, if the sticker set contains animated stickers
* *
@ -47,14 +56,27 @@ public class StickerSet implements BotApiObject {
@JsonProperty(CONTAINSMASKS_FIELD) @JsonProperty(CONTAINSMASKS_FIELD)
@Deprecated @Deprecated
private Boolean containsMasks; private Boolean containsMasks;
/**
* True, if the sticker set contains masks
*/
@JsonProperty(STICKERS_FIELD) @JsonProperty(STICKERS_FIELD)
private List<Sticker> stickers; ///< True, if the sticker set contains masks private List<Sticker> stickers;
/**
* List of all set stickers
*/
@JsonProperty(ISANIMATED_FIELD) @JsonProperty(ISANIMATED_FIELD)
private Boolean isAnimated; ///< List of all set stickers private Boolean isAnimated;
/**
* True, if the sticker set contains video stickers
*/
@JsonProperty(ISVIDEO_FIELD) @JsonProperty(ISVIDEO_FIELD)
private Boolean isVideo; ///< True, if the sticker set contains video stickers private Boolean isVideo;
/**
* Optional.
* Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
*/
@JsonProperty(THUMB_FIELD) @JsonProperty(THUMB_FIELD)
private PhotoSize thumb; ///< Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format private PhotoSize thumb;
public boolean isRegularSticker() { public boolean isRegularSticker() {
return "regular".equals(stickerType); return "regular".equals(stickerType);

View File

@ -5,10 +5,9 @@ import lombok.*;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* This object represents a service message about a video chat ended in the chat.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 6.0 * @version 6.0
*
* This object represents a service message about a video chat ended in the chat.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -19,6 +18,9 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
public class VideoChatEnded implements BotApiObject { public class VideoChatEnded implements BotApiObject {
private static final String DURATION_FIELD = "duration"; private static final String DURATION_FIELD = "duration";
/**
* Voice chat duration; in seconds
*/
@JsonProperty(DURATION_FIELD) @JsonProperty(DURATION_FIELD)
private Integer duration; ///< Voice chat duration; in seconds private Integer duration;
} }

View File

@ -8,11 +8,9 @@ import org.telegram.telegrambots.meta.api.objects.User;
import java.util.List; import java.util.List;
/** /**
* This object represents a service message about new members invited to a video chat.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 6.0 * @version 6.0
*
* This object represents a service message about new members invited to a video chat.
*
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -23,6 +21,10 @@ import java.util.List;
public class VideoChatParticipantsInvited implements BotApiObject { public class VideoChatParticipantsInvited implements BotApiObject {
private static final String USERS_FIELD = "users"; private static final String USERS_FIELD = "users";
/**
* Optional.
* New members that were invited to the voice chat
*/
@JsonProperty(USERS_FIELD) @JsonProperty(USERS_FIELD)
private List<User> users; ///< Optional. New members that were invited to the voice chat private List<User> users;
} }

View File

@ -5,10 +5,9 @@ import lombok.*;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/** /**
* This object represents a service message about a video chat scheduled in the chat.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 6.0 * @version 6.0
*
* This object represents a service message about a video chat scheduled in the chat.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -19,7 +18,10 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
public class VideoChatScheduled implements BotApiObject { public class VideoChatScheduled implements BotApiObject {
private static final String STARTDATE_FIELD = "start_date"; private static final String STARTDATE_FIELD = "start_date";
/**
* Point in time (Unix timestamp) when the voice chat is supposed to be started by a chat administrator
*/
@JsonProperty(STARTDATE_FIELD) @JsonProperty(STARTDATE_FIELD)
@NonNull @NonNull
private Integer startDate; ///< Point in time (Unix timestamp) when the voice chat is supposed to be started by a chat administrator private Integer startDate;
} }

View File

@ -7,10 +7,9 @@ import org.telegram.telegrambots.meta.api.interfaces.Validable;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/** /**
* Contains data sent from a web app to the bot.
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 6.0 * @version 6.0
*
* Contains data sent from a web app to the bot.
*/ */
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Getter @Getter
@ -22,11 +21,17 @@ public class WebAppData implements BotApiObject {
private static final String DATA_FIELD = "data"; private static final String DATA_FIELD = "data";
private static final String BUTTONTEXT_FIELD = "button_text"; private static final String BUTTONTEXT_FIELD = "button_text";
/**
* The data
*/
@JsonProperty(DATA_FIELD) @JsonProperty(DATA_FIELD)
@NonNull @NonNull
private String data; ///< The data private String data;
/**
* Text of the web_app keyboard button, from which the web app was opened
*/
@JsonProperty(BUTTONTEXT_FIELD) @JsonProperty(BUTTONTEXT_FIELD)
@NonNull @NonNull
private String buttonText; ///< Text of the web_app keyboard button, from which the web app was opened private String buttonText;
} }

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.methods.invoices;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice; import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import java.util.ArrayList; import java.util.ArrayList;
@ -11,6 +12,7 @@ import java.util.Collections;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
@ -111,6 +113,23 @@ public class CreateInvoiceLinkTest {
assertEquals("No more that 4 suggested tips allowed", thrown.getMessage()); assertEquals("No more that 4 suggested tips allowed", thrown.getMessage());
} }
@Test
public void testCreateInvoiceLinkDeserializeValidResponse(){
String responseText = "{\n" +
" \"ok\": true,\n" +
" \"result\": \"https://t.me/testlink\" \n" +
"}";
CreateInvoiceLink createInvoiceLink = createSendInvoiceObject();
try {
String link = createInvoiceLink.deserializeResponse(responseText);
assertEquals("https://t.me/testlink",link);
} catch (TelegramApiRequestException e) {
fail(e.getMessage());
}
}
private CreateInvoiceLink createSendInvoiceObject() { private CreateInvoiceLink createSendInvoiceObject() {
return CreateInvoiceLink.builder() return CreateInvoiceLink.builder()
.title("Title") .title("Title")

View File

@ -18,14 +18,14 @@ Usage
<dependency> <dependency>
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>telegrambots-spring-boot-starter</artifactId> <artifactId>telegrambots-spring-boot-starter</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</dependency> </dependency>
``` ```
**Gradle** **Gradle**
```gradle ```gradle
implementation 'org.telegram:telegrambots-spring-boot-starter:6.1.0' implementation 'org.telegram:telegrambots-spring-boot-starter:6.3.0'
``` ```
Motivation Motivation

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.warp</groupId> <groupId>org.warp</groupId>
<artifactId>Bots</artifactId> <artifactId>Bots</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</parent> </parent>
<artifactId>telegrambots-spring-boot-starter</artifactId> <artifactId>telegrambots-spring-boot-starter</artifactId>
@ -72,8 +72,8 @@
<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>
<telegrambots.version>6.1.0</telegrambots.version> <telegrambots.version>6.3.0</telegrambots.version>
<spring-boot.version>2.7.3</spring-boot.version> <spring-boot.version>2.7.5</spring-boot.version>
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version> <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version> <nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
@ -135,6 +135,11 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.warp</groupId> <groupId>org.warp</groupId>
<artifactId>Bots</artifactId> <artifactId>Bots</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</parent> </parent>
<artifactId>telegrambots</artifactId> <artifactId>telegrambots</artifactId>
@ -93,7 +93,7 @@
<dependency> <dependency>
<groupId>org.warp</groupId> <groupId>org.warp</groupId>
<artifactId>telegrambots-meta</artifactId> <artifactId>telegrambots-meta</artifactId>
<version>6.1.0</version> <version>6.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>

View File

@ -171,6 +171,9 @@ public abstract class DefaultAbsSender extends AbsSender {
if (sendDocument.getReplyToMessageId() != null) { if (sendDocument.getReplyToMessageId() != null) {
builder.addTextBody(SendDocument.REPLYTOMESSAGEID_FIELD, sendDocument.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendDocument.REPLYTOMESSAGEID_FIELD, sendDocument.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE);
} }
if (sendDocument.getMessageThreadId() != null) {
builder.addTextBody(SendDocument.MESSAGETHREADID_FIELD, sendDocument.getMessageThreadId().toString(), TEXT_PLAIN_CONTENT_TYPE);
}
if (sendDocument.getCaption() != null) { if (sendDocument.getCaption() != null) {
builder.addTextBody(SendDocument.CAPTION_FIELD, sendDocument.getCaption(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendDocument.CAPTION_FIELD, sendDocument.getCaption(), TEXT_PLAIN_CONTENT_TYPE);
if (sendDocument.getParseMode() != null) { if (sendDocument.getParseMode() != null) {
@ -229,6 +232,9 @@ public abstract class DefaultAbsSender extends AbsSender {
if (sendPhoto.getReplyToMessageId() != null) { if (sendPhoto.getReplyToMessageId() != null) {
builder.addTextBody(SendPhoto.REPLYTOMESSAGEID_FIELD, sendPhoto.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendPhoto.REPLYTOMESSAGEID_FIELD, sendPhoto.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE);
} }
if (sendPhoto.getMessageThreadId() != null) {
builder.addTextBody(SendPhoto.MESSAGETHREADID_FIELD, sendPhoto.getMessageThreadId().toString(), TEXT_PLAIN_CONTENT_TYPE);
}
if (sendPhoto.getCaption() != null) { if (sendPhoto.getCaption() != null) {
builder.addTextBody(SendPhoto.CAPTION_FIELD, sendPhoto.getCaption(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendPhoto.CAPTION_FIELD, sendPhoto.getCaption(), TEXT_PLAIN_CONTENT_TYPE);
if (sendPhoto.getParseMode() != null) { if (sendPhoto.getParseMode() != null) {
@ -277,6 +283,9 @@ public abstract class DefaultAbsSender extends AbsSender {
if (sendVideo.getReplyToMessageId() != null) { if (sendVideo.getReplyToMessageId() != null) {
builder.addTextBody(SendVideo.REPLYTOMESSAGEID_FIELD, sendVideo.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendVideo.REPLYTOMESSAGEID_FIELD, sendVideo.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE);
} }
if (sendVideo.getMessageThreadId() != null) {
builder.addTextBody(SendVideo.MESSAGETHREADID_FIELD, sendVideo.getMessageThreadId().toString(), TEXT_PLAIN_CONTENT_TYPE);
}
if (sendVideo.getCaption() != null) { if (sendVideo.getCaption() != null) {
builder.addTextBody(SendVideo.CAPTION_FIELD, sendVideo.getCaption(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendVideo.CAPTION_FIELD, sendVideo.getCaption(), TEXT_PLAIN_CONTENT_TYPE);
if (sendVideo.getParseMode() != null) { if (sendVideo.getParseMode() != null) {
@ -342,6 +351,9 @@ public abstract class DefaultAbsSender extends AbsSender {
if (sendVideoNote.getReplyToMessageId() != null) { if (sendVideoNote.getReplyToMessageId() != null) {
builder.addTextBody(SendVideoNote.REPLYTOMESSAGEID_FIELD, sendVideoNote.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendVideoNote.REPLYTOMESSAGEID_FIELD, sendVideoNote.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE);
} }
if (sendVideoNote.getMessageThreadId() != null) {
builder.addTextBody(SendVideoNote.MESSAGETHREADID_FIELD, sendVideoNote.getMessageThreadId().toString(), TEXT_PLAIN_CONTENT_TYPE);
}
if (sendVideoNote.getDuration() != null) { if (sendVideoNote.getDuration() != null) {
builder.addTextBody(SendVideoNote.DURATION_FIELD, sendVideoNote.getDuration().toString(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendVideoNote.DURATION_FIELD, sendVideoNote.getDuration().toString(), TEXT_PLAIN_CONTENT_TYPE);
} }
@ -392,6 +404,9 @@ public abstract class DefaultAbsSender extends AbsSender {
if (sendSticker.getReplyToMessageId() != null) { if (sendSticker.getReplyToMessageId() != null) {
builder.addTextBody(SendSticker.REPLYTOMESSAGEID_FIELD, sendSticker.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendSticker.REPLYTOMESSAGEID_FIELD, sendSticker.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE);
} }
if (sendSticker.getMessageThreadId() != null) {
builder.addTextBody(SendSticker.MESSAGETHREADID_FIELD, sendSticker.getMessageThreadId().toString(), TEXT_PLAIN_CONTENT_TYPE);
}
if (sendSticker.getDisableNotification() != null) { if (sendSticker.getDisableNotification() != null) {
builder.addTextBody(SendSticker.DISABLENOTIFICATION_FIELD, sendSticker.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendSticker.DISABLENOTIFICATION_FIELD, sendSticker.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE);
} }
@ -435,6 +450,9 @@ public abstract class DefaultAbsSender extends AbsSender {
if (sendAudio.getReplyToMessageId() != null) { if (sendAudio.getReplyToMessageId() != null) {
builder.addTextBody(SendAudio.REPLYTOMESSAGEID_FIELD, sendAudio.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendAudio.REPLYTOMESSAGEID_FIELD, sendAudio.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE);
} }
if (sendAudio.getMessageThreadId() != null) {
builder.addTextBody(SendAudio.MESSAGETHREADID_FIELD, sendAudio.getMessageThreadId().toString(), TEXT_PLAIN_CONTENT_TYPE);
}
if (sendAudio.getPerformer() != null) { if (sendAudio.getPerformer() != null) {
builder.addTextBody(SendAudio.PERFOMER_FIELD, sendAudio.getPerformer(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendAudio.PERFOMER_FIELD, sendAudio.getPerformer(), TEXT_PLAIN_CONTENT_TYPE);
} }
@ -503,6 +521,9 @@ public abstract class DefaultAbsSender extends AbsSender {
if (sendVoice.getReplyToMessageId() != null) { if (sendVoice.getReplyToMessageId() != null) {
builder.addTextBody(SendVoice.REPLYTOMESSAGEID_FIELD, sendVoice.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendVoice.REPLYTOMESSAGEID_FIELD, sendVoice.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE);
} }
if (sendVoice.getMessageThreadId() != null) {
builder.addTextBody(SendVoice.MESSAGETHREADID_FIELD, sendVoice.getMessageThreadId().toString(), TEXT_PLAIN_CONTENT_TYPE);
}
if (sendVoice.getDisableNotification() != null) { if (sendVoice.getDisableNotification() != null) {
builder.addTextBody(SendVoice.DISABLENOTIFICATION_FIELD, sendVoice.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendVoice.DISABLENOTIFICATION_FIELD, sendVoice.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE);
} }
@ -585,6 +606,9 @@ public abstract class DefaultAbsSender extends AbsSender {
if (sendMediaGroup.getReplyToMessageId() != null) { if (sendMediaGroup.getReplyToMessageId() != null) {
builder.addTextBody(SendMediaGroup.REPLYTOMESSAGEID_FIELD, sendMediaGroup.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendMediaGroup.REPLYTOMESSAGEID_FIELD, sendMediaGroup.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE);
} }
if (sendMediaGroup.getMessageThreadId() != null) {
builder.addTextBody(SendMediaGroup.MESSAGETHREADID_FIELD, sendMediaGroup.getMessageThreadId().toString(), TEXT_PLAIN_CONTENT_TYPE);
}
if (sendMediaGroup.getAllowSendingWithoutReply() != null) { if (sendMediaGroup.getAllowSendingWithoutReply() != null) {
builder.addTextBody(SendMediaGroup.ALLOWSENDINGWITHOUTREPLY_FIELD, sendMediaGroup.getAllowSendingWithoutReply().toString(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendMediaGroup.ALLOWSENDINGWITHOUTREPLY_FIELD, sendMediaGroup.getAllowSendingWithoutReply().toString(), TEXT_PLAIN_CONTENT_TYPE);
} }
@ -766,6 +790,9 @@ public abstract class DefaultAbsSender extends AbsSender {
if (sendAnimation.getReplyToMessageId() != null) { if (sendAnimation.getReplyToMessageId() != null) {
builder.addTextBody(SendAnimation.REPLYTOMESSAGEID_FIELD, sendAnimation.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendAnimation.REPLYTOMESSAGEID_FIELD, sendAnimation.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE);
} }
if (sendAnimation.getMessageThreadId() != null) {
builder.addTextBody(SendAnimation.MESSAGETHREADID_FIELD, sendAnimation.getMessageThreadId().toString(), TEXT_PLAIN_CONTENT_TYPE);
}
if (sendAnimation.getDisableNotification() != null) { if (sendAnimation.getDisableNotification() != null) {
builder.addTextBody(SendAnimation.DISABLENOTIFICATION_FIELD, sendAnimation.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE); builder.addTextBody(SendAnimation.DISABLENOTIFICATION_FIELD, sendAnimation.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE);
} }

View File

@ -16,7 +16,10 @@ import java.util.List;
* @date 21 of July of 2016 * @date 21 of July of 2016
*/ */
public class DefaultBotOptions implements BotOptions { public class DefaultBotOptions implements BotOptions {
private int maxThreads; ///< Max number of threads used for async methods executions (default 1) /**
* Max number of threads used for async methods executions (default 1)
*/
private int maxThreads;
private RequestConfig requestConfig; private RequestConfig requestConfig;
private volatile HttpContext httpContext; private volatile HttpContext httpContext;
private BackOff backOff; private BackOff backOff;