use of org.javacord.api.event.server.role.RoleDeleteEvent in project Javacord by BtoBastian.
the class GuildRoleDeleteHandler method handle.
@Override
public void handle(JsonNode packet) {
long serverId = packet.get("guild_id").asLong();
api.getPossiblyUnreadyServerById(serverId).map(server -> ((ServerImpl) server)).ifPresent(server -> {
long roleId = packet.get("role_id").asLong();
server.getRoleById(roleId).ifPresent(role -> {
server.removeRole(roleId);
RoleDeleteEvent event = new RoleDeleteEventImpl(role);
api.getEventDispatcher().dispatchRoleDeleteEvent(server, role, server, event);
});
});
}
Aggregations