Skip to content

Commit 0c8db0c

Browse files
committed
Applied spotless + added documentation to the class and constructor
Also fixed an empty @return in the Javadoc
1 parent 8e4a6c1 commit 0c8db0c

File tree

1 file changed

+18
-7
lines changed
  • application/src/main/java/org/togetherjava/tjbot/commands/moderation

1 file changed

+18
-7
lines changed

application/src/main/java/org/togetherjava/tjbot/commands/moderation/WhoIsCommand.java

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
import net.dv8tion.jda.api.interactions.components.ButtonStyle;
1313
import net.dv8tion.jda.api.requests.restaction.interactions.ReplyAction;
1414
import org.jetbrains.annotations.NotNull;
15-
import org.slf4j.Logger;
16-
import org.slf4j.LoggerFactory;
1715
import org.togetherjava.tjbot.commands.SlashCommandAdapter;
1816
import org.togetherjava.tjbot.commands.SlashCommandVisibility;
1917

@@ -26,14 +24,20 @@
2624
import java.util.Objects;
2725
import java.util.stream.Collectors;
2826

27+
/**
28+
* You ever wanted to stalk someone on Discord? Well no need to worry anymore! I got you covered,
29+
* this command allows you to look up user (or member) info.
30+
*/
31+
@SuppressWarnings("ClassWithoutLogger")
2932
public final class WhoIsCommand extends SlashCommandAdapter {
30-
private static final Logger logger = LoggerFactory.getLogger(WhoIsCommand.class);
31-
3233
private static final String USER_OPTION = "user";
3334
private static final String SHOW_SERVER_SPECIFIC_INFO = "show_server_specific_info";
3435
private static final DateTimeFormatter DATE_TIME_FORMAT =
3536
DateTimeFormatter.ofPattern("E, MMMM d, u, HH:mm:ss");
3637

38+
/**
39+
* Creates an instance of who is command
40+
*/
3741
public WhoIsCommand() {
3842
super("whois", "Provides info about the given user", SlashCommandVisibility.GUILD);
3943

@@ -138,17 +142,24 @@ public void onSlashCommand(@NotNull final SlashCommandEvent event) {
138142
* @param user the {@link User} getting whois'd
139143
* @param profile the {@link net.dv8tion.jda.api.entities.User.Profile} of the whois'd user
140144
* @param effectiveColor the {@link Color} that the embed will become
141-
* @return
145+
* @return the generated {@link EmbedBuilder}
142146
*/
143147
private static @NotNull EmbedBuilder generateEmbedBuilder(
144148
@NotNull final SlashCommandEvent event, @NotNull final User user,
145149
final @NotNull User.Profile profile, final Color effectiveColor) {
146-
return new EmbedBuilder().setThumbnail(user.getEffectiveAvatarUrl())
150+
151+
152+
EmbedBuilder embedBuilder = new EmbedBuilder().setThumbnail(user.getEffectiveAvatarUrl())
147153
.setColor(effectiveColor)
148-
.setImage(profile.getBannerUrl() + "?size=4096")
149154
.setFooter("Requested by " + event.getUser().getAsTag(),
150155
event.getMember().getEffectiveAvatarUrl())
151156
.setTimestamp(Instant.now());
157+
158+
if (null != profile.getBannerId()) {
159+
embedBuilder.setImage(profile.getBannerUrl() + "?size=4096");
160+
}
161+
162+
return embedBuilder;
152163
}
153164

154165
/**

0 commit comments

Comments
 (0)