diff --git a/src/main/java/wtf/beatrice/hidekobot/Configuration.java b/src/main/java/wtf/beatrice/hidekobot/Configuration.java index 8fa5c94..2c6e0d4 100644 --- a/src/main/java/wtf/beatrice/hidekobot/Configuration.java +++ b/src/main/java/wtf/beatrice/hidekobot/Configuration.java @@ -15,7 +15,7 @@ public class Configuration private final static String defaultInviteLink = "https://discord.com/api/oauth2/authorize?client_id=%userid%&scope=bot+applications.commands&permissions=8"; - private static String botUserId = ""; + private static String botApplicationId = ""; /** @@ -59,15 +59,30 @@ public class Configuration */ public static long getBotOwnerId() { return botOwnerId; } - public static void seBotUserId(String id) + /** + * Set the bot's application id. + * + * @param id the bot's application id + */ + public static void setBotApplicationId(String id) { - botUserId = id; + botApplicationId = id; } - public static String getBotUserId() { return botUserId; } + /** + * Get the bot's application id + * + * @return a string of the bot's application id + */ + public static String getBotApplicationId() { return botApplicationId; } + /** + * Function to generate an invite link for the bot + * + * @return a string containing the invite link + */ public static String getInviteUrl() { - return defaultInviteLink.replace("%userid%", botUserId); + return defaultInviteLink.replace("%userid%", botApplicationId); } } diff --git a/src/main/java/wtf/beatrice/hidekobot/HidekoBot.java b/src/main/java/wtf/beatrice/hidekobot/HidekoBot.java index b7e7d51..0af5be7 100644 --- a/src/main/java/wtf/beatrice/hidekobot/HidekoBot.java +++ b/src/main/java/wtf/beatrice/hidekobot/HidekoBot.java @@ -60,9 +60,9 @@ public class HidekoBot shutdown(); // if we failed connecting and authenticating, then quit. } - // find the bot's user id and generate an invite-link. + // find the bot's user/application id String botUserId = jda.getSelfUser().getId(); - Configuration.seBotUserId(botUserId); + Configuration.setBotApplicationId(botUserId); // register listeners jda.addEventListener(new MessageListener()); diff --git a/src/main/java/wtf/beatrice/hidekobot/slashcommands/AvatarCommand.java b/src/main/java/wtf/beatrice/hidekobot/slashcommands/AvatarCommand.java index a7ca8a5..b937530 100644 --- a/src/main/java/wtf/beatrice/hidekobot/slashcommands/AvatarCommand.java +++ b/src/main/java/wtf/beatrice/hidekobot/slashcommands/AvatarCommand.java @@ -51,6 +51,7 @@ public class AvatarCommand EmbedBuilder embedBuilder = new EmbedBuilder(); + // embed processing { embedBuilder.setColor(Color.PINK); embedBuilder.setAuthor(event.getUser().getAsTag(), null, event.getUser().getEffectiveAvatarUrl()); @@ -58,6 +59,7 @@ public class AvatarCommand embedBuilder.addField("Current resolution", resolution + " × " + resolution, false); + // string builder to create a string that links to all available resolutions StringBuilder links = new StringBuilder(); for(int pos = 0; pos < acceptedSizes.length; pos++) { @@ -66,7 +68,7 @@ public class AvatarCommand String currLink = user.getEffectiveAvatar().getUrl(currSize); links.append("[").append(currSize).append("px](").append(currLink).append(")"); - if(pos+1 != acceptedSizes.length) + if(pos + 1 != acceptedSizes.length) // don't add a separator on the last iteration { links.append(" | "); }