-
-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #354 from anfanik/master
Implement Bot API 7.0 Reactions
- Loading branch information
Showing
21 changed files
with
397 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
library/src/main/java/com/pengrad/telegrambot/model/MessageReactionCountUpdated.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.pengrad.telegrambot.model; | ||
|
||
import com.pengrad.telegrambot.model.reaction.ReactionCount; | ||
|
||
import java.util.Arrays; | ||
import java.util.Objects; | ||
|
||
public class MessageReactionCountUpdated { | ||
|
||
private Chat chat; | ||
private Integer message_id; | ||
private Integer date; | ||
private ReactionCount[] reactions; | ||
|
||
public Chat chat() { | ||
return chat; | ||
} | ||
|
||
public Integer messageId() { | ||
return message_id; | ||
} | ||
|
||
public Integer date() { | ||
return date; | ||
} | ||
|
||
public ReactionCount[] reactions() { | ||
return reactions; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
MessageReactionCountUpdated that = (MessageReactionCountUpdated) o; | ||
return Objects.equals(chat, that.chat) && | ||
Objects.equals(message_id, that.message_id) && | ||
Objects.equals(date, that.date) && | ||
Arrays.equals(reactions, that.reactions); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = Objects.hash(chat, message_id, date); | ||
result = 31 * result + Arrays.hashCode(reactions); | ||
return result; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "MessageReactionCountUpdated{" + | ||
"chat=" + chat + | ||
", message_id=" + message_id + | ||
", date=" + date + | ||
", reactions=" + Arrays.toString(reactions) + | ||
'}'; | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
library/src/main/java/com/pengrad/telegrambot/model/MessageReactionUpdated.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package com.pengrad.telegrambot.model; | ||
|
||
import com.pengrad.telegrambot.model.reaction.ReactionType; | ||
|
||
import java.util.Arrays; | ||
import java.util.Objects; | ||
|
||
public class MessageReactionUpdated { | ||
|
||
private Chat chat; | ||
private Integer message_id; | ||
private User user; | ||
private Chat actor_chat; | ||
private Integer date; | ||
private ReactionType[] old_reaction; | ||
private ReactionType[] new_reaction; | ||
|
||
public Chat chat() { | ||
return chat; | ||
} | ||
|
||
public Integer messageId() { | ||
return message_id; | ||
} | ||
|
||
public User user() { | ||
return user; | ||
} | ||
|
||
public Chat actorChat() { | ||
return actor_chat; | ||
} | ||
|
||
public Integer date() { | ||
return date; | ||
} | ||
|
||
public ReactionType[] oldReaction() { | ||
return old_reaction; | ||
} | ||
|
||
public ReactionType[] newReaction() { | ||
return new_reaction; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
MessageReactionUpdated that = (MessageReactionUpdated) o; | ||
return Objects.equals(chat, that.chat) && | ||
Objects.equals(message_id, that.message_id) && | ||
Objects.equals(user, that.user) && | ||
Objects.equals(actor_chat, that.actor_chat) && | ||
Objects.equals(date, that.date) && | ||
Arrays.equals(old_reaction, that.old_reaction) && | ||
Arrays.equals(new_reaction, that.new_reaction); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = Objects.hash(chat, message_id, user, actor_chat, date); | ||
result = 31 * result + Arrays.hashCode(old_reaction); | ||
result = 31 * result + Arrays.hashCode(new_reaction); | ||
return result; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "MessageReactionUpdated{" + | ||
"chat=" + chat + | ||
", message_id=" + message_id + | ||
", user=" + user + | ||
", actor_chat=" + actor_chat + | ||
", date=" + date + | ||
", old_reaction=" + Arrays.toString(old_reaction) + | ||
", new_reaction=" + Arrays.toString(new_reaction) + | ||
'}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
library/src/main/java/com/pengrad/telegrambot/model/reaction/ReactionCount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.pengrad.telegrambot.model.reaction; | ||
|
||
import java.util.Objects; | ||
|
||
public class ReactionCount { | ||
|
||
private ReactionType type; | ||
private Integer total_count; | ||
|
||
public ReactionType type() { | ||
return type; | ||
} | ||
|
||
public Integer totalCount() { | ||
return total_count; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
ReactionCount that = (ReactionCount) o; | ||
return Objects.equals(type, that.type) && | ||
Objects.equals(total_count, that.total_count); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(type, total_count); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ReactionCount{" + | ||
"type=" + type + | ||
", total_count=" + total_count + | ||
'}'; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
library/src/main/java/com/pengrad/telegrambot/model/reaction/ReactionType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.pengrad.telegrambot.model.reaction; | ||
|
||
import java.util.Objects; | ||
|
||
public abstract class ReactionType { | ||
|
||
private final String type; | ||
|
||
public ReactionType(String type) { | ||
this.type = type; | ||
} | ||
|
||
public String type() { | ||
return type; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
ReactionType that = (ReactionType) o; | ||
return Objects.equals(type, that.type); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(type); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ReactionType{" + | ||
"type='" + type + '\'' + | ||
'}'; | ||
} | ||
} |
Oops, something went wrong.