|
12 | 12 | import net.dv8tion.jda.api.interactions.components.ButtonStyle; |
13 | 13 | import net.dv8tion.jda.api.requests.restaction.interactions.ReplyAction; |
14 | 14 | import org.jetbrains.annotations.NotNull; |
15 | | -import org.slf4j.Logger; |
16 | | -import org.slf4j.LoggerFactory; |
17 | 15 | import org.togetherjava.tjbot.commands.SlashCommandAdapter; |
18 | 16 | import org.togetherjava.tjbot.commands.SlashCommandVisibility; |
19 | 17 |
|
|
26 | 24 | import java.util.Objects; |
27 | 25 | import java.util.stream.Collectors; |
28 | 26 |
|
| 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") |
29 | 32 | public final class WhoIsCommand extends SlashCommandAdapter { |
30 | | - private static final Logger logger = LoggerFactory.getLogger(WhoIsCommand.class); |
31 | | - |
32 | 33 | private static final String USER_OPTION = "user"; |
33 | 34 | private static final String SHOW_SERVER_SPECIFIC_INFO = "show_server_specific_info"; |
34 | 35 | private static final DateTimeFormatter DATE_TIME_FORMAT = |
35 | 36 | DateTimeFormatter.ofPattern("E, MMMM d, u, HH:mm:ss"); |
36 | 37 |
|
| 38 | + /** |
| 39 | + * Creates an instance of who is command |
| 40 | + */ |
37 | 41 | public WhoIsCommand() { |
38 | 42 | super("whois", "Provides info about the given user", SlashCommandVisibility.GUILD); |
39 | 43 |
|
@@ -138,17 +142,24 @@ public void onSlashCommand(@NotNull final SlashCommandEvent event) { |
138 | 142 | * @param user the {@link User} getting whois'd |
139 | 143 | * @param profile the {@link net.dv8tion.jda.api.entities.User.Profile} of the whois'd user |
140 | 144 | * @param effectiveColor the {@link Color} that the embed will become |
141 | | - * @return |
| 145 | + * @return the generated {@link EmbedBuilder} |
142 | 146 | */ |
143 | 147 | private static @NotNull EmbedBuilder generateEmbedBuilder( |
144 | 148 | @NotNull final SlashCommandEvent event, @NotNull final User user, |
145 | 149 | 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()) |
147 | 153 | .setColor(effectiveColor) |
148 | | - .setImage(profile.getBannerUrl() + "?size=4096") |
149 | 154 | .setFooter("Requested by " + event.getUser().getAsTag(), |
150 | 155 | event.getMember().getEffectiveAvatarUrl()) |
151 | 156 | .setTimestamp(Instant.now()); |
| 157 | + |
| 158 | + if (null != profile.getBannerId()) { |
| 159 | + embedBuilder.setImage(profile.getBannerUrl() + "?size=4096"); |
| 160 | + } |
| 161 | + |
| 162 | + return embedBuilder; |
152 | 163 | } |
153 | 164 |
|
154 | 165 | /** |
|
0 commit comments