Improve internal documentation
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
044445890f
commit
33d81acc64
@ -15,7 +15,7 @@ public class Configuration
|
|||||||
private final static String defaultInviteLink =
|
private final static String defaultInviteLink =
|
||||||
"https://discord.com/api/oauth2/authorize?client_id=%userid%&scope=bot+applications.commands&permissions=8";
|
"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 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() {
|
public static String getInviteUrl() {
|
||||||
return defaultInviteLink.replace("%userid%", botUserId);
|
return defaultInviteLink.replace("%userid%", botApplicationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -60,9 +60,9 @@ public class HidekoBot
|
|||||||
shutdown(); // if we failed connecting and authenticating, then quit.
|
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();
|
String botUserId = jda.getSelfUser().getId();
|
||||||
Configuration.seBotUserId(botUserId);
|
Configuration.setBotApplicationId(botUserId);
|
||||||
|
|
||||||
// register listeners
|
// register listeners
|
||||||
jda.addEventListener(new MessageListener());
|
jda.addEventListener(new MessageListener());
|
||||||
|
@ -51,6 +51,7 @@ public class AvatarCommand
|
|||||||
|
|
||||||
EmbedBuilder embedBuilder = new EmbedBuilder();
|
EmbedBuilder embedBuilder = new EmbedBuilder();
|
||||||
|
|
||||||
|
// embed processing
|
||||||
{
|
{
|
||||||
embedBuilder.setColor(Color.PINK);
|
embedBuilder.setColor(Color.PINK);
|
||||||
embedBuilder.setAuthor(event.getUser().getAsTag(), null, event.getUser().getEffectiveAvatarUrl());
|
embedBuilder.setAuthor(event.getUser().getAsTag(), null, event.getUser().getEffectiveAvatarUrl());
|
||||||
@ -58,6 +59,7 @@ public class AvatarCommand
|
|||||||
|
|
||||||
embedBuilder.addField("Current resolution", resolution + " × " + resolution, false);
|
embedBuilder.addField("Current resolution", resolution + " × " + resolution, false);
|
||||||
|
|
||||||
|
// string builder to create a string that links to all available resolutions
|
||||||
StringBuilder links = new StringBuilder();
|
StringBuilder links = new StringBuilder();
|
||||||
for(int pos = 0; pos < acceptedSizes.length; pos++)
|
for(int pos = 0; pos < acceptedSizes.length; pos++)
|
||||||
{
|
{
|
||||||
@ -66,7 +68,7 @@ public class AvatarCommand
|
|||||||
String currLink = user.getEffectiveAvatar().getUrl(currSize);
|
String currLink = user.getEffectiveAvatar().getUrl(currSize);
|
||||||
|
|
||||||
links.append("[").append(currSize).append("px](").append(currLink).append(")");
|
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(" | ");
|
links.append(" | ");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user