mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-01-20 15:06:16 +00:00
Compare commits
6 Commits
release-20
...
v1.6.19
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d844e09f4d | ||
|
|
8251074aab | ||
|
|
4180a07243 | ||
|
|
cf9e5f67f6 | ||
|
|
ae53784da2 | ||
|
|
342f0b6043 |
2
.env
2
.env
@@ -1,2 +1,2 @@
|
||||
REGISTRY_PREFIX=harbor.sheldan.dev/abstracto/
|
||||
VERSION=1.6.17
|
||||
VERSION=1.6.18
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>anti-raid</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>anti-raid</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>assignable-roles</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ import net.dv8tion.jda.api.entities.channel.middleman.GuildChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||
import net.dv8tion.jda.api.entities.emoji.CustomEmoji;
|
||||
import net.dv8tion.jda.api.entities.emoji.Emoji;
|
||||
import net.dv8tion.jda.api.components.buttons.ButtonStyle;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -60,9 +59,6 @@ public class AssignableRolePlaceServiceBean implements AssignableRolePlaceServic
|
||||
@Autowired
|
||||
private ChannelService channelService;
|
||||
|
||||
@Autowired
|
||||
private GuildService guildService;
|
||||
|
||||
@Autowired
|
||||
private EmoteService emoteService;
|
||||
|
||||
@@ -131,9 +127,18 @@ public class AssignableRolePlaceServiceBean implements AssignableRolePlaceServic
|
||||
String buttonId = componentService.generateComponentId();
|
||||
String emoteMarkdown = emoji != null ? emoji.getFormatted() : null;
|
||||
if (assignableRolePlace.getMessageId() != null) {
|
||||
AssignablePostMessage model = prepareAssignablePostMessageModel(assignableRolePlace);
|
||||
model.getRoles().add(AssignablePostRole
|
||||
.builder()
|
||||
.componentId(buttonId)
|
||||
.emoteMarkDown(emoteMarkdown)
|
||||
.description(description)
|
||||
.build());
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(ASSIGNABLE_ROLES_POST_TEMPLATE_KEY, model, assignableRolePlace.getServer().getId());
|
||||
log.debug("Assignable role place {} has already message post with ID {} - updating.", assignableRolePlace.getId(), assignableRolePlace.getMessageId());
|
||||
return componentService.addButtonToMessage(assignableRolePlace.getMessageId(), textChannel, buttonId, description, emoteMarkdown, ButtonStyle.SECONDARY)
|
||||
.thenAccept(message -> self.persistAssignableRoleAddition(placeId, role, description, emoji, buttonId));
|
||||
return messageService.editMessageInChannel(textChannel, messageToSend, assignableRolePlace.getMessageId()).thenAccept(unused -> {
|
||||
self.persistAssignableRoleAddition(placeId, role, description, emoji, buttonId);
|
||||
});
|
||||
} else {
|
||||
log.info("Assignable role place {} is not yet setup - only adding role to the database.", assignableRolePlace.getId());
|
||||
self.persistAssignableRoleAddition(placeId, role, description, emoji, buttonId);
|
||||
@@ -174,7 +179,7 @@ public class AssignableRolePlaceServiceBean implements AssignableRolePlaceServic
|
||||
return channelService.retrieveMessageInChannel(assignableRolePlace.getServer().getId(), assignableRolePlace.getChannel().getId(), assignableRolePlace.getMessageId())
|
||||
.thenCompose(message -> {
|
||||
log.debug("Updating message {} to remove component with ID {}.", message.getIdLong(), componentId);
|
||||
return componentService.removeComponentWithId(message, componentId, true);
|
||||
return componentService.removeComponentById(message, componentId).thenAccept(message1 -> {});
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -269,8 +274,8 @@ public class AssignableRolePlaceServiceBean implements AssignableRolePlaceServic
|
||||
log.info("Deactivating assignable role place {} in server {}", place.getId(), place.getServer().getId());
|
||||
return channelService.retrieveMessageInChannel(place.getServer().getId(), place.getChannel().getId(), place.getMessageId())
|
||||
.thenCompose(message ->
|
||||
componentService.disableAllButtons(message)
|
||||
);
|
||||
componentService.disableAllComponents(message)
|
||||
).thenAccept(message -> {});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -283,8 +288,8 @@ public class AssignableRolePlaceServiceBean implements AssignableRolePlaceServic
|
||||
log.info("Activating assignable role place {} in server {}", place.getId(), place.getServer().getId());
|
||||
return channelService.retrieveMessageInChannel(place.getServer().getId(), place.getChannel().getId(), place.getMessageId())
|
||||
.thenCompose(message ->
|
||||
componentService.enableAllButtons(message)
|
||||
);
|
||||
componentService.enableAllComponents(message)
|
||||
).thenAccept(message -> {});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>assignable-roles</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>assignable-roles-int</artifactId>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>custom-command</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>custom-command</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>dynamic-activity</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>dynamic-activity</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>entertainment</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -200,8 +200,8 @@ public class EntertainmentServiceBean implements EntertainmentService {
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendMessageEmbedToSendToAChannel(messageToSend, pressF.getPressFChannel()))
|
||||
.thenCompose(unused -> messageService.loadMessage(serverId, channelId, messageId).thenCompose(message -> {
|
||||
log.info("Clearing buttons from pressF {} in with message {} in channel {} in server {}.", pressFId, pressFId, channelId, serverId);
|
||||
return componentService.clearButtons(message);
|
||||
}));
|
||||
return componentService.clearComponents(message);
|
||||
})).thenAccept(message -> {});
|
||||
} else {
|
||||
throw new AbstractoRunTimeException(String.format("PressF with id %s not found.", pressFId));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>entertainment</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>experience-tracking</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>experience-tracking</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>giveaway</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>giveaway-impl</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>giveaway</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>giveaway-int</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>giveaway</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>image-generation</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>image-generation-impl</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>image-generation</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>image-generation-int</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>image-generation</artifactId>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>invite-filter</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>invite-filter</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<dependency>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>moderation-int</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>link-embed</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>link-embed</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>logging</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>logging</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>moderation</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class BanModerationActionModalListener implements ModalInteractionListene
|
||||
.getEvent()
|
||||
.getValues()
|
||||
.stream()
|
||||
.filter(modalMapping -> modalMapping.getId().equals(payload.getDurationInputId()))
|
||||
.filter(modalMapping -> modalMapping.getCustomId().equals(payload.getDurationInputId()))
|
||||
.map(ModalMapping::getAsString)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
@@ -76,7 +76,7 @@ public class BanModerationActionModalListener implements ModalInteractionListene
|
||||
.getEvent()
|
||||
.getValues()
|
||||
.stream()
|
||||
.filter(modalMapping -> modalMapping.getId().equals(payload.getReasonInputId()))
|
||||
.filter(modalMapping -> modalMapping.getCustomId().equals(payload.getReasonInputId()))
|
||||
.map(ModalMapping::getAsString)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
@@ -51,7 +51,7 @@ public class KickModerationActionModalListener implements ModalInteractionListen
|
||||
.getEvent()
|
||||
.getValues()
|
||||
.stream()
|
||||
.filter(modalMapping -> modalMapping.getId().equals(payload.getReasonInputId()))
|
||||
.filter(modalMapping -> modalMapping.getCustomId().equals(payload.getReasonInputId()))
|
||||
.map(ModalMapping::getAsString)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
@@ -59,7 +59,7 @@ public class MuteModerationActionModalListener implements ModalInteractionListen
|
||||
.getEvent()
|
||||
.getValues()
|
||||
.stream()
|
||||
.filter(modalMapping -> modalMapping.getId().equals(payload.getReasonInputId()))
|
||||
.filter(modalMapping -> modalMapping.getCustomId().equals(payload.getReasonInputId()))
|
||||
.map(ModalMapping::getAsString)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
@@ -68,7 +68,7 @@ public class MuteModerationActionModalListener implements ModalInteractionListen
|
||||
.getEvent()
|
||||
.getValues()
|
||||
.stream()
|
||||
.filter(modalMapping -> modalMapping.getId().equals(payload.getDurationInputId()))
|
||||
.filter(modalMapping -> modalMapping.getCustomId().equals(payload.getDurationInputId()))
|
||||
.map(ModalMapping::getAsString)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
@@ -60,7 +60,7 @@ public class WarnModerationActionModalListener implements ModalInteractionListen
|
||||
.getEvent()
|
||||
.getValues()
|
||||
.stream()
|
||||
.filter(modalMapping -> modalMapping.getId().equals(payload.getReasonInputId()))
|
||||
.filter(modalMapping -> modalMapping.getCustomId().equals(payload.getReasonInputId()))
|
||||
.map(ModalMapping::getAsString)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ReportContextModalListener implements ModalInteractionListener {
|
||||
.getEvent()
|
||||
.getValues()
|
||||
.stream()
|
||||
.filter(modalMapping -> modalMapping.getId().equals(payload.getTextInputId()))
|
||||
.filter(modalMapping -> modalMapping.getCustomId().equals(payload.getTextInputId()))
|
||||
.map(ModalMapping::getAsString)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
@@ -61,7 +61,9 @@ public class KickServiceBean implements KickService {
|
||||
public CompletableFuture<Void> kickMember(Member kickedMember, Member kickingMember, String reason) {
|
||||
Guild guild = kickedMember.getGuild();
|
||||
log.info("Kicking user {} from guild {}", kickedMember.getUser().getIdLong(), guild.getIdLong());
|
||||
CompletableFuture<Void> kickFuture = guild.kick(kickedMember, reason).submit();
|
||||
CompletableFuture<Void> kickFuture = guild.kick(kickedMember)
|
||||
.reason(reason)
|
||||
.submit();
|
||||
CompletableFuture<Message> logFuture = sendKickLog(kickedMember.getUser(), ServerUser.fromMember(kickedMember), kickingMember.getUser(), ServerUser.fromMember(kickingMember), reason, guild.getIdLong());
|
||||
return CompletableFuture.allOf(kickFuture, logFuture)
|
||||
.thenAccept(unused -> self.storeInfraction(kickedMember, kickingMember, reason, logFuture.join(), guild.getIdLong()));
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>moderation</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>modmail</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>modmail</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto</groupId>
|
||||
<artifactId>abstracto-application</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>profanity-filter</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>profanity-filter</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>remind</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>remind</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>repost-detection</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>repost-detection</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>starboard</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>starboard</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>statistic</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>statistic</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>sticky-roles</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sticky-roles-impl</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>sticky-roles</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sticky-roles-int</artifactId>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>suggestion</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ServerPollAddOptionModalListener implements ModalInteractionListene
|
||||
.getEvent()
|
||||
.getValues()
|
||||
.stream()
|
||||
.filter(modalMapping -> modalMapping.getId().equals(payload.getLabelInputComponentId()))
|
||||
.filter(modalMapping -> modalMapping.getCustomId().equals(payload.getLabelInputComponentId()))
|
||||
.map(ModalMapping::getAsString)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
@@ -62,7 +62,7 @@ public class ServerPollAddOptionModalListener implements ModalInteractionListene
|
||||
.getEvent()
|
||||
.getValues()
|
||||
.stream()
|
||||
.filter(modalMapping -> modalMapping.getId().equals(payload.getDescriptionInputComponentId()))
|
||||
.filter(modalMapping -> modalMapping.getCustomId().equals(payload.getDescriptionInputComponentId()))
|
||||
.map(ModalMapping::getAsString)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
@@ -381,8 +381,8 @@ public class SuggestionServiceBean implements SuggestionService {
|
||||
if(useButtons) {
|
||||
return messageService.loadMessage(serverId, channelId, messageId).thenCompose(message -> {
|
||||
log.info("Clearing buttons from suggestion {} in with message {} in channel {} in server {}.", suggestionId, message, channelId, serverId);
|
||||
return componentService.clearButtons(message);
|
||||
});
|
||||
return componentService.clearComponents(message);
|
||||
}).thenAccept(message -> {});
|
||||
} else {
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>suggestion</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>twitch</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>twitch</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>twitch-int</artifactId>
|
||||
@@ -14,11 +15,10 @@
|
||||
<groupId>com.github.twitch4j</groupId>
|
||||
<artifactId>twitch4j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.apollographql.apollo</groupId>
|
||||
<artifactId>apollo-runtime</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>utility</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>utility</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>voice-channel-context</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>voice-channel-context</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>webservices</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>webservices</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto</groupId>
|
||||
<artifactId>abstracto-application</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.core</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>1.6.18-SNAPSHOT</version>
|
||||
<version>1.6.19</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
@@ -84,7 +84,7 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.github.freya022</groupId>
|
||||
<groupId>net.dv8tion</groupId>
|
||||
<artifactId>JDA</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
package dev.sheldan.abstracto.core.commands.config;
|
||||
|
||||
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
|
||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||
import dev.sheldan.abstracto.core.command.config.features.CoreFeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.exception.ConfigurationKeyNotFoundException;
|
||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandAutoCompleteService;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||
import dev.sheldan.abstracto.core.models.database.AConfig;
|
||||
import dev.sheldan.abstracto.core.models.property.SystemConfigProperty;
|
||||
import dev.sheldan.abstracto.core.models.template.commands.GetConfigModel;
|
||||
import dev.sheldan.abstracto.core.service.FeatureConfigService;
|
||||
import dev.sheldan.abstracto.core.service.PaginatorService;
|
||||
import dev.sheldan.abstracto.core.service.management.ConfigManagementService;
|
||||
import dev.sheldan.abstracto.core.service.management.DefaultConfigManagementService;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
|
||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class GetConfig extends AbstractConditionableCommand {
|
||||
|
||||
private static final String GET_CONFIG_COMMAND = "getConfig";
|
||||
private static final String KEY_PARAMETER = "key";
|
||||
private static final String FEATURE_PARAMETER = "feature";
|
||||
|
||||
private static final String GET_CONFIG_RESPONSE_TEMPLATE_KEY = "getConfig_response";
|
||||
private static final String NO_CONFIGS_TEMPLATE_KEY = "getConfig_no_configs_found";
|
||||
|
||||
@Autowired
|
||||
private SlashCommandParameterService slashCommandParameterService;
|
||||
|
||||
@Autowired
|
||||
private FeatureConfigService featureConfigService;
|
||||
|
||||
@Autowired
|
||||
private SlashCommandAutoCompleteService slashCommandAutoCompleteService;
|
||||
|
||||
@Autowired
|
||||
private DefaultConfigManagementService defaultConfigManagementService;
|
||||
|
||||
@Autowired
|
||||
private ConfigManagementService configManagementService;
|
||||
|
||||
@Autowired
|
||||
private PaginatorService paginatorService;
|
||||
|
||||
@Autowired
|
||||
private InteractionService interactionService;
|
||||
|
||||
@Override
|
||||
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
|
||||
Long serverId = event.getGuild().getIdLong();
|
||||
List<GetConfigModel.ConfigValue> configValues;
|
||||
if(slashCommandParameterService.hasCommandOption(KEY_PARAMETER, event)) {
|
||||
String key = slashCommandParameterService.getCommandOption(KEY_PARAMETER, event, String.class);
|
||||
if(!defaultConfigManagementService.configKeyExists(key)) {
|
||||
throw new ConfigurationKeyNotFoundException(key);
|
||||
}
|
||||
|
||||
GetConfigModel.ConfigValue.ConfigValueBuilder configValueBuilder = GetConfigModel.ConfigValue.builder();
|
||||
if(configManagementService.configExists(serverId, key)) {
|
||||
AConfig aConfig = configManagementService.loadConfig(serverId, key);
|
||||
configValueBuilder
|
||||
.doubleValue(aConfig.getDoubleValue())
|
||||
.hasConcreateValue(true)
|
||||
.longValue(aConfig.getLongValue())
|
||||
.stringValue(aConfig.getStringValue());
|
||||
}
|
||||
SystemConfigProperty defaultConfig = defaultConfigManagementService.getDefaultConfig(key);
|
||||
GetConfigModel.ConfigValue.ConfigValueBuilder defaultConfigValueBuilder = GetConfigModel
|
||||
.ConfigValue
|
||||
.builder()
|
||||
.stringValue(defaultConfig.getStringValue())
|
||||
.doubleValue(defaultConfig.getDoubleValue())
|
||||
.longValue(defaultConfig.getLongValue())
|
||||
.key(defaultConfig.getName());
|
||||
configValueBuilder
|
||||
.key(defaultConfig.getName())
|
||||
.defaultValue(defaultConfigValueBuilder.build());
|
||||
configValues = List.of(configValueBuilder.build());
|
||||
|
||||
} else if(slashCommandParameterService.hasCommandOption(FEATURE_PARAMETER, event)) {
|
||||
String featureKey = slashCommandParameterService.getCommandOption(FEATURE_PARAMETER, event, String.class);
|
||||
FeatureConfig feature = featureConfigService.getFeatureDisplayForFeature(featureKey);
|
||||
List<String> configKeys = feature.getRequiredSystemConfigKeys();
|
||||
configValues = getConfigValuesForKeys(serverId, configKeys);
|
||||
} else {
|
||||
List<String> configKeys = defaultConfigManagementService.getConfigKeys();
|
||||
configValues = getConfigValuesForKeys(serverId, configKeys);
|
||||
}
|
||||
|
||||
if(configValues.isEmpty()) {
|
||||
return interactionService.replyEmbed(NO_CONFIGS_TEMPLATE_KEY, new Object() , event)
|
||||
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
||||
}
|
||||
|
||||
configValues = new ArrayList<>(configValues);
|
||||
configValues.sort(Comparator.comparing(GetConfigModel.ConfigValue::getKey));
|
||||
GetConfigModel model = GetConfigModel.builder()
|
||||
.values(configValues)
|
||||
.build();
|
||||
|
||||
return paginatorService.createPaginatorFromTemplate(GET_CONFIG_RESPONSE_TEMPLATE_KEY, model, event)
|
||||
.thenApply(unused -> CommandResult.fromSuccess());
|
||||
}
|
||||
|
||||
private List<GetConfigModel.ConfigValue> getConfigValuesForKeys(Long serverId, List<String> configKeys) {
|
||||
Map<String, AConfig> allExistingConfigs = configManagementService
|
||||
.loadForServer(serverId)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(aConfig -> aConfig.getName().toLowerCase(), Function.identity()));
|
||||
return configKeys.stream().map(key -> {
|
||||
GetConfigModel.ConfigValue.ConfigValueBuilder configValueBuilder = GetConfigModel.ConfigValue.builder();
|
||||
if(allExistingConfigs.containsKey(key.toLowerCase())) {
|
||||
AConfig aConfig = allExistingConfigs.get(key.toLowerCase());
|
||||
configValueBuilder
|
||||
.doubleValue(aConfig.getDoubleValue())
|
||||
.hasConcreateValue(true)
|
||||
.longValue(aConfig.getLongValue())
|
||||
.stringValue(aConfig.getStringValue());
|
||||
}
|
||||
SystemConfigProperty defaultConfig = defaultConfigManagementService.getDefaultConfig(key);
|
||||
GetConfigModel.ConfigValue.ConfigValueBuilder defaultConfigValueBuilder = GetConfigModel
|
||||
.ConfigValue
|
||||
.builder()
|
||||
.stringValue(defaultConfig.getStringValue())
|
||||
.doubleValue(defaultConfig.getDoubleValue())
|
||||
.longValue(defaultConfig.getLongValue())
|
||||
.key(defaultConfig.getName());
|
||||
configValueBuilder
|
||||
.key(defaultConfig.getName())
|
||||
.defaultValue(defaultConfigValueBuilder.build());
|
||||
return configValueBuilder.build();
|
||||
}).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> performAutoComplete(CommandAutoCompleteInteractionEvent event) {
|
||||
String input = event.getFocusedOption().getValue().toLowerCase();
|
||||
if(slashCommandAutoCompleteService.matchesParameter(event.getFocusedOption(), KEY_PARAMETER)) {
|
||||
return defaultConfigManagementService
|
||||
.getConfigKeys()
|
||||
.stream()
|
||||
.map(String::toLowerCase)
|
||||
.filter(key -> key.startsWith(input))
|
||||
.toList();
|
||||
} else if(slashCommandAutoCompleteService.matchesParameter(event.getFocusedOption(), FEATURE_PARAMETER)) {
|
||||
return featureConfigService.getAllFeatures()
|
||||
.stream()
|
||||
.map(String::toLowerCase)
|
||||
.filter(lowerCase -> lowerCase.startsWith(input))
|
||||
.toList();
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandConfiguration getConfiguration() {
|
||||
Parameter keyToGet = Parameter
|
||||
.builder()
|
||||
.name(KEY_PARAMETER)
|
||||
.type(String.class)
|
||||
.supportsAutoComplete(true)
|
||||
.templated(true)
|
||||
.optional(true)
|
||||
.build();
|
||||
Parameter featureToGet = Parameter
|
||||
.builder()
|
||||
.name(FEATURE_PARAMETER)
|
||||
.type(String.class)
|
||||
.supportsAutoComplete(true)
|
||||
.templated(true)
|
||||
.optional(true)
|
||||
.build();
|
||||
List<Parameter> parameters = Arrays.asList(keyToGet, featureToGet);
|
||||
HelpInfo helpInfo = HelpInfo
|
||||
.builder()
|
||||
.templated(true)
|
||||
.hasExample(true)
|
||||
.build();
|
||||
|
||||
SlashCommandConfig slashCommandConfig = SlashCommandConfig
|
||||
.builder()
|
||||
.enabled(true)
|
||||
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
|
||||
.rootCommandName(CoreSlashCommandNames.CONFIG)
|
||||
.commandName("get")
|
||||
.build();
|
||||
|
||||
return CommandConfiguration.builder()
|
||||
.name(GET_CONFIG_COMMAND)
|
||||
.module(ConfigModuleDefinition.CONFIG)
|
||||
.parameters(parameters)
|
||||
.slashCommandOnly(true)
|
||||
.slashCommandConfig(slashCommandConfig)
|
||||
.templated(true)
|
||||
.supportsEmbedException(true)
|
||||
.help(helpInfo)
|
||||
.causesReaction(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeatureDefinition getFeature() {
|
||||
return CoreFeatureDefinition.CORE_FEATURE;
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,12 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandAutoCompleteService;
|
||||
import dev.sheldan.abstracto.core.service.ConfigService;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||
import dev.sheldan.abstracto.core.service.management.DefaultConfigManagementService;
|
||||
import java.util.ArrayList;
|
||||
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
|
||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -36,6 +40,12 @@ public class SetConfig extends AbstractConditionableCommand {
|
||||
@Autowired
|
||||
private InteractionService interactionService;
|
||||
|
||||
@Autowired
|
||||
private SlashCommandAutoCompleteService slashCommandAutoCompleteService;
|
||||
|
||||
@Autowired
|
||||
private DefaultConfigManagementService defaultConfigManagementService;
|
||||
|
||||
private static final String RESPONSE_TEMPLATE = "setConfig_response";
|
||||
|
||||
@Override
|
||||
@@ -47,11 +57,26 @@ public class SetConfig extends AbstractConditionableCommand {
|
||||
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> performAutoComplete(CommandAutoCompleteInteractionEvent event) {
|
||||
if(slashCommandAutoCompleteService.matchesParameter(event.getFocusedOption(), KEY_PARAMETER)) {
|
||||
String input = event.getFocusedOption().getValue().toLowerCase();
|
||||
return defaultConfigManagementService
|
||||
.getConfigKeys()
|
||||
.stream()
|
||||
.map(String::toLowerCase)
|
||||
.filter(key -> key.startsWith(input))
|
||||
.toList();
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandConfiguration getConfiguration() {
|
||||
Parameter keyToChange = Parameter
|
||||
.builder()
|
||||
.name(KEY_PARAMETER)
|
||||
.supportsAutoComplete(true)
|
||||
.type(String.class)
|
||||
.templated(true)
|
||||
.build();
|
||||
|
||||
@@ -1,32 +1,21 @@
|
||||
package dev.sheldan.abstracto.core.interaction;
|
||||
|
||||
import dev.sheldan.abstracto.core.interaction.button.ButtonConfigModel;
|
||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||
import dev.sheldan.abstracto.core.service.MessageService;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||
import net.dv8tion.jda.api.entities.emoji.Emoji;
|
||||
import net.dv8tion.jda.api.components.ActionComponent;
|
||||
import net.dv8tion.jda.api.components.actionrow.ActionRow;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import net.dv8tion.jda.api.components.buttons.Button;
|
||||
import net.dv8tion.jda.api.components.buttons.ButtonStyle;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import net.dv8tion.jda.api.components.tree.MessageComponentTree;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class ComponentServiceBean implements ComponentService {
|
||||
|
||||
@Autowired
|
||||
private MessageService messageService;
|
||||
|
||||
@Autowired
|
||||
private ChannelService channelService;
|
||||
|
||||
@Override
|
||||
public String generateComponentId(Long serverId) {
|
||||
return generateComponentId();
|
||||
@@ -38,95 +27,48 @@ public class ComponentServiceBean implements ComponentService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Message> addButtonToMessage(Long messageId, GuildMessageChannel textChannel, String buttonId, String description, String emoteMarkdown, ButtonStyle style) {
|
||||
return channelService.retrieveMessageInChannel(textChannel, messageId).thenCompose(message -> {
|
||||
Button button = Button.of(style, buttonId, description);
|
||||
if(emoteMarkdown != null) {
|
||||
button = button.withEmoji(Emoji.fromFormatted(emoteMarkdown));
|
||||
}
|
||||
List<ActionRow> actionRows;
|
||||
if(message.getActionRows().isEmpty()) {
|
||||
actionRows = Arrays.asList(ActionRow.of(button));
|
||||
public CompletableFuture<Message> clearComponents(Message message) {
|
||||
MessageComponentTree tree = message.getComponentTree().replace(oldComponent -> null);
|
||||
return messageService.editMessage(message, tree);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Message> disableAllComponents(Message message) {
|
||||
return setAllComponentStatesTo(message, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Message> enableAllComponents(Message message) {
|
||||
return setAllComponentStatesTo(message, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Message> removeComponentById(Message message, String componentId) {
|
||||
MessageComponentTree tree;
|
||||
tree = message.getComponentTree().replace(oldComponent -> {
|
||||
if (oldComponent instanceof Button && componentId.equals(((Button) oldComponent).getCustomId())) {
|
||||
return null;
|
||||
} else {
|
||||
ActionRow lastRow = message.getActionRows().get(message.getActionRows().size() - 1);
|
||||
if(lastRow.getComponents().size() < MAX_BUTTONS_PER_ROW) {
|
||||
lastRow.getButtons().add(button);
|
||||
actionRows = message.getActionRows();
|
||||
} else {
|
||||
List<ActionRow> currentActionRows = new ArrayList<>(message.getActionRows());
|
||||
currentActionRows.add(ActionRow.of(button));
|
||||
actionRows = currentActionRows;
|
||||
}
|
||||
return oldComponent;
|
||||
}
|
||||
return messageService.editMessageWithActionRowsMessage(message, actionRows);
|
||||
});
|
||||
return messageService.editMessage(message, tree);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> clearButtons(Message message) {
|
||||
return messageService.editMessageWithActionRows(message, new ArrayList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> disableAllButtons(Message message) {
|
||||
return setAllButtonStatesTo(message, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> enableAllButtons(Message message) {
|
||||
return setAllButtonStatesTo(message, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> removeComponentWithId(Message message, String componentId) {
|
||||
return removeComponentWithId(message, componentId, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> removeComponentWithId(Message message, String componentId, Boolean rearrange) {
|
||||
List<ActionRow> actionRows = new ArrayList<>();
|
||||
if(Boolean.TRUE.equals(rearrange)) {
|
||||
List<net.dv8tion.jda.api.components.ActionComponent> components = new ArrayList<>();
|
||||
message.getActionRows().forEach(row ->
|
||||
row
|
||||
.getComponents()
|
||||
.stream()
|
||||
.filter(ActionComponent.class::isInstance)
|
||||
.map(ActionComponent.class::cast)
|
||||
.filter(component -> component.getId() == null || !component.getId().equals(componentId))
|
||||
.forEach(components::add));
|
||||
actionRows = splitIntoActionRowsMax(components);
|
||||
} else {
|
||||
for (ActionRow row : message.getActionRows()) {
|
||||
actionRows.add(ActionRow.of(
|
||||
row
|
||||
.getComponents()
|
||||
.stream()
|
||||
.filter(ActionComponent.class::isInstance)
|
||||
.map(ActionComponent.class::cast)
|
||||
.filter(component -> component.getId() == null || !component.getId().equals(componentId))
|
||||
.collect(Collectors.toList())));
|
||||
}
|
||||
}
|
||||
return messageService.editMessageWithActionRows(message, actionRows);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ActionRow> splitIntoActionRowsMax(List<net.dv8tion.jda.api.components.ActionComponent> allComponents) {
|
||||
List<List<net.dv8tion.jda.api.components.ActionComponent>> actionRows = ListUtils.partition(allComponents, MAX_BUTTONS_PER_ROW);
|
||||
return actionRows.stream().map(ActionRow::of).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ButtonConfigModel createButtonConfigModel() {
|
||||
return ButtonConfigModel.builder().buttonId(generateComponentId()).build();
|
||||
}
|
||||
|
||||
private CompletableFuture<Void> setAllButtonStatesTo(Message message, Boolean disabled) {
|
||||
List<ActionRow> actionRows = new ArrayList<>();
|
||||
|
||||
message.getActionRows().forEach(row -> actionRows.add(row.withDisabled(disabled)));
|
||||
return messageService.editMessageWithActionRows(message, actionRows);
|
||||
private CompletableFuture<Message> setAllComponentStatesTo(Message message, Boolean disabled) {
|
||||
MessageComponentTree tree;
|
||||
if(disabled) {
|
||||
tree = message.getComponentTree().asDisabled();
|
||||
} else {
|
||||
tree = message.getComponentTree().asEnabled();
|
||||
}
|
||||
return messageService.editMessage(message, tree);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -94,9 +94,9 @@ public class InteractionServiceBean implements InteractionService {
|
||||
if(!actionRows.isEmpty()) {
|
||||
AServer server = serverManagementService.loadServer(interactionHook.getInteraction().getGuild());
|
||||
allMessageActions.set(0, allMessageActions.get(0).addComponents(actionRows));
|
||||
actionRows.forEach(components -> components.forEach(component -> {
|
||||
actionRows.forEach(components -> components.getComponents().forEach(component -> {
|
||||
if(component instanceof ActionComponent) {
|
||||
String id = ((ActionComponent)component).getId();
|
||||
String id = ((ActionComponent)component).getCustomId();
|
||||
MessageToSend.ComponentConfig payload = messageToSend.getComponentPayloads().get(id);
|
||||
if(payload != null && payload.getPersistCallback()) {
|
||||
componentPayloadManagementService.createPayload(id, payload.getPayload(), payload.getPayloadType(), payload.getComponentOrigin(), server, payload.getComponentType());
|
||||
@@ -228,9 +228,9 @@ public class InteractionServiceBean implements InteractionService {
|
||||
server = serverManagementService.loadServer(serverId);
|
||||
} else {
|
||||
server = null; }
|
||||
actionRows.forEach(components -> components.forEach(component -> {
|
||||
actionRows.forEach(components -> components.getComponents().forEach(component -> {
|
||||
if(component instanceof ActionComponent) {
|
||||
String id = ((ActionComponent)component).getId();
|
||||
String id = ((ActionComponent)component).getCustomId();
|
||||
MessageToSend.ComponentConfig payload = messageToSend.getComponentPayloads().get(id);
|
||||
if(payload != null && payload.getPersistCallback()) {
|
||||
componentPayloadManagementService.createPayload(id, payload.getPayload(), payload.getPayloadType(), payload.getComponentOrigin(), server, payload.getComponentType());
|
||||
@@ -301,9 +301,9 @@ public class InteractionServiceBean implements InteractionService {
|
||||
} else {
|
||||
server = null;
|
||||
}
|
||||
actionRows.forEach(components -> components.forEach(component -> {
|
||||
actionRows.forEach(components -> components.getComponents().forEach(component -> {
|
||||
if(component instanceof ActionComponent) {
|
||||
String id = ((ActionComponent)component).getId();
|
||||
String id = ((ActionComponent)component).getCustomId();
|
||||
MessageToSend.ComponentConfig payload = messageToSend.getComponentPayloads().get(id);
|
||||
if(payload != null && payload.getPersistCallback()) {
|
||||
componentPayloadManagementService.createPayload(id, payload.getPayload(), payload.getPayloadType(), payload.getComponentOrigin(), server, payload.getComponentType());
|
||||
|
||||
@@ -6,12 +6,12 @@ import dev.sheldan.abstracto.core.interaction.modal.config.ModalConfig;
|
||||
import dev.sheldan.abstracto.core.interaction.modal.config.TextInputComponent;
|
||||
import dev.sheldan.abstracto.core.interaction.modal.config.TextInputComponentStyle;
|
||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||
import net.dv8tion.jda.api.components.ModalTopLevelComponent;
|
||||
import net.dv8tion.jda.api.components.label.Label;
|
||||
import net.dv8tion.jda.api.events.interaction.command.GenericCommandInteractionEvent;
|
||||
import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent;
|
||||
import net.dv8tion.jda.api.components.actionrow.ActionRow;
|
||||
import net.dv8tion.jda.api.interactions.components.ItemComponent;
|
||||
import net.dv8tion.jda.api.components.textinput.TextInput;
|
||||
import net.dv8tion.jda.api.interactions.modals.Modal;
|
||||
import net.dv8tion.jda.api.modals.Modal;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -55,29 +55,27 @@ public class ModalServiceBean implements ModalService {
|
||||
.build();
|
||||
}
|
||||
|
||||
private List<ActionRow> convertToActionRows(List<ModalComponent> components) {
|
||||
private List<ModalTopLevelComponent> convertToActionRows(List<ModalComponent> components) {
|
||||
return components
|
||||
.stream()
|
||||
.map(this::convertComponent)
|
||||
.map(ActionRow::of)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private ItemComponent convertComponent(ModalComponent component) {
|
||||
private ModalTopLevelComponent convertComponent(ModalComponent component) {
|
||||
if(component instanceof TextInputComponent) {
|
||||
TextInputComponent tic = (TextInputComponent) component;
|
||||
TextInput.Builder builder = TextInput
|
||||
.create(tic.getId(), tic.getLabel(), TextInputComponentStyle.getStyle(tic.getStyle()));
|
||||
TextInput.Builder tiBuilder = TextInput.create(tic.getId(), TextInputComponentStyle.getStyle(tic.getStyle()));
|
||||
if(tic.getMinLength() != null) {
|
||||
builder.setMinLength(tic.getMinLength());
|
||||
tiBuilder.setMinLength(tic.getMinLength());
|
||||
}
|
||||
if(tic.getMaxLength() != null) {
|
||||
builder.setMaxLength(tic.getMaxLength());
|
||||
tiBuilder.setMaxLength(tic.getMaxLength());
|
||||
}
|
||||
if(tic.getRequired() != null) {
|
||||
builder.setRequired(tic.getRequired());
|
||||
tiBuilder.setRequired(tic.getRequired());
|
||||
}
|
||||
return builder.build();
|
||||
return Label.of(tic.getLabel(), tiBuilder.build());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package dev.sheldan.abstracto.core.repository;
|
||||
|
||||
import dev.sheldan.abstracto.core.models.database.AConfig;
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import java.util.List;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -11,6 +12,7 @@ public interface ConfigRepository extends JpaRepository<AConfig, Long> {
|
||||
|
||||
AConfig findAConfigByServerIdAndNameIgnoreCase(Long serverId, String name);
|
||||
void deleteAConfigByServerId(Long serverId);
|
||||
List<AConfig> findByServerId(Long serverId);
|
||||
|
||||
boolean existsAConfigByServerIdAndNameIgnoreCase(Long serverId, String name);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class BotServiceBean implements BotService {
|
||||
@Autowired
|
||||
private OkHttpLogger okHttpLogger;
|
||||
|
||||
@Value("${abstracto.intents:GUILD_VOICE_STATES,GUILD_MODERATION,MESSAGE_CONTENT,GUILD_EMOJIS_AND_STICKERS,GUILD_MEMBERS,GUILD_MESSAGES,GUILD_MESSAGE_REACTIONS,DIRECT_MESSAGES,GUILD_PRESENCES}")
|
||||
@Value("${abstracto.intents:GUILD_VOICE_STATES,GUILD_MODERATION,MESSAGE_CONTENT,GUILD_EXPRESSIONS,GUILD_MEMBERS,GUILD_MESSAGES,GUILD_MESSAGE_REACTIONS,DIRECT_MESSAGES,GUILD_PRESENCES}")
|
||||
private String[] intents;
|
||||
|
||||
@Value("${abstracto.cacheFlags:ACTIVITY,ONLINE_STATUS,VOICE_STATE}")
|
||||
|
||||
@@ -279,9 +279,9 @@ public class ChannelServiceBean implements ChannelService {
|
||||
server = serverManagementService.loadServer(channel.getGuild());
|
||||
}
|
||||
for (ActionRow row : actionRows) {
|
||||
for (ActionRowChildComponent component : row) {
|
||||
for (ActionRowChildComponent component : row.getComponents()) {
|
||||
if (component instanceof ActionComponent) {
|
||||
String id = ((ActionComponent) component).getId();
|
||||
String id = ((ActionComponent) component).getCustomId();
|
||||
MessageToSend.ComponentConfig payload = messageToSend.getComponentPayloads().get(id);
|
||||
if (payload != null && payload.getPersistCallback()) {
|
||||
componentPayloadManagementService.createPayload(id, payload.getPayload(), payload.getPayloadType(), payload.getComponentOrigin(), server, payload.getComponentType());
|
||||
|
||||
@@ -12,11 +12,11 @@ import dev.sheldan.abstracto.core.utils.FutureUtils;
|
||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.dv8tion.jda.api.components.tree.MessageComponentTree;
|
||||
import net.dv8tion.jda.api.entities.*;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.components.actionrow.ActionRow;
|
||||
import net.dv8tion.jda.api.requests.restaction.AuditableRestAction;
|
||||
import net.dv8tion.jda.api.requests.restaction.MessageEditAction;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -267,14 +267,9 @@ public class MessageServiceBean implements MessageService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> editMessageWithActionRows(Message message, List<ActionRow> rows) {
|
||||
return editMessageWithActionRowsMessage(message, rows).thenApply(message1 -> null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Message> editMessageWithActionRowsMessage(Message message, List<ActionRow> rows) {
|
||||
public CompletableFuture<Message> editMessage(Message message, MessageComponentTree componentTree) {
|
||||
metricService.incrementCounter(MESSAGE_EDIT_METRIC);
|
||||
return message.editMessageComponents(rows).submit();
|
||||
return message.editMessageComponents(componentTree.getComponents()).submit();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,6 +3,7 @@ package dev.sheldan.abstracto.core.service.management;
|
||||
import dev.sheldan.abstracto.core.models.database.AConfig;
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import dev.sheldan.abstracto.core.repository.ConfigRepository;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -98,6 +99,11 @@ public class ConfigManagementServiceBean implements ConfigManagementService {
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AConfig> loadForServer(Long serverId) {
|
||||
return configRepository.findByServerId(serverId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AConfig loadOrCreateIfNotExists(Long serverId, String name, Long value) {
|
||||
AConfig config = loadConfig(serverId, name);
|
||||
|
||||
@@ -2,6 +2,7 @@ package dev.sheldan.abstracto.core.service.management;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.DefaultConfigProperties;
|
||||
import dev.sheldan.abstracto.core.models.property.SystemConfigProperty;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -22,4 +23,9 @@ public class DefaultConfigManagementServiceBean implements DefaultConfigManageme
|
||||
public boolean configKeyExists(String key) {
|
||||
return defaultConfigProperties.getSystemConfigs().containsKey(key.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getConfigKeys() {
|
||||
return defaultConfigProperties.getSystemConfigs().keySet().stream().toList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ import net.dv8tion.jda.api.components.mediagallery.MediaGalleryItem;
|
||||
import net.dv8tion.jda.api.components.section.Section;
|
||||
import net.dv8tion.jda.api.components.section.SectionAccessoryComponent;
|
||||
import net.dv8tion.jda.api.components.section.SectionContentComponent;
|
||||
import net.dv8tion.jda.api.components.selections.SelectMenu;
|
||||
import net.dv8tion.jda.api.components.separator.Separator;
|
||||
import net.dv8tion.jda.api.components.textdisplay.TextDisplay;
|
||||
import net.dv8tion.jda.api.components.thumbnail.Thumbnail;
|
||||
@@ -54,7 +55,6 @@ import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||
import net.dv8tion.jda.api.components.actionrow.ActionRow;
|
||||
import net.dv8tion.jda.api.interactions.components.ItemComponent;
|
||||
import net.dv8tion.jda.api.components.buttons.Button;
|
||||
import net.dv8tion.jda.api.components.selections.EntitySelectMenu;
|
||||
import net.dv8tion.jda.api.components.selections.SelectOption;
|
||||
@@ -449,7 +449,7 @@ public class TemplateServiceBean implements TemplateService {
|
||||
}
|
||||
|
||||
private void addSelectionMenu(List<ActionRow> actionRows, SelectionMenuConfig selectionMenuConfig) {
|
||||
ItemComponent selectionMenu;
|
||||
SelectMenu selectionMenu;
|
||||
if (selectionMenuConfig.getType() == SelectionMenuType.STRING) {
|
||||
List<SelectOption> selectOptions = selectionMenuConfig.getMenuEntries().stream().map(selectionMenuEntry -> {
|
||||
SelectOption option = SelectOption.of(selectionMenuEntry.getLabel(), selectionMenuEntry.getValue());
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<property name="coreFeature" value="(SELECT id FROM feature WHERE key = 'core')"/>
|
||||
<property name="configModule" value="(SELECT id FROM module WHERE name = 'config')"/>
|
||||
<changeSet author="Sheldan" id="getConfig-command" >
|
||||
<insert tableName="command">
|
||||
<column name="name" value="getConfig"/>
|
||||
<column name="module_id" valueComputed="${configModule}"/>
|
||||
<column name="feature_id" valueComputed="${coreFeature}"/>
|
||||
</insert>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
@@ -3,4 +3,5 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="channel_group_types.xml" relativeToChangelogFile="true"/>
|
||||
<include file="command.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user