Skip to content

Commit

Permalink
Api Version 7.11
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenlagus committed Nov 18, 2024
1 parent f8523cd commit c00e48a
Show file tree
Hide file tree
Showing 44 changed files with 400 additions and 140 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<packaging>pom</packaging>
<version>7.10.0</version>
<version>7.11.0</version>

<modules>
<module>telegrambots-meta</module>
Expand Down
6 changes: 3 additions & 3 deletions telegrambots-abilities/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>7.10.0</version>
<version>7.11.0</version>
</parent>

<artifactId>telegrambots-abilities</artifactId>
Expand Down Expand Up @@ -104,12 +104,12 @@
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-webhook</artifactId>
<version>7.10.0</version>
<version>7.11.0</version>
</dependency>
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-longpolling</artifactId>
<version>7.10.0</version>
<version>7.11.0</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion telegrambots-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>7.10.0</version>
<version>7.11.0</version>
</parent>

<name>Telegram Bots Client</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ public CompletableFuture<List<Message>> executeAsync(SendPaidMedia sendPaidMedia
.addPart(SendPaidMedia.PROTECT_CONTENT_FIELD, sendPaidMedia.getProtectContent())
.addPart(SendPaidMedia.BUSINESS_CONNECTION_ID_FIELD, sendPaidMedia.getBusinessConnectionId())
.addPart(SendPaidMedia.PAYLOAD_FIELD, sendPaidMedia.getPayload())
.addPart(SendPaidMedia.ALLOW_PAID_BROADCAST_FIELD, sendPaidMedia.getAllowPaidBroadcast())
.addJsonPart(SendPaidMedia.CAPTION_ENTITIES_FIELD, sendPaidMedia.getCaptionEntities())
.addJsonPart(SendPaidMedia.REPLY_MARKUP_FIELD, sendPaidMedia.getReplyMarkup())
.addJsonPart(SendPaidMedia.REPLY_PARAMETERS_FIELD, sendPaidMedia.getReplyParameters());
Expand Down Expand Up @@ -299,6 +300,7 @@ public CompletableFuture<List<Message>> executeAsync(SendMediaGroup sendMediaGro
.addPart(SendMediaGroup.PROTECT_CONTENT_FIELD, sendMediaGroup.getProtectContent())
.addPart(SendMediaGroup.BUSINESS_CONNECTION_ID_FIELD, sendMediaGroup.getBusinessConnectionId())
.addPart(SendMediaGroup.MESSAGE_EFFECT_ID_FIELD, sendMediaGroup.getMessageEffectId())
.addPart(SendMediaGroup.ALLOW_PAID_BROADCAST_FIELD, sendMediaGroup.getAllowSendingWithoutReply())
.addJsonPart(SendMediaGroup.REPLY_MARKUP_FIELD, sendMediaGroup.getReplyMarkup())
.addJsonPart(SendMediaGroup.REPLY_PARAMETERS_FIELD, sendMediaGroup.getReplyParameters());

Expand Down Expand Up @@ -589,6 +591,7 @@ private <T extends Serializable, Method extends SendMediaBotMethod<T>> Completab
.addPart(SendMediaBotMethod.PROTECT_CONTENT_FIELD, method.getProtectContent())
.addPart(SendMediaBotMethod.ALLOW_SENDING_WITHOUT_REPLY_FIELD, method.getAllowSendingWithoutReply())
.addPart(SendMediaBotMethod.MESSAGE_EFFECT_ID_FIELD, method.getMessageEffectId())
.addPart(SendMediaBotMethod.ALLOW_PAID_BROADCAST_FIELD, method.getAllowPaidBroadcast())
.addJsonPart(SendMediaBotMethod.REPLY_PARAMETERS_FIELD, method.getReplyParameters())
.addJsonPart(SendMediaBotMethod.REPLY_MARKUP_FIELD, method.getReplyMarkup());

Expand Down
4 changes: 2 additions & 2 deletions telegrambots-extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-extensions</artifactId>
<version>7.10.0</version>
<version>7.11.0</version>
</dependency>
```

2. Using Gradle:

```gradle
implementation 'org.telegram:telegrambots-extensions:7.10.0'
implementation 'org.telegram:telegrambots-extensions:7.11.0'
```
6 changes: 3 additions & 3 deletions telegrambots-extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>7.10.0</version>
<version>7.11.0</version>
</parent>

<artifactId>telegrambots-extensions</artifactId>
Expand Down Expand Up @@ -89,12 +89,12 @@
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-webhook</artifactId>
<version>7.10.0</version>
<version>7.11.0</version>
</dependency>
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-longpolling</artifactId>
<version>7.10.0</version>
<version>7.11.0</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion telegrambots-longpolling/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>7.10.0</version>
<version>7.11.0</version>
</parent>

<artifactId>telegrambots-longpolling</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion telegrambots-meta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>7.10.0</version>
<version>7.11.0</version>
</parent>

<artifactId>telegrambots-meta</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.telegram.telegrambots.meta.annotations;

import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
@JacksonAnnotationsInside
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public @interface BotApiMethodJsonAnnotated {
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class CopyMessage extends BotApiMethod<MessageId> {
private static final String PROTECTCONTENT_FIELD = "protect_content";
private static final String REPLY_PARAMETERS_FIELD = "reply_parameters";
private static final String SHOW_CAPTION_ABOVE_MEDIA_FIELD = "show_caption_above_media";
private static final String ALLOW_PAID_BROADCAST_FIELD = "allow_paid_broadcast";

@JsonProperty(CHATID_FIELD)
@NonNull
Expand Down Expand Up @@ -109,6 +110,13 @@ public class CopyMessage extends BotApiMethod<MessageId> {
*/
@JsonProperty(SHOW_CAPTION_ABOVE_MEDIA_FIELD)
private Boolean showCaptionAboveMedia;
/**
* Optional
* Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
* The relevant Stars will be withdrawn from the bot's balance
*/
@JsonProperty(ALLOW_PAID_BROADCAST_FIELD)
private Boolean allowPaidBroadcast;

@Tolerate
public void setChatId(@NonNull Long chatId) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.telegram.telegrambots.meta.api.methods.botapimethods;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
Expand All @@ -14,8 +12,6 @@
*
* A method of Telegram Bots Api that is fully supported in json format
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@SuperBuilder
public abstract class BotApiMethod<T extends Serializable> extends PartialBotApiMethod<T> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.telegram.telegrambots.meta.api.methods.botapimethods;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.CollectionType;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.telegram.telegrambots.meta.annotations.BotApiMethodJsonAnnotated;
import org.telegram.telegrambots.meta.api.interfaces.Validable;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
Expand All @@ -24,7 +24,7 @@
*/
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@SuperBuilder
@JsonIgnoreProperties(ignoreUnknown = true)
@BotApiMethodJsonAnnotated
public abstract class PartialBotApiMethod<T extends Serializable> implements Validable {
@JsonIgnore
protected static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class SendInvoice extends BotApiMethodMessage {
private static final String PROTECT_CONTENT_FIELD = "protect_content";
private static final String REPLY_PARAMETERS_FIELD = "reply_parameters";
private static final String MESSAGE_EFFECT_ID_FIELD = "message_effect_id";
private static final String ALLOW_PAID_BROADCAST_FIELD = "allow_paid_broadcast";

/**
* Unique identifier for the target chat or username of the target channel (in the format @channelusername)
Expand Down Expand Up @@ -274,6 +275,13 @@ public class SendInvoice extends BotApiMethodMessage {
*/
@JsonProperty(MESSAGE_EFFECT_ID_FIELD)
private String messageEffectId;
/**
* Optional
* Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
* The relevant Stars will be withdrawn from the bot's balance
*/
@JsonProperty(ALLOW_PAID_BROADCAST_FIELD)
private Boolean allowPaidBroadcast;

@Tolerate
public void setChatId(@NonNull Long chatId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public class SendPoll extends BotApiMethodMessage {
private static final String QUESTION_PARSE_MODE_FIELD = "question_parse_mode";
private static final String QUESTION_ENTITIES_FIELD = "question_entities";
private static final String MESSAGE_EFFECT_ID_FIELD = "message_effect_id";
private static final String ALLOW_PAID_BROADCAST_FIELD = "allow_paid_broadcast";

/**
* Unique identifier for the target chat or username of the target channel (in the format @channelusername).
Expand Down Expand Up @@ -223,7 +224,13 @@ public class SendPoll extends BotApiMethodMessage {
*/
@JsonProperty(MESSAGE_EFFECT_ID_FIELD)
private String messageEffectId;

/**
* Optional
* Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
* The relevant Stars will be withdrawn from the bot's balance
*/
@JsonProperty(ALLOW_PAID_BROADCAST_FIELD)
private Boolean allowPaidBroadcast;

@Tolerate
public void setChatId(@NonNull Long chatId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ public class SendAnimation extends SendMediaBotMethod<Message> {
* Pass True, if the caption must be shown above the message media
*/
private Boolean showCaptionAboveMedia;
/**
* Optional
* Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
* The relevant Stars will be withdrawn from the bot's balance
*/
private Boolean allowPaidBroadcast;

@Tolerate
public void setChatId(@NonNull Long chatId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ public class SendAudio extends SendMediaBotMethod<Message> {
* Unique identifier of the message effect to be added to the message
*/
private String messageEffectId;
/**
* Optional
* Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
* The relevant Stars will be withdrawn from the bot's balance
*/
private Boolean allowPaidBroadcast;

@Tolerate
public void setChatId(@NonNull Long chatId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,30 @@
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 CHAT_ID_FIELD = "chat_id";
private static final String MESSAGE_THREAD_ID_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";
private static final String DISABLENOTIFICATION_FIELD = "disable_notification";
private static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
private static final String REPLYMARKUP_FIELD = "reply_markup";
private static final String DISABLE_NOTIFICATION_FIELD = "disable_notification";
private static final String REPLY_TO_MESSAGE_ID_FIELD = "reply_to_message_id";
private static final String REPLY_MARKUP_FIELD = "reply_markup";
private static final String VCARD_FIELD = "vcard";
private static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply";
private static final String PROTECTCONTENT_FIELD = "protect_content";
private static final String ALLOW_SENDING_WITHOUT_REPLY_FIELD = "allow_sending_without_reply";
private static final String PROTECT_CONTENT_FIELD = "protect_content";
private static final String REPLY_PARAMETERS_FIELD = "reply_parameters";
private static final String BUSINESS_CONNECTION_ID_FIELD = "business_connection_id";
private static final String MESSAGE_EFFECT_ID_FIELD = "message_effect_id";
private static final String ALLOW_PAID_BROADCAST_FIELD = "allow_paid_broadcast";

@JsonProperty(CHATID_FIELD)
@JsonProperty(CHAT_ID_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)
@JsonProperty(MESSAGE_THREAD_ID_FIELD)
private Integer messageThreadId;
@JsonProperty(PHONE_NUMBER_FIELD)
@NonNull
Expand All @@ -66,23 +68,23 @@ public class SendContact extends BotApiMethodMessage {
private String firstName; ///< User's first name
@JsonProperty(LAST_NAME_FIELD)
private String lastName; ///< Optional. User's last name
@JsonProperty(DISABLENOTIFICATION_FIELD)
@JsonProperty(DISABLE_NOTIFICATION_FIELD)
private Boolean disableNotification; ///< Optional. Sends the message silently. Users will receive a notification with no sound.
@JsonProperty(REPLYTOMESSAGEID_FIELD)
@JsonProperty(REPLY_TO_MESSAGE_ID_FIELD)
private Integer replyToMessageId; ///< Optional. If the message is a reply, ID of the original message
/**
* Optional.
* Additional interface options.
* A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard
* or to force a reply from the user.
*/
@JsonProperty(REPLYMARKUP_FIELD)
@JsonProperty(REPLY_MARKUP_FIELD)
private ReplyKeyboard replyMarkup;
@JsonProperty(VCARD_FIELD)
private String vCard; ///< Optional. Additional data about the contact in the form of a vCard
@JsonProperty(ALLOWSENDINGWITHOUTREPLY_FIELD)
@JsonProperty(ALLOW_SENDING_WITHOUT_REPLY_FIELD)
private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found
@JsonProperty(PROTECTCONTENT_FIELD)
@JsonProperty(PROTECT_CONTENT_FIELD)
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
/**
* Optional
Expand All @@ -100,7 +102,15 @@ public class SendContact extends BotApiMethodMessage {
* Optional
* Unique identifier of the message effect to be added to the message
*/
@JsonProperty(MESSAGE_EFFECT_ID_FIELD)
private String messageEffectId;
/**
* Optional
* Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
* The relevant Stars will be withdrawn from the bot's balance
*/
@JsonProperty(ALLOW_PAID_BROADCAST_FIELD)
private Boolean allowPaidBroadcast;

@Tolerate
public void setChatId(@NonNull Long chatId) {
Expand Down
Loading

0 comments on commit c00e48a

Please sign in to comment.