Skip to content

Conversation

@java-coding-prodigy
Copy link
Contributor

Completes #781

@java-coding-prodigy java-coding-prodigy requested review from a team as code owners March 7, 2023 10:37
@java-coding-prodigy java-coding-prodigy self-assigned this Mar 7, 2023
@Zabuzard Zabuzard marked this pull request as draft March 7, 2023 10:41
Comment on lines 7 to 45
@JsonRootName("starboard")
public final class StarboardConfig {
private final String oofEmojiName;
private final String lmaoEmojiName;
private final long starboardChannelId;

@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
public StarboardConfig(
@JsonProperty(value = "oofEmojiName", required = true) String oofEmojiName,
@JsonProperty(value = "lmaoEmojiName", required = true) String lmaoEmojiName,
@JsonProperty(value = "starboardChannelId", required = true) long starboardChannelId) {
this.oofEmojiName = oofEmojiName;
this.lmaoEmojiName = lmaoEmojiName;
this.starboardChannelId = starboardChannelId;
}

public String getOofEmojiName() {
return oofEmojiName;
}

public String getLmaoEmojiName() {
return lmaoEmojiName;
}

public long getStarboardChannelId() {
return starboardChannelId;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

missing javadoc


Guild guild = event.getGuild();
GuildChannel channel = event.getGuildChannel();
if (!config.getEmojiNames().contains(emojiName) || !guild.getPublicRole().hasPermission(channel, Permission.VIEW_CHANNEL)) {
Copy link
Member

Choose a reason for hiding this comment

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

i feel like this either needs a comment or should be moved into a well named method, so that its clear why we do this check

Comment on lines 312 to 316
/**
* Gets the config for the Starboard
*
* @return the config of the Starboard
* */
Copy link
Member

Choose a reason for hiding this comment

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

shitty javadoc. improve. explain the feature. how would u explain ur grandma what the starboard feature does? or someone new to the project.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's exactly what we have used for getHelpSystemConfig so I thought I should do something similar, nevertheless, I will change it.

Copy link
Member

Choose a reason for hiding this comment

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

then that javadoc is bad as well (im aware that i wrote it 😆)

@java-coding-prodigy
Copy link
Contributor Author

Sonar lint fails because StarboardConfig can be a record.
Should i suppress the warning? Or maybe actually convert it to a record?

@Zabuzard
Copy link
Member

That is because you are not yet checking whether the constructor args are non-null. See the other configs and follow the pattern.

@github-actions
Copy link

This pull request is stale because it has been open 30 days with no activity. Remove stale label, comment or add the valid label or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Apr 23, 2023
@java-coding-prodigy
Copy link
Contributor Author

I have been out of town since a few weeks that's why I couldn't contribute, I will resume working on this in a few days.
I am on mobile so I cannot remove the stale label .

@Zabuzard Zabuzard removed the stale label Apr 23, 2023
@java-coding-prodigy java-coding-prodigy marked this pull request as ready for review May 1, 2023 10:13
Comment on lines 41 to 42
Optional<TextChannel> starboardChannel =
guild.getTextChannelsByName(config.getChannelName(), false).stream().findFirst();
Copy link
Member

Choose a reason for hiding this comment

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

I know this is a minor thing, but personally I feel like it's much nicer to make helper methods for something like this.

Especially when classes get bigger, reading getStarBoardChannel I find much nicer.

So you don't have to change it, but maybe think about it next time, what you prefer.

Comment on lines 48 to 49
event.getChannel()
.retrieveMessageById(event.getMessageId())
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
event.getChannel()
.retrieveMessageById(event.getMessageId())
event.retrieveMessage()

*
* @return the name of the channel with the starboard
*/

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change


@Override
public void onMessageReactionAdd(@NotNull MessageReactionAddEvent event) {
String emojiName = event.getReaction().getEmoji().asCustom().getName();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
String emojiName = event.getReaction().getEmoji().asCustom().getName();
String emojiName = event.getEmoji().asCustom().getName();

Comment on lines 36 to 37
GuildChannel channel = event.getGuildChannel();
if (!config.getEmojiNames().contains(emojiName)
Copy link
Member

Choose a reason for hiding this comment

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

everything feels to cramped, think I mentioned this before.

Being able to distinguish sections is much harder if it's a long lap of text.

User author = message.getAuthor();
return new EmbedBuilder().setAuthor(author.getName(), null, author.getAvatarUrl())
.setDescription(message.getContentDisplay())
.build(); // Maybe set footer as reacted emoji?
Copy link
Member

Choose a reason for hiding this comment

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

I'd set the footer as the reacted emoji, and maybe just add timestamp? Always nice

And are you linking the original message? Doesn't seem to be the case, I'd certainly do that.
Either add the link to the footer (like the original starboard), or add a button or something.

.queue();
}

private boolean ignoreMessage(String emojiName, Guild guild, GuildChannel channel) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
private boolean ignoreMessage(String emojiName, Guild guild, GuildChannel channel) {
private boolean shouldIgnoreMessage(String emojiName, Guild guild, GuildChannel channel) {

@github-actions
Copy link

This pull request is stale because it has been open 30 days with no activity. Remove stale label, comment or add the valid label or this will be closed in 5 days.

@github-actions github-actions bot added stale inactivity-closed Issues that have been closed due to inactivity, but are otherwise valid and might be reopened later labels Jun 19, 2023
@github-actions github-actions bot closed this Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request inactivity-closed Issues that have been closed due to inactivity, but are otherwise valid and might be reopened later priority: low stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants