Merge pull request #1143 from AminevRamil/dev

Reworked some of the old comments in javadoc style
This commit is contained in:
Ruben Bermudez 2022-11-07 18:15:40 +00:00 committed by GitHub
commit 4db7532b61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 1330 additions and 367 deletions

View File

@ -45,9 +45,12 @@ public class SendDice extends BotApiMethodMessage {
private static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply";
private static final String PROTECTCONTENT_FIELD = "protect_content";
/**
* Unique identifier for the target chat or username of the target channel (in the format @channelusername)
*/
@JsonProperty(CHATID_FIELD)
@NonNull
private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername)
private String chatId;
/**
* Optional.
*

View File

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

View File

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

View File

@ -13,9 +13,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/**
* This object represents a Telegram chat with an user or a group
* @author Ruben Bermudez
* @version 6.1
* This object represents a Telegram chat with an user or a group
*/
@SuppressWarnings("WeakerAccess")
@EqualsAndHashCode(callSuper = false)
@ -64,32 +64,79 @@ public class Chat implements BotApiObject {
*/
@JsonProperty(ID_FIELD)
@NonNull
private Long id; ///< Unique identifier for this chat, not exceeding 1e13 by absolute value
private Long id;
/**
* Type of the chat, one of private, group or channel or "supergroup"
*/
@JsonProperty(TYPE_FIELD)
@NonNull
private String type; ///< Type of the chat, one of private, group or channel or "supergroup"
private String type;
/**
* Optional.
* Title of the chat, only for channels and group chat
*/
@JsonProperty(TITLE_FIELD)
private String title; ///< Optional. Title of the chat, only for channels and group chat
private String title;
/**
* Optional
* Username of the chat, only for private chats and channels if available
*/
@JsonProperty(FIRSTNAME_FIELD)
private String firstName; ///< Optional. Username of the chat, only for private chats and channels if available
private String firstName;
/**
* Optional.
* Interlocutor's first name for private chats
*/
@JsonProperty(LASTNAME_FIELD)
private String lastName; ///< Optional. Interlocutor's first name for private chats
private String lastName;
/**
* Optional.
* Interlocutor's last name for private chats
*/
@JsonProperty(USERNAME_FIELD)
private String userName; ///< Optional. Interlocutor's last name for private chats
private String userName;
/**
* Optional.
* Chat photo. Returned only in getChat.
*/
@JsonProperty(PHOTO_FIELD)
private ChatPhoto photo; ///< Optional. Chat photo. Returned only in getChat.
private ChatPhoto photo;
/**
* Optional.
* Description, for groups, supergroups and channel chats. Returned only in getChat.
*/
@JsonProperty(DESCRIPTION_FIELD)
private String description; ///< Optional. Description, for groups, supergroups and channel chats. Returned only in getChat.
private String description;
/**
* Optional.
* Primary invite link, for groups, supergroups and channel chats. Returned only in getChat.
*/
@JsonProperty(INVITELINK_FIELD)
private String inviteLink; ///< Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat.
private String inviteLink;
/**
* Optional.
* The most recent pinned message (by sending date). Returned only in getChat.
*/
@JsonProperty(PINNEDMESSAGE_FIELD)
private Message pinnedMessage; ///< Optional. The most recent pinned message (by sending date). Returned only in getChat.
private Message pinnedMessage;
/**
* Optional.
* For supergroups, name of Group sticker set. Returned only in getChat.
*/
@JsonProperty(STICKERSETNAME_FIELD)
private String stickerSetName; ///< Optional. For supergroups, name of Group sticker set. Returned only in getChat.
private String stickerSetName;
/**
* Optional.
* True, if the bot can change group the sticker set. Returned only in getChat.
*/
@JsonProperty(CANSETSTICKERSET_FIELD)
private Boolean canSetStickerSet; ///< Optional. True, if the bot can change group the sticker set. Returned only in getChat.
private Boolean canSetStickerSet;
/**
* Optional.
* Default chat member permissions, for groups and supergroups. Returned only in getChat.
*/
@JsonProperty(PERMISSIONS_FIELD)
private ChatPermissions permissions; ///< Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
private ChatPermissions permissions;
/**
* Optional.
* For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user.
@ -97,8 +144,12 @@ public class Chat implements BotApiObject {
*/
@JsonProperty(SLOWMODEDELAY_FIELD)
private Integer slowModeDelay;
/**
* Optional.
* Bio of the other party in a private chat. Returned only in getChat.
*/
@JsonProperty(BIO_FIELD)
private String bio; ///< Optional. Bio of the other party in a private chat. Returned only in getChat.
private String bio;
/**
* Optional.
* Unique identifier for the linked chat,
@ -111,10 +162,16 @@ public class Chat implements BotApiObject {
*/
@JsonProperty(LINKEDCHATID_FIELD)
private Long linkedChatId;
/**
* Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.
*/
@JsonProperty(LOCATION_FIELD)
private ChatLocation location; ///< Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.
private ChatLocation location;
/**
* Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat.
*/
@JsonProperty(MESSAGEAUTODELETETIME_FIELD)
private Integer messageAutoDeleteTime; ///< Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat.
private Integer messageAutoDeleteTime;
/**
* Optional.
* True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,9 +10,9 @@ import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/**
* This object represents one size of a photo or a file / sticker thumbnail.
* @author Ruben Bermudez
* @version 1.0
* This object represents one size of a photo or a file / sticker thumbnail.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@ -29,20 +29,36 @@ public class PhotoSize implements BotApiObject {
private static final String FILESIZE_FIELD = "file_size";
private static final String FILEPATH_FIELD = "file_path";
/**
* Identifier for this file, which can be used to download or reuse the file
*/
@JsonProperty(FILEID_FIELD)
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file
private String fileId;
/**
* Unique identifier for this file, which is supposed to be the same over time and for different bots.
* Can't be used to download or reuse the file.
*/
@JsonProperty(FILEUNIQUEID_FIELD)
private String fileUniqueId;
/**
* Photo width
*/
@JsonProperty(WIDTH_FIELD)
private Integer width; ///< Photo width
private Integer width;
/**
* Photo height
*/
@JsonProperty(HEIGHT_FIELD)
private Integer height; ///< Photo height
private Integer height;
/**
* Optional.
* File size
*/
@JsonProperty(FILESIZE_FIELD)
private Integer fileSize; ///< Optional. File size
private Integer fileSize;
/**
* Undocumented field. Optional. Can contain the path to download the file directly without calling to getFile
*/
@JsonProperty(FILEPATH_FIELD)
private String filePath; ///< Undocumented field. Optional. Can contain the path to download the file directly without calling to getFile
private String filePath;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -32,9 +32,9 @@ import org.telegram.telegrambots.meta.api.objects.PhotoSize;
import java.util.List;
/**
* This object represents a game.
* @author Ruben Bermudez
* @version 2.4
* This object represents a game.
* @apiNote Use BotFather to create and edit games, their short names will act as unique identifiers.
*/
@EqualsAndHashCode(callSuper = false)
@ -53,15 +53,24 @@ public class Game implements BotApiObject {
private static final String TEXT_FIELD = "text";
private static final String TEXTENTITIES_FIELD = "text_entities";
/**
* Title of the game
*/
@JsonProperty(TITLE_FIELD)
@NonNull
private String title; ///< Title of the game
private String title;
/**
* Description of the game
*/
@JsonProperty(DESCRIPTION_FIELD)
@NonNull
private String description; ///< Description of the game
private String description;
/**
* Photo
*/
@JsonProperty(PHOTO_FIELD)
@NonNull
private List<PhotoSize> photo; ///< Photo
private List<PhotoSize> photo;
/**
* Optional. Brief description of the game or high scores included in the game message.
* Can be automatically edited to include current high scores for the game
@ -76,8 +85,12 @@ public class Game implements BotApiObject {
*/
@JsonProperty(TEXTENTITIES_FIELD)
private List<MessageEntity> entities;
/**
* Optional.
* Animation
*/
@JsonProperty(ANIMATION_FIELD)
private Animation animation; ///< Optional. Animation
private Animation animation;
public boolean hasEntities() {
return entities != null && !entities.isEmpty();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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