mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-01-22 07:38:09 +00:00
[AB-xxx] adding utility function to change color of a role
This commit is contained in:
@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -289,6 +290,11 @@ public class RoleServiceBean implements RoleService {
|
||||
return ARole.builder().id(roleId).fake(true).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> setRoleColorTo(Role role, Color color) {
|
||||
return role.getManager().setColor(color).submit();
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
metricService.registerCounter(ROLE_ASSIGNED_METRIC, "Amount of roles assigned");
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -40,4 +41,5 @@ public interface RoleService {
|
||||
boolean canBotInteractWithRole(Role role);
|
||||
ARole getFakeRoleFromRole(Role role);
|
||||
ARole getFakeRoleFromId(Long roleId);
|
||||
CompletableFuture<Void> setRoleColorTo(Role role, Color color);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user