Skip to content

Add the ability to add a ⭐ to a message in the #starboard channel as well as the original message #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from

Conversation

venkat1701
Copy link

@venkat1701 venkat1701 commented Jan 15, 2022

Issue : Ability to add a ⭐from Starboard and Original Message
Its notable that we cannot ⭐ a message directly from the starboard.

I have added the feature to vote on the message both from the starboard and the original message. With this, I have implemented it in a way that it counts a User only once even if the User votes on both the messages.

It closes the issue : Ability to add a ⭐from Starboard and Original Message

}

@Override
public void onMessageDelete(@NotNull MessageDeleteEvent event) {
removeMessageFromStarboard(event.getGuild(), event.getMessageId());
}

private void updateSbReactionCounts(GenericMessageReactionEvent event, StarBoardConfig config, String messageId, String remoteTextChannelId) {
Objects.requireNonNull(event.getGuild().getTextChannelById(remoteTextChannelId)).retrieveMessageById(messageId).queue(message -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace Objects.requireNonNull with a null check Objects.requireNonNull throws exceptions


private int getUniqueStarCounts(Message starboardMessage, Message originalMessage, StarBoardConfig config){
try {
List<User> list = originalMessage.retrieveReactionUsers(config.getEmotes().get(0)).takeAsync(this.getReactionCountForEmote(config.getEmotes().get(0), originalMessage)).get();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

give these variables a valid name instead so list

private int getUniqueStarCounts(Message starboardMessage, Message originalMessage, StarBoardConfig config){
try {
List<User> list = originalMessage.retrieveReactionUsers(config.getEmotes().get(0)).takeAsync(this.getReactionCountForEmote(config.getEmotes().get(0), originalMessage)).get();
List<User> list2 = starboardMessage.retrieveReactionUsers(config.getEmotes().get(0)).takeAsync(this.getReactionCountForEmote(config.getEmotes().get(0), starboardMessage)).get();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@jasonlessenich
Copy link
Member

I'm sorry to say that, but I have to close this PR, as we're going to refactor the whole starboard to use the H2 Database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants