Skip to content

Commit ae31162

Browse files
committed
Remove deprecated methods
1 parent f01518b commit ae31162

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+98
-1006
lines changed

library/src/main/java/com/pengrad/telegrambot/model/Animation.java

+3-21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.pengrad.telegrambot.model;
22

33
import java.io.Serializable;
4+
import java.util.Objects;
45

56
/**
67
* Stas Parshin
@@ -14,7 +15,7 @@ public class Animation implements Serializable {
1415
private Integer width;
1516
private Integer height;
1617
private Integer duration;
17-
private PhotoSize thumbnail;
18+
private PhotoSize thumbnail;
1819
private String file_name;
1920
private String mime_type;
2021
private Long file_size;
@@ -43,14 +44,6 @@ public PhotoSize thumbnail() {
4344
return thumbnail;
4445
}
4546

46-
/**
47-
* @deprecated Use thumbnail instead
48-
*/
49-
@Deprecated
50-
public PhotoSize thumb() {
51-
return thumbnail();
52-
}
53-
5447
public String fileName() {
5548
return file_name;
5649
}
@@ -67,19 +60,8 @@ public Long fileSize() {
6760
public boolean equals(Object o) {
6861
if (this == o) return true;
6962
if (o == null || getClass() != o.getClass()) return false;
70-
7163
Animation animation = (Animation) o;
72-
73-
if (file_id != null ? !file_id.equals(animation.file_id) : animation.file_id != null) return false;
74-
if (file_unique_id != null ? !file_unique_id.equals(animation.file_unique_id) : animation.file_unique_id != null)
75-
return false;
76-
if (width != null ? !width.equals(animation.width) : animation.width != null) return false;
77-
if (height != null ? !height.equals(animation.height) : animation.height != null) return false;
78-
if (duration != null ? !duration.equals(animation.duration) : animation.duration != null) return false;
79-
if (thumbnail != null ? !thumbnail.equals(animation.thumbnail) : animation.thumbnail != null) return false;
80-
if (file_name != null ? !file_name.equals(animation.file_name) : animation.file_name != null) return false;
81-
if (mime_type != null ? !mime_type.equals(animation.mime_type) : animation.mime_type != null) return false;
82-
return file_size != null ? file_size.equals(animation.file_size) : animation.file_size == null;
64+
return Objects.equals(file_id, animation.file_id) && Objects.equals(file_unique_id, animation.file_unique_id) && Objects.equals(width, animation.width) && Objects.equals(height, animation.height) && Objects.equals(duration, animation.duration) && Objects.equals(thumbnail, animation.thumbnail) && Objects.equals(file_name, animation.file_name) && Objects.equals(mime_type, animation.mime_type) && Objects.equals(file_size, animation.file_size);
8365
}
8466

8567
@Override

library/src/main/java/com/pengrad/telegrambot/model/ChatFullInfo.java

-16
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,6 @@ public ChatPhoto photo() {
104104
return photo;
105105
}
106106

107-
/**
108-
* @deprecated Use activeUsernames() instead
109-
*/
110-
@Deprecated
111-
public String[] getActiveUsernames() {
112-
return active_usernames;
113-
}
114-
115107
public String[] activeUsernames() {
116108
return active_usernames;
117109
}
@@ -160,14 +152,6 @@ public String profileBackgroundCustomEmojiId() {
160152
return profile_background_custom_emoji_id;
161153
}
162154

163-
/**
164-
* @deprecated Use emojiStatusCustomEmojiId() instead
165-
*/
166-
@Deprecated
167-
public String getEmojiStatusCustomEmojiId() {
168-
return emoji_status_custom_emoji_id;
169-
}
170-
171155
public String emojiStatusCustomEmojiId() {
172156
return emoji_status_custom_emoji_id;
173157
}

library/src/main/java/com/pengrad/telegrambot/model/ChatMember.java

-8
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,6 @@ public Boolean canDeleteMessages() {
8989
return can_delete_messages != null && can_delete_messages;
9090
}
9191

92-
/**
93-
* @deprecated Use canManageVideoChats() instead
94-
*/
95-
@Deprecated
96-
public Boolean canManageVoiceChats() {
97-
return canManageVideoChats();
98-
}
99-
10092
public Boolean canManageVideoChats() {
10193
return can_manage_video_chats != null && can_manage_video_chats;
10294
}

library/src/main/java/com/pengrad/telegrambot/model/DeleteMyCommands.java

-36
This file was deleted.

library/src/main/java/com/pengrad/telegrambot/model/Document.java

-8
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@ public PhotoSize thumbnail() {
2929
return thumbnail;
3030
}
3131

32-
/**
33-
* @deprecated Use thumbnail instead
34-
*/
35-
@Deprecated
36-
public PhotoSize thumb() {
37-
return thumbnail();
38-
}
39-
4032
public String fileName() {
4133
return file_name;
4234
}

library/src/main/java/com/pengrad/telegrambot/model/Message.java

-88
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.pengrad.telegrambot.model;
22

3-
import com.pengrad.telegrambot.model.business.BusinessConnection;
43
import com.pengrad.telegrambot.model.chatbackground.ChatBackground;
54
import com.pengrad.telegrambot.model.chatboost.ChatBoostAdded;
65
import com.pengrad.telegrambot.model.giveaway.Giveaway;
@@ -9,7 +8,6 @@
98
import com.pengrad.telegrambot.model.giveaway.GiveawayWinners;
109
import com.pengrad.telegrambot.model.message.MaybeInaccessibleMessage;
1110
import com.pengrad.telegrambot.model.message.origin.*;
12-
import com.pengrad.telegrambot.model.paidmedia.PaidMedia;
1311
import com.pengrad.telegrambot.model.paidmedia.PaidMediaInfo;
1412
import com.pengrad.telegrambot.model.request.InlineKeyboardMarkup;
1513
import com.pengrad.telegrambot.passport.PassportData;
@@ -83,7 +81,6 @@ public class Message extends MaybeInaccessibleMessage implements Serializable {
8381
private SuccessfulPayment successful_payment;
8482
private RefundedPayment refunded_payment;
8583
private Story story;
86-
private UserShared user_shared; //@deprectated
8784
private UsersShared users_shared;
8885
private ChatShared chat_shared;
8986
private String connected_website;
@@ -137,81 +134,6 @@ public MessageOrigin forwardOrigin() {
137134
return forward_origin;
138135
}
139136

140-
/**
141-
* @deprecated Use Message#forwardOrigin instead
142-
*/
143-
@Deprecated
144-
public User forwardFrom() {
145-
if (forward_origin instanceof MessageOriginUser) {
146-
return ((MessageOriginUser) forward_origin).senderUser();
147-
}
148-
return null;
149-
}
150-
151-
/**
152-
* @deprecated Use Message#forwardOrigin instead
153-
*/
154-
@Deprecated
155-
public Chat forwardFromChat() {
156-
if (forward_origin instanceof MessageOriginChat) {
157-
return ((MessageOriginChat) forward_origin).senderChat();
158-
}
159-
160-
if (forward_origin instanceof MessageOriginChannel) {
161-
return ((MessageOriginChannel) forward_origin).chat();
162-
}
163-
164-
return null;
165-
}
166-
167-
/**
168-
* @deprecated Use Message#forwardOrigin instead
169-
*/
170-
@Deprecated
171-
public Integer forwardFromMessageId() {
172-
if (forward_origin instanceof MessageOriginChannel) {
173-
return ((MessageOriginChannel) forward_origin).messageId();
174-
}
175-
176-
return null;
177-
}
178-
179-
/**
180-
* @deprecated Use Message#forwardOrigin instead
181-
*/
182-
@Deprecated
183-
public String forwardSignature() {
184-
if (forward_origin instanceof MessageOriginChat) {
185-
return ((MessageOriginChat) forward_origin).authorSignature();
186-
}
187-
188-
if (forward_origin instanceof MessageOriginChannel) {
189-
return ((MessageOriginChannel) forward_origin).authorSignature();
190-
}
191-
192-
return null;
193-
}
194-
195-
/**
196-
* @deprecated Use Message#forwardOrigin instead
197-
*/
198-
@Deprecated
199-
public String forwardSenderName() {
200-
if (forward_origin instanceof MessageOriginHiddenUser) {
201-
return ((MessageOriginHiddenUser) forward_origin).senderUserName();
202-
}
203-
204-
return null;
205-
}
206-
207-
/**
208-
* @deprecated Use Message#forwardOrigin instead
209-
*/
210-
@Deprecated
211-
public Integer forwardDate() {
212-
return forward_origin.date();
213-
}
214-
215137
public Boolean isTopicMessage() {
216138
return is_topic_message != null && is_topic_message;
217139
}
@@ -417,14 +339,6 @@ public Story story() {
417339
return story;
418340
}
419341

420-
/**
421-
* @deprecated Use usersShared instead
422-
*/
423-
@Deprecated
424-
public UserShared userShared() {
425-
return user_shared;
426-
}
427-
428342
public UsersShared usersShared() {
429343
return users_shared;
430344
}
@@ -608,7 +522,6 @@ public boolean equals(Object o) {
608522
Objects.equals(successful_payment, message.successful_payment) &&
609523
Objects.equals(refunded_payment, message.refunded_payment) &&
610524
Objects.equals(story, message.story) &&
611-
Objects.equals(user_shared, message.user_shared) &&
612525
Objects.equals(users_shared, message.users_shared) &&
613526
Objects.equals(chat_shared, message.chat_shared) &&
614527
Objects.equals(connected_website, message.connected_website) &&
@@ -704,7 +617,6 @@ public String toString() {
704617
", successful_payment=" + successful_payment +
705618
", refunded_payment=" + refunded_payment +
706619
", story=" + story +
707-
", user_shared=" + user_shared +
708620
", users_shared=" + users_shared +
709621
", chat_shared=" + chat_shared +
710622
", connected_website='" + connected_website + '\'' +

library/src/main/java/com/pengrad/telegrambot/model/Sticker.java

-8
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,6 @@ public PhotoSize thumbnail() {
7070
return thumbnail;
7171
}
7272

73-
/**
74-
* @deprecated Use thumbnail instead
75-
*/
76-
@Deprecated
77-
public PhotoSize thumb() {
78-
return thumbnail();
79-
}
80-
8173
public String emoji() {
8274
return emoji;
8375
}

library/src/main/java/com/pengrad/telegrambot/model/StickerSet.java

+2-36
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public class StickerSet implements Serializable {
1616
private String name;
1717
private String title;
1818
private Type sticker_type;
19-
private Boolean contains_masks;
2019
private Sticker[] stickers;
2120
private PhotoSize thumbnail;
2221

@@ -33,22 +32,6 @@ public Type stickerType() {
3332
return sticker_type;
3433
}
3534

36-
/**
37-
* @deprecated StickerSets can contain both animated and non-animated stickers since Bot API 7.2
38-
*/
39-
@Deprecated
40-
public Boolean isAnimated() {
41-
return false;
42-
}
43-
44-
/**
45-
* @deprecated Use type() and check if it equals to Type.mask
46-
*/
47-
@Deprecated
48-
public Boolean containsMasks() {
49-
return contains_masks;
50-
}
51-
5235
public Sticker[] stickers() {
5336
return stickers;
5437
}
@@ -57,33 +40,17 @@ public PhotoSize thumbnail() {
5740
return thumbnail;
5841
}
5942

60-
/**
61-
* @deprecated Use thumbnail instead
62-
*/
63-
@Deprecated
64-
public PhotoSize thumb() {
65-
return thumbnail();
66-
}
67-
68-
/**
69-
* @deprecated StickerSets can contain both animated and non-animated stickers since Bot API 7.2
70-
*/
71-
@Deprecated
72-
public Boolean isVideo() {
73-
return false;
74-
}
75-
7643
@Override
7744
public boolean equals(Object o) {
7845
if (this == o) return true;
7946
if (o == null || getClass() != o.getClass()) return false;
8047
StickerSet that = (StickerSet) o;
81-
return Objects.equals(name, that.name) && Objects.equals(title, that.title) && sticker_type == that.sticker_type && Objects.equals(contains_masks, that.contains_masks) && Arrays.equals(stickers, that.stickers) && Objects.equals(thumbnail, that.thumbnail);
48+
return Objects.equals(name, that.name) && Objects.equals(title, that.title) && sticker_type == that.sticker_type && Arrays.equals(stickers, that.stickers) && Objects.equals(thumbnail, that.thumbnail);
8249
}
8350

8451
@Override
8552
public int hashCode() {
86-
int result = Objects.hash(name, title, sticker_type, contains_masks, thumbnail);
53+
int result = Objects.hash(name, title, sticker_type, thumbnail);
8754
result = 31 * result + Arrays.hashCode(stickers);
8855
return result;
8956
}
@@ -94,7 +61,6 @@ public String toString() {
9461
"name='" + name + '\'' +
9562
", title='" + title + '\'' +
9663
", sticker_type=" + sticker_type +
97-
", contains_masks=" + contains_masks +
9864
", stickers=" + Arrays.toString(stickers) +
9965
", thumbnail=" + thumbnail +
10066
'}';

0 commit comments

Comments
 (0)