update role log embed
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m3s
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m3s
This commit is contained in:
parent
75da7a4b51
commit
f6a23e4888
@ -6,6 +6,8 @@ import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author Fascinated (fascinated7)
|
||||
*/
|
||||
@ -36,4 +38,31 @@ public class RoleUtils {
|
||||
}
|
||||
return formattedPermissions.substring(0, formattedPermissions.length() - 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the formatted color of a role
|
||||
*
|
||||
* @param color the color string to get the formatted color of
|
||||
* @return the formatted color
|
||||
*/
|
||||
public String getFormattedColor(Color color) {
|
||||
if (color == null) {
|
||||
return "Default";
|
||||
}
|
||||
String colorHex = HexColorUtils.colorToHex(color);
|
||||
return "`%s` *[(view)](%s)*".formatted(
|
||||
colorHex,
|
||||
"https://www.colorhexa.com/%s".formatted(colorHex.substring(1))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the formatted color of a role
|
||||
*
|
||||
* @param role the role to get the formatted icon of
|
||||
* @return the formatted icon
|
||||
*/
|
||||
public String getFormattedColor(Role role) {
|
||||
return getFormattedColor(role.getColor());
|
||||
}
|
||||
}
|
||||
|
@ -75,9 +75,7 @@ public class RoleListener implements EventListener {
|
||||
logFeature.sendLog(guild, LogType.ROLE_CREATE, EmbedUtils.successEmbed()
|
||||
.setDescription(new EmbedDescriptionBuilder("Role Created")
|
||||
.appendLine("Role: %s".formatted(role.getAsMention()), true)
|
||||
.appendLine("Color: `%s`".formatted(
|
||||
role.getColor() == null ? "Default" : HexColorUtils.colorToHex(role.getColor())
|
||||
), true)
|
||||
.appendLine("Color: %s".formatted(RoleUtils.getFormattedColor(role)), true)
|
||||
.appendLine("Permissions: %s".formatted(RoleUtils.getFormattedPermissions(role)), true)
|
||||
.build())
|
||||
.build());
|
||||
@ -90,9 +88,7 @@ public class RoleListener implements EventListener {
|
||||
logFeature.sendLog(guild, LogType.ROLE_DELETE, EmbedUtils.successEmbed()
|
||||
.setDescription(new EmbedDescriptionBuilder("Role Deleted")
|
||||
.appendLine("Role: `%s`".formatted(role.getName()), true)
|
||||
.appendLine("Color: `%s`".formatted(
|
||||
role.getColor() == null ? "Default" : HexColorUtils.colorToHex(role.getColor())
|
||||
), true)
|
||||
.appendLine("Color: %s".formatted(RoleUtils.getFormattedColor(role)), true)
|
||||
.appendLine("Permissions: %s".formatted(RoleUtils.getFormattedPermissions(role)), true)
|
||||
.build())
|
||||
.build());
|
||||
@ -120,9 +116,9 @@ public class RoleListener implements EventListener {
|
||||
logFeature.sendLog(guild, LogType.ROLE_CONFIGURATION, EmbedUtils.successEmbed()
|
||||
.setDescription(new EmbedDescriptionBuilder("Role Color Updated")
|
||||
.appendLine("Role: %s".formatted(event.getRole().getAsMention()), true)
|
||||
.appendLine("Color: `%s` -> `%s`".formatted(
|
||||
oldColor == null ? "Default" : HexColorUtils.colorToHex(oldColor),
|
||||
newColor == null ? "Default" : HexColorUtils.colorToHex(newColor)
|
||||
.appendLine("Color: %s -> %s".formatted(
|
||||
RoleUtils.getFormattedColor(oldColor),
|
||||
RoleUtils.getFormattedColor(newColor)
|
||||
), true)
|
||||
.build())
|
||||
.build());
|
||||
|
Loading…
Reference in New Issue
Block a user