Api version 6.3
This commit is contained in:
parent
4db7532b61
commit
1e040bea4d
@ -27,18 +27,18 @@ Just import add the library to your project with one of these options:
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
2. Using 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)
|
||||
4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/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.3.0)
|
||||
|
||||
In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.
|
||||
|
||||
|
@ -11,13 +11,13 @@ First you need to acquire the library and add it to your project. There are seve
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</dependency>
|
||||
```
|
||||
* With **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).
|
||||
|
@ -9,12 +9,12 @@ As with any Java project, you will need to set your dependencies.
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots-abilities</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</dependency>
|
||||
```
|
||||
* **Gradle**
|
||||
```gradle
|
||||
implementation 'org.telegram:telegrambots-abilities:6.1.0'
|
||||
implementation 'org.telegram:telegrambots-abilities:6.3.0'
|
||||
```
|
||||
* [JitPack](https://jitpack.io/#rubenlagus/TelegramBots)
|
||||
|
||||
|
16
pom.xml
16
pom.xml
@ -7,7 +7,7 @@
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>Bots</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
|
||||
<modules>
|
||||
<module>telegrambots</module>
|
||||
@ -67,13 +67,13 @@
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
|
||||
<junit.version>5.8.2</junit.version>
|
||||
<mockito.version>4.6.1</mockito.version>
|
||||
<mockitojupiter.version>4.6.1</mockitojupiter.version>
|
||||
<jacksonanotation.version>2.13.2</jacksonanotation.version>
|
||||
<jackson.version>2.13.2.2</jackson.version>
|
||||
<json.version>20220320</json.version>
|
||||
<slf4j.version>1.7.36</slf4j.version>
|
||||
<junit.version>5.9.1</junit.version>
|
||||
<mockito.version>4.8.1</mockito.version>
|
||||
<mockitojupiter.version>4.8.1</mockitojupiter.version>
|
||||
<jacksonanotation.version>2.14.0</jacksonanotation.version>
|
||||
<jackson.version>2.14.0</jackson.version>
|
||||
<json.version>20220924</json.version>
|
||||
<slf4j.version>2.0.3</slf4j.version>
|
||||
<jakarta.annotation.version>2.1.1</jakarta.annotation.version>
|
||||
<lombok.version>1.18.24</lombok.version>
|
||||
<guava.version>31.1-jre</guava.version>
|
||||
|
@ -18,14 +18,14 @@ Usage
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots-abilities</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
**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)
|
||||
|
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>Bots</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>telegrambots-abilities</artifactId>
|
||||
@ -84,7 +84,7 @@
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
|
@ -15,14 +15,14 @@ Usage
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots-chat-session-bot</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
**Gradle**
|
||||
|
||||
```gradle
|
||||
implementation 'org.telegram:telegrambots-chat-session-bot:6.1.0'
|
||||
implementation 'org.telegram:telegrambots-chat-session-bot:6.3.0'
|
||||
```
|
||||
|
||||
Motivation
|
||||
|
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>Bots</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>telegrambots-chat-session-bot</artifactId>
|
||||
@ -76,7 +76,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
||||
<shiro.version>1.9.1</shiro.version>
|
||||
<shiro.version>1.10.0</shiro.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -84,7 +84,7 @@
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-core -->
|
||||
|
@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambotsextensions</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
2. Using Gradle:
|
||||
|
||||
```gradle
|
||||
implementation 'org.telegram:telegrambotsextensions:6.1.0'
|
||||
implementation 'org.telegram:telegrambotsextensions:6.3.0'
|
||||
```
|
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>Bots</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>telegrambotsextensions</artifactId>
|
||||
@ -75,7 +75,7 @@
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>Bots</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>telegrambots-meta</artifactId>
|
||||
|
@ -42,6 +42,7 @@ public class CopyMessage extends BotApiMethod<MessageId> {
|
||||
public static final String PATH = "copyMessage";
|
||||
|
||||
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 MESSAGEID_FIELD = "message_id";
|
||||
private static final String CAPTION_FIELD = "caption";
|
||||
@ -56,6 +57,12 @@ public class CopyMessage extends BotApiMethod<MessageId> {
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
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)
|
||||
@NonNull
|
||||
private String fromChatId; ///< Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
|
||||
|
@ -34,6 +34,7 @@ public class ForwardMessage extends BotApiMethodMessage {
|
||||
public static final String PATH = "forwardmessage";
|
||||
|
||||
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 MESSAGEID_FIELD = "message_id";
|
||||
private static final String DISABLENOTIFICATION_FIELD = "disable_notification";
|
||||
@ -42,6 +43,12 @@ public class ForwardMessage extends BotApiMethodMessage {
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
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)
|
||||
@NonNull
|
||||
private String fromChatId; ///< Unique identifier for the chat where the original message was sent — User or GroupChat id
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -46,6 +46,7 @@ public class PromoteChatMember extends BotApiMethodBoolean {
|
||||
private static final String ISANONYMOUS_FIELD = "is_anonymous";
|
||||
private static final String CANMANAGECHAT_FIELD = "can_manage_chat";
|
||||
private static final String CANMANAGEVIDEOCHATS_FIELD = "can_manage_video_chats";
|
||||
private static final String CANMANAGETOPICS_FIELD = "can_manage_topics";
|
||||
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
@ -87,6 +88,12 @@ public class PromoteChatMember extends BotApiMethodBoolean {
|
||||
*/
|
||||
@JsonProperty(CANMANAGEVIDEOCHATS_FIELD)
|
||||
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
|
||||
public void setChatId(@NonNull Long chatId) {
|
||||
|
@ -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)
|
||||
@JsonProperty(TITLE_FIELD)
|
||||
@NonNull
|
||||
private String title; ///< Required. New chat title, 1-255 characters
|
||||
private String title; ///< Required. New chat title, 1-128 characters
|
||||
|
||||
@Tolerate
|
||||
public void setChatId(@NonNull Long chatId) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.telegram.telegrambots.meta.api.methods.invoices;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.google.common.base.Strings;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@ -14,20 +13,17 @@ import lombok.Setter;
|
||||
import lombok.Singular;
|
||||
import lombok.ToString;
|
||||
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.exceptions.TelegramApiRequestException;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @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)
|
||||
@Getter
|
||||
@ -37,7 +33,7 @@ import java.util.List;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class CreateInvoiceLink extends BotApiMethodMessage {
|
||||
public class CreateInvoiceLink extends BotApiMethod<String> {
|
||||
public static final String PATH = "createInvoiceLink";
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String deserializeResponse(String answer) throws TelegramApiRequestException {
|
||||
return deserializeResponse(answer, String.class);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.telegram.telegrambots.meta.api.methods.invoices;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.google.common.base.Strings;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@ -14,16 +13,11 @@ import lombok.Setter;
|
||||
import lombok.Singular;
|
||||
import lombok.ToString;
|
||||
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.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.replykeyboard.InlineKeyboardMarkup;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -43,6 +37,7 @@ public class SendInvoice extends BotApiMethodMessage {
|
||||
public static final String PATH = "sendinvoice";
|
||||
|
||||
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 DESCRIPTION_FIELD = "description";
|
||||
private static final String PAYLOAD_FIELD = "payload";
|
||||
@ -73,6 +68,12 @@ public class SendInvoice extends BotApiMethodMessage {
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
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)
|
||||
@NonNull
|
||||
private String title; ///< Product name
|
||||
|
@ -40,6 +40,7 @@ public class SendPoll extends BotApiMethodMessage {
|
||||
public static final String PATH = "sendPoll";
|
||||
|
||||
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 OPTIONS_FIELD = "options";
|
||||
private static final String ISANONYMOUS_FIELD = "is_anonymous";
|
||||
@ -65,6 +66,12 @@ public class SendPoll extends BotApiMethodMessage {
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
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)
|
||||
@NonNull
|
||||
private String question; ///< Poll question, 1-300 characters
|
||||
|
@ -41,6 +41,7 @@ public class SendAnimation extends PartialBotApiMethod<Message> {
|
||||
public static final String PATH = "sendAnimation";
|
||||
|
||||
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 DURATION_FIELD = "duration";
|
||||
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
|
||||
* 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
|
||||
private InputFile animation;
|
||||
private Integer duration; ///< Optional. Duration of sent animation in seconds
|
||||
|
@ -43,6 +43,7 @@ public class SendAudio extends PartialBotApiMethod<Message> {
|
||||
|
||||
public static final String DURATION_FIELD = "duration";
|
||||
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 REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
|
||||
public static final String DISABLENOTIFICATION_FIELD = "disable_notification";
|
||||
@ -58,6 +59,11 @@ public class SendAudio extends PartialBotApiMethod<Message> {
|
||||
|
||||
@NonNull
|
||||
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
|
||||
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
|
||||
|
@ -33,6 +33,7 @@ public class SendContact extends BotApiMethodMessage {
|
||||
public static final String PATH = "sendContact";
|
||||
|
||||
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 FIRST_NAME_FIELD = "first_name";
|
||||
private static final String LAST_NAME_FIELD = "last_name";
|
||||
@ -46,6 +47,12 @@ public class SendContact extends BotApiMethodMessage {
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
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)
|
||||
@NonNull
|
||||
private String phoneNumber; ///< User's phone number
|
||||
|
@ -38,6 +38,7 @@ public class SendDice extends BotApiMethodMessage {
|
||||
public static final String PATH = "sendDice";
|
||||
|
||||
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 DISABLENOTIFICATION_FIELD = "disable_notification";
|
||||
private static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
|
||||
@ -51,6 +52,12 @@ public class SendDice extends BotApiMethodMessage {
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
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.
|
||||
*
|
||||
|
@ -38,6 +38,7 @@ public class SendDocument extends PartialBotApiMethod<Message> {
|
||||
public static final String PATH = "senddocument";
|
||||
|
||||
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 CAPTION_FIELD = "caption";
|
||||
public static final String DISABLENOTIFICATION_FIELD = "disable_notification";
|
||||
@ -52,6 +53,11 @@ public class SendDocument extends PartialBotApiMethod<Message> {
|
||||
|
||||
@NonNull
|
||||
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
|
||||
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
|
||||
|
@ -49,6 +49,8 @@ public class SendGame extends BotApiMethodMessage {
|
||||
public static final String PATH = "sendGame";
|
||||
|
||||
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 DISABLENOTIFICATION_FIELD = "disable_notification";
|
||||
private static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
|
||||
@ -59,6 +61,12 @@ public class SendGame extends BotApiMethodMessage {
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
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)
|
||||
@NonNull
|
||||
private String gameShortName; ///< Short name of the game
|
||||
|
@ -32,6 +32,8 @@ public class SendLocation extends BotApiMethodMessage {
|
||||
public static final String PATH = "sendlocation";
|
||||
|
||||
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 LONGITUDE_FIELD = "longitude";
|
||||
private static final String DISABLENOTIFICATION_FIELD = "disable_notification";
|
||||
@ -47,6 +49,12 @@ public class SendLocation extends BotApiMethodMessage {
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
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)
|
||||
@NonNull
|
||||
private Double latitude; ///< Latitude of location
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.telegram.telegrambots.meta.api.methods.send;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@ -44,23 +43,24 @@ public class SendMediaGroup extends PartialBotApiMethod<ArrayList<Message>> {
|
||||
public static final String PATH = "sendMediaGroup";
|
||||
|
||||
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 REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
|
||||
public static final String DISABLENOTIFICATION_FIELD = "disable_notification";
|
||||
public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply";
|
||||
public static final String PROTECTCONTENT_FIELD = "protect_content";
|
||||
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
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
|
||||
private List<InputMedia> medias; ///< A JSON-serialized array describing photos and videos to be sent, must include 2–10 items
|
||||
@JsonProperty(REPLYTOMESSAGEID_FIELD)
|
||||
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.
|
||||
@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 protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
|
||||
|
||||
|
@ -38,6 +38,7 @@ public class SendMessage extends BotApiMethodMessage {
|
||||
public static final String PATH = "sendmessage";
|
||||
|
||||
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 PARSEMODE_FIELD = "parse_mode";
|
||||
private static final String DISABLEWEBPAGEPREVIEW_FIELD = "disable_web_page_preview";
|
||||
@ -51,6 +52,12 @@ public class SendMessage extends BotApiMethodMessage {
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
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)
|
||||
@NonNull
|
||||
private String text; ///< Text of the message to be sent
|
||||
|
@ -39,6 +39,7 @@ public class SendPhoto extends PartialBotApiMethod<Message> {
|
||||
public static final String PATH = "sendphoto";
|
||||
|
||||
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 CAPTION_FIELD = "caption";
|
||||
public static final String DISABLENOTIFICATION_FIELD = "disable_notification";
|
||||
@ -51,6 +52,11 @@ public class SendPhoto extends PartialBotApiMethod<Message> {
|
||||
|
||||
@NonNull
|
||||
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
|
||||
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).
|
||||
|
@ -35,6 +35,7 @@ public class SendSticker extends PartialBotApiMethod<Message> {
|
||||
public static final String PATH = "sendsticker";
|
||||
|
||||
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 DISABLENOTIFICATION_FIELD = "disable_notification";
|
||||
public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
|
||||
@ -44,6 +45,11 @@ public class SendSticker extends PartialBotApiMethod<Message> {
|
||||
|
||||
@NonNull
|
||||
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
|
||||
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.
|
||||
|
@ -33,6 +33,7 @@ public class SendVenue extends BotApiMethodMessage {
|
||||
public static final String PATH = "sendVenue";
|
||||
|
||||
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 LONGITUDE_FIELD = "longitude";
|
||||
private static final String TITLE_FIELD = "title";
|
||||
@ -50,6 +51,12 @@ public class SendVenue extends BotApiMethodMessage {
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
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)
|
||||
@NonNull
|
||||
private Double latitude; ///< Latitude of venue location
|
||||
|
@ -39,6 +39,7 @@ public class SendVideo extends PartialBotApiMethod<Message> {
|
||||
public static final String PATH = "sendvideo";
|
||||
|
||||
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 DURATION_FIELD = "duration";
|
||||
public static final String CAPTION_FIELD = "caption";
|
||||
@ -56,6 +57,11 @@ public class SendVideo extends PartialBotApiMethod<Message> {
|
||||
|
||||
@NonNull
|
||||
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
|
||||
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
|
||||
|
@ -36,6 +36,7 @@ public class SendVideoNote extends PartialBotApiMethod<Message> {
|
||||
public static final String PATH = "sendvideonote";
|
||||
|
||||
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 DURATION_FIELD = "duration";
|
||||
public static final String LENGTH_FIELD = "length";
|
||||
@ -48,6 +49,11 @@ public class SendVideoNote extends PartialBotApiMethod<Message> {
|
||||
|
||||
@NonNull
|
||||
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
|
||||
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
|
||||
|
@ -40,6 +40,7 @@ public class SendVoice extends PartialBotApiMethod<Message> {
|
||||
public static final String PATH = "sendvoice";
|
||||
|
||||
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 DISABLENOTIFICATION_FIELD = "disable_notification";
|
||||
public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
|
||||
@ -53,6 +54,11 @@ public class SendVoice extends PartialBotApiMethod<Message> {
|
||||
|
||||
@NonNull
|
||||
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
|
||||
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.
|
||||
|
@ -24,6 +24,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
* - 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 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.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
@ -12,6 +12,8 @@ import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
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
|
||||
@ -50,6 +52,9 @@ public class Chat implements BotApiObject {
|
||||
private static final String JOINTOSENDMESSAGES_FIELD = "join_to_send_messages";
|
||||
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 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 GROUPCHATTYPE = "group";
|
||||
@ -208,6 +213,29 @@ public class Chat implements BotApiObject {
|
||||
@JsonProperty(HASRESTRICTEDVOICEANDVIDEOMESSAGES_FIELD)
|
||||
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;
|
||||
|
||||
@JsonIgnore
|
||||
public Boolean isGroupChat() {
|
||||
return GROUPCHATTYPE.equals(type);
|
||||
|
@ -9,6 +9,9 @@ import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
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.Game;
|
||||
import org.telegram.telegrambots.meta.api.objects.passport.PassportData;
|
||||
@ -39,6 +42,7 @@ import java.util.List;
|
||||
@AllArgsConstructor
|
||||
public class Message implements BotApiObject {
|
||||
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 DATE_FIELD = "date";
|
||||
private static final String CHAT_FIELD = "chat";
|
||||
@ -97,12 +101,23 @@ public class Message implements BotApiObject {
|
||||
private static final String VIDEOCHATSTARTED_FIELD = "video_chat_started";
|
||||
private static final String VIDEOCHATENDED_FIELD = "video_chat_ended";
|
||||
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";
|
||||
|
||||
/**
|
||||
* Integer Unique message identifier
|
||||
*/
|
||||
@JsonProperty(MESSAGEID_FIELD)
|
||||
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
|
||||
@ -464,6 +479,30 @@ public class Message implements BotApiObject {
|
||||
*/
|
||||
@JsonProperty(VIDEOCHATSCHEDULED_FIELD)
|
||||
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;
|
||||
|
||||
public List<MessageEntity> getEntities() {
|
||||
if (entities != null) {
|
||||
@ -489,6 +528,11 @@ public class Message implements BotApiObject {
|
||||
return sticker != null;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public boolean isTopicMessage() {
|
||||
return isTopicMessage != null && isTopicMessage;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public boolean isGroupMessage() {
|
||||
return chat.isGroupChat();
|
||||
@ -656,4 +700,19 @@ public class Message implements BotApiObject {
|
||||
private boolean hasVideoChatParticipantsInvited() {
|
||||
return videoChatParticipantsInvited != null;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
private boolean hasForumTopicCreated() {
|
||||
return forumTopicCreated != null;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
private boolean hasForumTopicClosed() {
|
||||
return forumTopicClosed != null;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
private boolean hasForumTopicReopened() {
|
||||
return forumTopicReopened != null;
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ public class ChatAdministratorRights implements BotApiObject {
|
||||
private static final String CANPOSTMESSAGES_FIELD = "can_post_messages";
|
||||
private static final String CANEDITMESSAGES_FIELD = "can_edit_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
|
||||
@ -93,5 +94,10 @@ public class ChatAdministratorRights implements BotApiObject {
|
||||
*/
|
||||
@JsonProperty(CANPINMESSAGES_FIELD)
|
||||
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;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ public class ChatMemberAdministrator implements ChatMember {
|
||||
private static final String CANINVITEUSERS_FIELD = "can_invite_users";
|
||||
private static final String CANPINMESSAGES_FIELD = "can_pin_messages";
|
||||
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”
|
||||
@ -124,4 +125,10 @@ public class ChatMemberAdministrator implements ChatMember {
|
||||
*/
|
||||
@JsonProperty(CANMANAGEVIDEOCHATS_FIELD)
|
||||
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;
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ public class ChatMemberRestricted implements ChatMember {
|
||||
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 UNTILDATE_FIELD = "until_date";
|
||||
private static final String CANMANAGETOPICS_FIELD = "can_manage_topics";
|
||||
|
||||
/**
|
||||
* The member's status in the chat, always “restricted”
|
||||
@ -101,4 +102,9 @@ public class ChatMemberRestricted implements ChatMember {
|
||||
*/
|
||||
@JsonProperty(UNTILDATE_FIELD)
|
||||
private Integer untilDate;
|
||||
/**
|
||||
* True, if the user is allowed to create forum topics
|
||||
*/
|
||||
@JsonProperty(CANMANAGETOPICS_FIELD)
|
||||
private Boolean canManageTopics;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
@ -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 {
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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 {
|
||||
|
||||
}
|
@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.methods.invoices;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
|
||||
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.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
@ -111,6 +113,23 @@ public class CreateInvoiceLinkTest {
|
||||
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() {
|
||||
return CreateInvoiceLink.builder()
|
||||
.title("Title")
|
||||
|
@ -18,14 +18,14 @@ Usage
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots-spring-boot-starter</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
**Gradle**
|
||||
|
||||
```gradle
|
||||
implementation 'org.telegram:telegrambots-spring-boot-starter:6.1.0'
|
||||
implementation 'org.telegram:telegrambots-spring-boot-starter:6.3.0'
|
||||
```
|
||||
|
||||
Motivation
|
||||
|
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>Bots</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>telegrambots-spring-boot-starter</artifactId>
|
||||
@ -70,8 +70,8 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
||||
<telegrambots.version>6.1.0</telegrambots.version>
|
||||
<spring-boot.version>2.7.0</spring-boot.version>
|
||||
<telegrambots.version>6.3.0</telegrambots.version>
|
||||
<spring-boot.version>2.7.5</spring-boot.version>
|
||||
|
||||
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
|
||||
<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
|
||||
@ -110,6 +110,17 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>Bots</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>telegrambots</artifactId>
|
||||
@ -91,7 +91,7 @@
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots-meta</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
|
@ -167,6 +167,9 @@ public abstract class DefaultAbsSender extends AbsSender {
|
||||
if (sendDocument.getReplyToMessageId() != null) {
|
||||
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) {
|
||||
builder.addTextBody(SendDocument.CAPTION_FIELD, sendDocument.getCaption(), TEXT_PLAIN_CONTENT_TYPE);
|
||||
if (sendDocument.getParseMode() != null) {
|
||||
@ -225,6 +228,9 @@ public abstract class DefaultAbsSender extends AbsSender {
|
||||
if (sendPhoto.getReplyToMessageId() != null) {
|
||||
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) {
|
||||
builder.addTextBody(SendPhoto.CAPTION_FIELD, sendPhoto.getCaption(), TEXT_PLAIN_CONTENT_TYPE);
|
||||
if (sendPhoto.getParseMode() != null) {
|
||||
@ -273,6 +279,9 @@ public abstract class DefaultAbsSender extends AbsSender {
|
||||
if (sendVideo.getReplyToMessageId() != null) {
|
||||
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) {
|
||||
builder.addTextBody(SendVideo.CAPTION_FIELD, sendVideo.getCaption(), TEXT_PLAIN_CONTENT_TYPE);
|
||||
if (sendVideo.getParseMode() != null) {
|
||||
@ -338,6 +347,9 @@ public abstract class DefaultAbsSender extends AbsSender {
|
||||
if (sendVideoNote.getReplyToMessageId() != null) {
|
||||
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) {
|
||||
builder.addTextBody(SendVideoNote.DURATION_FIELD, sendVideoNote.getDuration().toString(), TEXT_PLAIN_CONTENT_TYPE);
|
||||
}
|
||||
@ -388,6 +400,9 @@ public abstract class DefaultAbsSender extends AbsSender {
|
||||
if (sendSticker.getReplyToMessageId() != null) {
|
||||
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) {
|
||||
builder.addTextBody(SendSticker.DISABLENOTIFICATION_FIELD, sendSticker.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE);
|
||||
}
|
||||
@ -431,6 +446,9 @@ public abstract class DefaultAbsSender extends AbsSender {
|
||||
if (sendAudio.getReplyToMessageId() != null) {
|
||||
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) {
|
||||
builder.addTextBody(SendAudio.PERFOMER_FIELD, sendAudio.getPerformer(), TEXT_PLAIN_CONTENT_TYPE);
|
||||
}
|
||||
@ -499,6 +517,9 @@ public abstract class DefaultAbsSender extends AbsSender {
|
||||
if (sendVoice.getReplyToMessageId() != null) {
|
||||
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) {
|
||||
builder.addTextBody(SendVoice.DISABLENOTIFICATION_FIELD, sendVoice.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE);
|
||||
}
|
||||
@ -581,6 +602,9 @@ public abstract class DefaultAbsSender extends AbsSender {
|
||||
if (sendMediaGroup.getReplyToMessageId() != null) {
|
||||
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) {
|
||||
builder.addTextBody(SendMediaGroup.ALLOWSENDINGWITHOUTREPLY_FIELD, sendMediaGroup.getAllowSendingWithoutReply().toString(), TEXT_PLAIN_CONTENT_TYPE);
|
||||
}
|
||||
@ -762,6 +786,9 @@ public abstract class DefaultAbsSender extends AbsSender {
|
||||
if (sendAnimation.getReplyToMessageId() != null) {
|
||||
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) {
|
||||
builder.addTextBody(SendAnimation.DISABLENOTIFICATION_FIELD, sendAnimation.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user