Api Version 6.4
This commit is contained in:
parent
1ec2a5103b
commit
bea63d4aaf
@ -0,0 +1,69 @@
|
||||
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.4
|
||||
* Use this method to close an open 'General' 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 True on success.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class CloseGeneralForumTopic extends BotApiMethodBoolean {
|
||||
public static final String PATH = "closeGeneralForumTopic";
|
||||
|
||||
private static final String CHATID_FIELD = "chat_id";
|
||||
|
||||
/**
|
||||
* Unique identifier for the target chat or username
|
||||
* of the target supergroup (in the format @supergroupusername)
|
||||
*/
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
private String chatId;
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return PATH;
|
||||
}
|
||||
|
||||
public static class CloseGeneralForumTopicBuilder {
|
||||
|
||||
@Tolerate
|
||||
public CloseGeneralForumTopicBuilder chatId(@NonNull Long chatId) {
|
||||
this.chatId = chatId.toString();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
@ -51,18 +51,20 @@ public class EditForumTopic extends BotApiMethodBoolean {
|
||||
@NonNull
|
||||
private Integer messageThreadId;
|
||||
/**
|
||||
* Topic name, 1-128 characters
|
||||
* Optional.
|
||||
* New topic name, 0-128 characters.
|
||||
* If not specified or empty, the current name of the topic will be kept
|
||||
*/
|
||||
@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
|
||||
* New unique identifier of the custom emoji shown as the topic icon.
|
||||
* Use getForumTopicIconStickers to get all allowed custom emoji identifiers.
|
||||
* Pass an empty string to remove the icon.
|
||||
* If not specified, the current icon will be kept
|
||||
*/
|
||||
@JsonProperty(ICONCUSTOMEMOJIID_FIELD)
|
||||
@NonNull
|
||||
private String iconCustomEmojiId;
|
||||
|
||||
@Tolerate
|
||||
@ -75,8 +77,10 @@ public class EditForumTopic extends BotApiMethodBoolean {
|
||||
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 (name != null && !name.isEmpty()) {
|
||||
if (name.length() > 128) {
|
||||
throw new TelegramApiValidationException("Name must be less than 128 characters", this);
|
||||
}
|
||||
}
|
||||
if (messageThreadId <= 0) {
|
||||
throw new TelegramApiValidationException("Message Thread Id can't be empty", 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.4
|
||||
* Use this method to edit the name of the 'General' 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.
|
||||
*
|
||||
* Returns True on success.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class EditGeneralForumTopic extends BotApiMethodBoolean {
|
||||
public static final String PATH = "editGeneralForumTopic";
|
||||
|
||||
private static final String CHATID_FIELD = "chat_id";
|
||||
private static final String NAME_FIELD = "name";
|
||||
|
||||
/**
|
||||
* Unique identifier for the target chat or username
|
||||
* of the target supergroup (in the format @supergroupusername)
|
||||
*/
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
private String chatId;
|
||||
/**
|
||||
* Optional.
|
||||
* New topic name, 1-128 characters
|
||||
*/
|
||||
@JsonProperty(NAME_FIELD)
|
||||
@NonNull
|
||||
private String name;
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
public static class EditGeneralForumTopicBuilder {
|
||||
|
||||
@Tolerate
|
||||
public EditGeneralForumTopicBuilder chatId(@NonNull Long chatId) {
|
||||
this.chatId = chatId.toString();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
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.4
|
||||
* Use this method to hide the 'General' 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.
|
||||
* The topic will be automatically closed if it was open.
|
||||
*
|
||||
* Returns True on success.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class HideGeneralForumTopic extends BotApiMethodBoolean {
|
||||
public static final String PATH = "hideGeneralForumTopic";
|
||||
|
||||
private static final String CHATID_FIELD = "chat_id";
|
||||
|
||||
/**
|
||||
* Unique identifier for the target chat or username
|
||||
* of the target supergroup (in the format @supergroupusername)
|
||||
*/
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
private String chatId;
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return PATH;
|
||||
}
|
||||
|
||||
public static class HideGeneralForumTopicBuilder {
|
||||
|
||||
@Tolerate
|
||||
public HideGeneralForumTopicBuilder chatId(@NonNull Long chatId) {
|
||||
this.chatId = chatId.toString();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
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.4
|
||||
* Use this method to reopen a closed 'General' 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.
|
||||
* The topic will be automatically unhidden if it was hidden.
|
||||
*
|
||||
* Returns True on success.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class ReopenGeneralForumTopic extends BotApiMethodBoolean {
|
||||
public static final String PATH = "reopenGeneralForumTopic";
|
||||
|
||||
private static final String CHATID_FIELD = "chat_id";
|
||||
|
||||
/**
|
||||
* Unique identifier for the target chat or username
|
||||
* of the target supergroup (in the format @supergroupusername)
|
||||
*/
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
private String chatId;
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return PATH;
|
||||
}
|
||||
|
||||
public static class ReopenGeneralForumTopicBuilder {
|
||||
|
||||
@Tolerate
|
||||
public ReopenGeneralForumTopicBuilder chatId(@NonNull Long chatId) {
|
||||
this.chatId = chatId.toString();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
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.4
|
||||
* Use this method to unhide the 'General' 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 True on success.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class UnhideGeneralForumTopic extends BotApiMethodBoolean {
|
||||
public static final String PATH = "unhideGeneralForumTopic";
|
||||
|
||||
private static final String CHATID_FIELD = "chat_id";
|
||||
|
||||
/**
|
||||
* Unique identifier for the target chat or username
|
||||
* of the target supergroup (in the format @supergroupusername)
|
||||
*/
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
private String chatId;
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return PATH;
|
||||
}
|
||||
|
||||
public static class UnhideGeneralForumTopicBuilder {
|
||||
|
||||
@Tolerate
|
||||
public UnhideGeneralForumTopicBuilder chatId(@NonNull Long chatId) {
|
||||
this.chatId = chatId.toString();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
* @author Ruben Bermudez
|
||||
* @version 1.0
|
||||
* Use this method to get information about a member of a chat.
|
||||
* The method is guaranteed to work only if the bot is an administrator in the chat.
|
||||
* Returns a ChatMember object on success.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
@ -55,6 +55,7 @@ public class SendAnimation extends PartialBotApiMethod<Message> {
|
||||
public static final String CAPTION_ENTITIES_FIELD = "caption_entities";
|
||||
public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply";
|
||||
public static final String PROTECTCONTENT_FIELD = "protect_content";
|
||||
public static final String HASSPOILER_FIELD = "has_spoiler";
|
||||
|
||||
@NonNull
|
||||
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
|
||||
@ -91,6 +92,11 @@ public class SendAnimation extends PartialBotApiMethod<Message> {
|
||||
private List<MessageEntity> captionEntities; ///< Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
|
||||
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
|
||||
/**
|
||||
* Optional.
|
||||
* Pass True if the animation must be covered with a spoiler animation
|
||||
*/
|
||||
private Boolean hasSpoiler;
|
||||
|
||||
@Tolerate
|
||||
public void setChatId(@NonNull Long chatId) {
|
||||
|
@ -35,6 +35,7 @@ public class SendChatAction extends BotApiMethodBoolean {
|
||||
|
||||
public static final String CHATID_FIELD = "chat_id";
|
||||
private static final String ACTION_FIELD = "action";
|
||||
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
|
||||
|
||||
@JsonProperty(CHATID_FIELD)
|
||||
@NonNull
|
||||
@ -54,6 +55,12 @@ public class SendChatAction extends BotApiMethodBoolean {
|
||||
@JsonProperty(ACTION_FIELD)
|
||||
@NonNull
|
||||
private String action;
|
||||
/**
|
||||
* Optional
|
||||
* Unique identifier for the target message thread; supergroups only
|
||||
*/
|
||||
@JsonProperty(MESSAGETHREADID_FIELD)
|
||||
private Integer messageThreadId;
|
||||
|
||||
@Tolerate
|
||||
public void setChatId(@NonNull Long chatId) {
|
||||
|
@ -49,6 +49,7 @@ public class SendPhoto extends PartialBotApiMethod<Message> {
|
||||
public static final String CAPTION_ENTITIES_FIELD = "caption_entities";
|
||||
public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply";
|
||||
public static final String PROTECTCONTENT_FIELD = "protect_content";
|
||||
public static final String HASSPOILER_FIELD = "has_spoiler";
|
||||
|
||||
@NonNull
|
||||
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
|
||||
@ -68,7 +69,11 @@ public class SendPhoto extends PartialBotApiMethod<Message> {
|
||||
private List<MessageEntity> captionEntities; ///< Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
|
||||
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
|
||||
|
||||
/**
|
||||
* Optional.
|
||||
* Pass True if the photo must be covered with a spoiler animation
|
||||
*/
|
||||
private Boolean hasSpoiler;
|
||||
@Tolerate
|
||||
public void setChatId(@NonNull Long chatId) {
|
||||
this.chatId = chatId.toString();
|
||||
|
@ -54,6 +54,7 @@ public class SendVideo extends PartialBotApiMethod<Message> {
|
||||
public static final String CAPTION_ENTITIES_FIELD = "caption_entities";
|
||||
public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply";
|
||||
public static final String PROTECTCONTENT_FIELD = "protect_content";
|
||||
public static final String HASSPOILER_FIELD = "has_spoiler";
|
||||
|
||||
@NonNull
|
||||
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
|
||||
@ -86,6 +87,11 @@ public class SendVideo extends PartialBotApiMethod<Message> {
|
||||
private List<MessageEntity> captionEntities; ///< Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
|
||||
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
|
||||
/**
|
||||
* Optional.
|
||||
* Pass True if the video must be covered with a spoiler animation
|
||||
*/
|
||||
private Boolean hasSpoiler;
|
||||
|
||||
@Tolerate
|
||||
public void setChatId(@NonNull Long chatId) {
|
||||
|
@ -55,6 +55,8 @@ public class Chat implements BotApiObject {
|
||||
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 HASAGGRESSIVEANTISPAMENABLED_FIELD = "has_aggressive_anti_spam_enabled";
|
||||
private static final String HASHIDDENMEMBERS_FIELD = "has_hidden_members";
|
||||
|
||||
private static final String USERCHATTYPE = "private";
|
||||
private static final String GROUPCHATTYPE = "group";
|
||||
@ -235,6 +237,21 @@ public class Chat implements BotApiObject {
|
||||
*/
|
||||
@JsonProperty(EMOJISTATUSCUSTOMEMOJIID_FIELD)
|
||||
private String emojiStatusCustomEmojiId;
|
||||
/**
|
||||
* Optional.
|
||||
* True, if aggressive anti-spam checks are enabled in the supergroup.
|
||||
* The field is only available to chat administrators.
|
||||
* Returned only in getChat.
|
||||
*/
|
||||
@JsonProperty(HASAGGRESSIVEANTISPAMENABLED_FIELD)
|
||||
private Boolean hasAggressiveAntiSpamEnabled;
|
||||
/**
|
||||
* Optional.
|
||||
* True, if non-administrators can only get the list of bots and administrators in the chat.
|
||||
* Returned only in getChat.
|
||||
*/
|
||||
@JsonProperty(HASHIDDENMEMBERS_FIELD)
|
||||
private Boolean hasHiddenMembers;
|
||||
|
||||
@JsonIgnore
|
||||
public Boolean isGroupChat() {
|
||||
|
@ -11,7 +11,10 @@ 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.ForumTopicEdited;
|
||||
import org.telegram.telegrambots.meta.api.objects.forum.ForumTopicReopened;
|
||||
import org.telegram.telegrambots.meta.api.objects.forum.GeneralForumTopicHidden;
|
||||
import org.telegram.telegrambots.meta.api.objects.forum.GeneralForumTopicUnhidden;
|
||||
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;
|
||||
@ -105,6 +108,11 @@ public class Message implements BotApiObject {
|
||||
private static final String FORUMTOPICCREATED_FIELD = "forum_topic_created";
|
||||
private static final String FORUMTOPICCLOSED_FIELD = "forum_topic_closed";
|
||||
private static final String FORUMTOPICREOPENED_FIELD = "forum_topic_reopened";
|
||||
private static final String FORUMTOPICEDITED_FIELD = "forum_topic_edited";
|
||||
private static final String GENERALFORUMTOPICHIDDEN_FIELD = "general_forum_topic_hidden";
|
||||
private static final String GENERALFORUMTOPICUNHIDDEN_FIELD = "general_forum_topic_unhidden";
|
||||
private static final String WRITEACCESSALLOWED_FIELD = "write_access_allowed";
|
||||
private static final String HASMEDIASPOILER_FIELD = "has_media_spoiler";
|
||||
|
||||
/**
|
||||
* Integer Unique message identifier
|
||||
@ -503,6 +511,36 @@ public class Message implements BotApiObject {
|
||||
*/
|
||||
@JsonProperty(FORUMTOPICREOPENED_FIELD)
|
||||
private ForumTopicReopened forumTopicReopened;
|
||||
/**
|
||||
* Optional.
|
||||
* Service message: forum topic edited
|
||||
*/
|
||||
@JsonProperty(FORUMTOPICEDITED_FIELD)
|
||||
private ForumTopicEdited forumTopicEdited;
|
||||
/**
|
||||
* Optional.
|
||||
* Service message: General forum topic hidden
|
||||
*/
|
||||
@JsonProperty(GENERALFORUMTOPICHIDDEN_FIELD)
|
||||
private GeneralForumTopicHidden generalForumTopicHidden;
|
||||
/**
|
||||
* Optional.
|
||||
* Service message: General forum topic unhidden
|
||||
*/
|
||||
@JsonProperty(GENERALFORUMTOPICUNHIDDEN_FIELD)
|
||||
private GeneralForumTopicUnhidden generalForumTopicUnhidden;
|
||||
/**
|
||||
* Optional.
|
||||
* Service message: the user allowed the bot added to the attachment menu to write messages
|
||||
*/
|
||||
@JsonProperty(WRITEACCESSALLOWED_FIELD)
|
||||
private WriteAccessAllowed writeAccessAllowed;
|
||||
/**
|
||||
* Optional.
|
||||
* True, if the message media is covered by a spoiler animation
|
||||
*/
|
||||
@JsonProperty(HASMEDIASPOILER_FIELD)
|
||||
private Boolean hasMediaSpoiler;
|
||||
|
||||
public List<MessageEntity> getEntities() {
|
||||
if (entities != null) {
|
||||
|
@ -0,0 +1,22 @@
|
||||
package org.telegram.telegrambots.meta.api.objects;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||
|
||||
/**
|
||||
* This object represents a service message about a user allowing a bot added to the attachment menu to write messages.
|
||||
* Currently holds no information.
|
||||
* @author Ruben Bermudez
|
||||
* @version 6.4
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@AllArgsConstructor
|
||||
public class WriteAccessAllowed implements BotApiObject {
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
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 an edited forum topic.
|
||||
* @author Ruben Bermudez
|
||||
* @version 6.4
|
||||
*/
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ForumTopicEdited implements BotApiObject {
|
||||
private static final String NAME_FIELD = "name";
|
||||
private static final String ICONCUSTOMEMOJIID_FIELD = "icon_custom_emoji_id";
|
||||
|
||||
|
||||
/**
|
||||
* Optional.
|
||||
* New name of the topic, if it was edited
|
||||
*/
|
||||
@JsonProperty(NAME_FIELD)
|
||||
private String name;
|
||||
/**
|
||||
* Optional.
|
||||
* New identifier of the custom emoji shown as the topic icon, if it was edited;
|
||||
* an empty string if the icon was removed
|
||||
*/
|
||||
@JsonProperty(ICONCUSTOMEMOJIID_FIELD)
|
||||
private String iconCustomEmojiId;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.forum;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||
|
||||
/**
|
||||
* This object represents a service message about General forum topic hidden in the chat.
|
||||
* Currently holds no information.
|
||||
* @author Ruben Bermudez
|
||||
* @version 6.4
|
||||
*/
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@AllArgsConstructor
|
||||
public class GeneralForumTopicHidden implements BotApiObject {
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.forum;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||
|
||||
/**
|
||||
* This object represents a service message about General forum topic hidden in the chat.
|
||||
* Currently holds no information.
|
||||
* @author Ruben Bermudez
|
||||
* @version 6.4
|
||||
*/
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@AllArgsConstructor
|
||||
public class GeneralForumTopicUnhidden implements BotApiObject {
|
||||
}
|
@ -35,6 +35,7 @@ public class InputMediaAnimation extends InputMedia {
|
||||
public static final String HEIGHT_FIELD = "height";
|
||||
public static final String DURATION_FIELD = "duration";
|
||||
public static final String THUMB_FIELD = "thumb";
|
||||
public static final String HASSPOILER_FIELD = "has_spoiler";
|
||||
|
||||
@JsonProperty(WIDTH_FIELD)
|
||||
private Integer width; ///< Optional. Animation width
|
||||
@ -50,6 +51,12 @@ public class InputMediaAnimation extends InputMedia {
|
||||
* if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
|
||||
*/
|
||||
private InputFile thumb;
|
||||
/**
|
||||
* Optional.
|
||||
* Pass True if the animation must be covered with a spoiler animation
|
||||
*/
|
||||
@JsonProperty(HASSPOILER_FIELD)
|
||||
private Boolean hasSpoiler;
|
||||
|
||||
public InputMediaAnimation() {
|
||||
super();
|
||||
@ -60,12 +67,15 @@ public class InputMediaAnimation extends InputMedia {
|
||||
}
|
||||
|
||||
@Builder
|
||||
public InputMediaAnimation(@NonNull String media, String caption, String parseMode, List<MessageEntity> entities, boolean isNewMedia, String mediaName, File newMediaFile, InputStream newMediaStream, Integer width, Integer height, Integer duration, InputFile thumb) {
|
||||
public InputMediaAnimation(@NonNull String media, String caption, String parseMode, List<MessageEntity> entities,
|
||||
boolean isNewMedia, String mediaName, File newMediaFile, InputStream newMediaStream,
|
||||
Integer width, Integer height, Integer duration, InputFile thumb, Boolean hasSpoiler) {
|
||||
super(media, caption, parseMode, entities, isNewMedia, mediaName, newMediaFile, newMediaStream);
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.duration = duration;
|
||||
this.thumb = thumb;
|
||||
this.hasSpoiler = hasSpoiler;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.media;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@ -29,6 +30,15 @@ import java.util.List;
|
||||
public class InputMediaPhoto extends InputMedia {
|
||||
private static final String TYPE = "photo";
|
||||
|
||||
public static final String HASSPOILER_FIELD = "has_spoiler";
|
||||
|
||||
/**
|
||||
* Optional.
|
||||
* Pass True if the photo must be covered with a spoiler animation
|
||||
*/
|
||||
@JsonProperty(HASSPOILER_FIELD)
|
||||
private Boolean hasSpoiler;
|
||||
|
||||
public InputMediaPhoto() {
|
||||
super();
|
||||
}
|
||||
@ -38,8 +48,11 @@ public class InputMediaPhoto extends InputMedia {
|
||||
}
|
||||
|
||||
@Builder
|
||||
public InputMediaPhoto(@NonNull String media, String caption, String parseMode, List<MessageEntity> entities, boolean isNewMedia, String mediaName, File newMediaFile, InputStream newMediaStream) {
|
||||
public InputMediaPhoto(@NonNull String media, String caption, String parseMode, List<MessageEntity> entities,
|
||||
boolean isNewMedia, String mediaName, File newMediaFile, InputStream newMediaStream,
|
||||
Boolean hasSpoiler) {
|
||||
super(media, caption, parseMode, entities, isNewMedia, mediaName, newMediaFile, newMediaStream);
|
||||
this.hasSpoiler = hasSpoiler;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,6 +36,7 @@ public class InputMediaVideo extends InputMedia {
|
||||
public static final String DURATION_FIELD = "duration";
|
||||
public static final String SUPPORTSSTREAMING_FIELD = "supports_streaming";
|
||||
public static final String THUMB_FIELD = "thumb";
|
||||
public static final String HASSPOILER_FIELD = "has_spoiler";
|
||||
|
||||
@JsonProperty(WIDTH_FIELD)
|
||||
private Integer width; ///< Optional. Video width
|
||||
@ -54,6 +55,12 @@ public class InputMediaVideo extends InputMedia {
|
||||
*/
|
||||
@JsonProperty(THUMB_FIELD)
|
||||
private InputFile thumb;
|
||||
/**
|
||||
* Optional.
|
||||
* Pass True if the video must be covered with a spoiler animation
|
||||
*/
|
||||
@JsonProperty(HASSPOILER_FIELD)
|
||||
private Boolean hasSpoiler;
|
||||
|
||||
public InputMediaVideo() {
|
||||
}
|
||||
@ -63,13 +70,17 @@ public class InputMediaVideo extends InputMedia {
|
||||
}
|
||||
|
||||
@Builder
|
||||
public InputMediaVideo(@NonNull String media, String caption, String parseMode, List<MessageEntity> entities, boolean isNewMedia, String mediaName, File newMediaFile, InputStream newMediaStream, Integer width, Integer height, Integer duration, Boolean supportsStreaming, InputFile thumb) {
|
||||
public InputMediaVideo(@NonNull String media, String caption, String parseMode, List<MessageEntity> entities,
|
||||
boolean isNewMedia, String mediaName, File newMediaFile, InputStream newMediaStream,
|
||||
Integer width, Integer height, Integer duration, Boolean supportsStreaming, InputFile thumb,
|
||||
Boolean hasSpoiler) {
|
||||
super(media, caption, parseMode, entities, isNewMedia, mediaName, newMediaFile, newMediaStream);
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.duration = duration;
|
||||
this.supportsStreaming = supportsStreaming;
|
||||
this.thumb = thumb;
|
||||
this.hasSpoiler = hasSpoiler;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,6 +9,7 @@ import org.telegram.telegrambots.meta.api.objects.media.InputMedia;
|
||||
import org.telegram.telegrambots.meta.api.objects.media.InputMediaAnimation;
|
||||
import org.telegram.telegrambots.meta.api.objects.media.InputMediaAudio;
|
||||
import org.telegram.telegrambots.meta.api.objects.media.InputMediaDocument;
|
||||
import org.telegram.telegrambots.meta.api.objects.media.InputMediaPhoto;
|
||||
import org.telegram.telegrambots.meta.api.objects.media.InputMediaVideo;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -67,11 +68,19 @@ public class InputMediaSerializer extends JsonSerializer<InputMedia> {
|
||||
if (animation.getWidth() != null) {
|
||||
gen.writeNumberField(InputMediaAnimation.WIDTH_FIELD, animation.getWidth());
|
||||
}
|
||||
if (animation.getHasSpoiler() != null) {
|
||||
gen.writeBooleanField(InputMediaAnimation.HASSPOILER_FIELD, animation.getHasSpoiler());
|
||||
}
|
||||
} else if (value instanceof InputMediaDocument) {
|
||||
InputMediaDocument document = (InputMediaDocument) value;
|
||||
if (document.getThumb() != null) {
|
||||
gen.writeStringField(InputMediaDocument.THUMB_FIELD, document.getThumb().getAttachName());
|
||||
}
|
||||
} else if (value instanceof InputMediaPhoto) {
|
||||
InputMediaPhoto photo = (InputMediaPhoto) value;
|
||||
if (photo.getHasSpoiler() != null) {
|
||||
gen.writeBooleanField(InputMediaPhoto.HASSPOILER_FIELD, photo.getHasSpoiler());
|
||||
}
|
||||
} else if (value instanceof InputMediaVideo) {
|
||||
InputMediaVideo video = (InputMediaVideo) value;
|
||||
if (video.getThumb() != null) {
|
||||
@ -89,6 +98,9 @@ public class InputMediaSerializer extends JsonSerializer<InputMedia> {
|
||||
if (video.getSupportsStreaming() != null) {
|
||||
gen.writeBooleanField(InputMediaVideo.SUPPORTSSTREAMING_FIELD, video.getSupportsStreaming());
|
||||
}
|
||||
if (video.getHasSpoiler() != null) {
|
||||
gen.writeBooleanField(InputMediaVideo.HASSPOILER_FIELD, video.getHasSpoiler());
|
||||
}
|
||||
}
|
||||
|
||||
gen.writeEndObject();
|
||||
|
@ -38,6 +38,7 @@ public class ReplyKeyboardMarkup implements ReplyKeyboard {
|
||||
private static final String ONETIMEKEYBOARD_FIELD = "one_time_keyboard";
|
||||
private static final String SELECTIVE_FIELD = "selective";
|
||||
private static final String INPUTFIELDPLACEHOLDER_FIELD = "input_field_placeholder";
|
||||
private static final String ISPERSISTENT_FIELD = "is_persistent";
|
||||
|
||||
@JsonProperty(KEYBOARD_FIELD)
|
||||
@NonNull
|
||||
@ -62,7 +63,13 @@ public class ReplyKeyboardMarkup implements ReplyKeyboard {
|
||||
*/
|
||||
@JsonProperty(INPUTFIELDPLACEHOLDER_FIELD)
|
||||
private String inputFieldPlaceholder;
|
||||
|
||||
/**
|
||||
* Optional.
|
||||
* Requests clients to always show the keyboard when the regular keyboard is hidden.
|
||||
* Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon.
|
||||
*/
|
||||
@JsonProperty(ISPERSISTENT_FIELD)
|
||||
private Boolean isPersistent;
|
||||
@Override
|
||||
public void validate() throws TelegramApiValidationException {
|
||||
if (keyboard == null) {
|
||||
|
@ -249,6 +249,9 @@ public abstract class DefaultAbsSender extends AbsSender {
|
||||
if (sendPhoto.getCaptionEntities() != null) {
|
||||
builder.addTextBody(SendPhoto.CAPTION_ENTITIES_FIELD, objectMapper.writeValueAsString(sendPhoto.getCaptionEntities()), TEXT_PLAIN_CONTENT_TYPE);
|
||||
}
|
||||
if (sendPhoto.getHasSpoiler() != null) {
|
||||
builder.addTextBody(SendPhoto.HASSPOILER_FIELD, objectMapper.writeValueAsString(sendPhoto.getHasSpoiler()), TEXT_PLAIN_CONTENT_TYPE);
|
||||
}
|
||||
HttpEntity multipart = builder.build();
|
||||
httppost.setEntity(multipart);
|
||||
|
||||
@ -316,6 +319,9 @@ public abstract class DefaultAbsSender extends AbsSender {
|
||||
if (sendVideo.getCaptionEntities() != null) {
|
||||
builder.addTextBody(SendVideo.CAPTION_ENTITIES_FIELD, objectMapper.writeValueAsString(sendVideo.getCaptionEntities()), TEXT_PLAIN_CONTENT_TYPE);
|
||||
}
|
||||
if (sendVideo.getHasSpoiler() != null) {
|
||||
builder.addTextBody(SendVideo.HASSPOILER_FIELD, objectMapper.writeValueAsString(sendVideo.getHasSpoiler()), TEXT_PLAIN_CONTENT_TYPE);
|
||||
}
|
||||
|
||||
HttpEntity multipart = builder.build();
|
||||
httppost.setEntity(multipart);
|
||||
@ -821,6 +827,9 @@ public abstract class DefaultAbsSender extends AbsSender {
|
||||
if (sendAnimation.getCaptionEntities() != null) {
|
||||
builder.addTextBody(SendAnimation.CAPTION_ENTITIES_FIELD, objectMapper.writeValueAsString(sendAnimation.getCaptionEntities()), TEXT_PLAIN_CONTENT_TYPE);
|
||||
}
|
||||
if (sendAnimation.getHasSpoiler() != null) {
|
||||
builder.addTextBody(SendAnimation.HASSPOILER_FIELD, objectMapper.writeValueAsString(sendAnimation.getHasSpoiler()), TEXT_PLAIN_CONTENT_TYPE);
|
||||
}
|
||||
HttpEntity multipart = builder.build();
|
||||
httppost.setEntity(multipart);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user