mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-01-27 23:09:05 +00:00
[AB-358] upgrading to JDA 5
removal of jda-utils adding message context commands [AB-360] fixing confirmation buttons being triggered by somebody not the author
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>modmail</artifactId>
|
||||
<version>1.3.14-SNAPSHOT</version>
|
||||
<version>1.4.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package dev.sheldan.abstracto.modmail.model.dto;
|
||||
|
||||
import dev.sheldan.abstracto.core.models.FullGuild;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* Used when the user shares multiple servers with the bot and needs to determine for which server the user
|
||||
* wants to open a mod mail thread, this is done by reacting to the prompt with the proper emote.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class ServerChoice {
|
||||
/**
|
||||
* The possible guild to open a mod mail thread for
|
||||
*/
|
||||
private FullGuild guild;
|
||||
/**
|
||||
* The unicode emote used in the prompt to identify this choice
|
||||
*/
|
||||
private String reactionEmote;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package dev.sheldan.abstracto.modmail.model.dto;
|
||||
|
||||
import dev.sheldan.abstracto.modmail.model.template.ServerChoice;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class ServerChoicePayload {
|
||||
private Long serverId;
|
||||
|
||||
public static ServerChoicePayload fromServerChoice(ServerChoice choice) {
|
||||
return ServerChoicePayload
|
||||
.builder()
|
||||
.serverId(choice.getServerId())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package dev.sheldan.abstracto.modmail.model.dto;
|
||||
|
||||
import dev.sheldan.abstracto.core.models.template.button.ButtonPayload;
|
||||
import dev.sheldan.abstracto.modmail.model.template.ServerChoices;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class ServiceChoicesPayload implements ButtonPayload {
|
||||
private Map<String, ServerChoicePayload> choices;
|
||||
private Long userId;
|
||||
private Long messageId;
|
||||
|
||||
public static ServiceChoicesPayload fromServerChoices(ServerChoices choices) {
|
||||
Map<String, ServerChoicePayload> newChoices = new HashMap<>();
|
||||
choices.getCommonGuilds().forEach((s, choice) -> newChoices.put(s, ServerChoicePayload.fromServerChoice(choice)));
|
||||
return ServiceChoicesPayload
|
||||
.builder()
|
||||
.userId(choices.getUserId())
|
||||
.messageId(choices.getMessageId())
|
||||
.choices(newChoices)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package dev.sheldan.abstracto.modmail.model.template;
|
||||
|
||||
import dev.sheldan.abstracto.core.utils.ChannelUtils;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -14,6 +15,10 @@ import net.dv8tion.jda.api.entities.Category;
|
||||
@Setter
|
||||
@Builder
|
||||
public class ModMailCategoryActionModel {
|
||||
private Category category;
|
||||
private Long serverId;
|
||||
private Long categoryId;
|
||||
|
||||
public String getCategoryAsMention() {
|
||||
return ChannelUtils.getAsMention(this.getCategoryId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package dev.sheldan.abstracto.modmail.model.template;
|
||||
|
||||
import dev.sheldan.abstracto.modmail.model.dto.ServerChoice;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Container model used to define all the possible {@link ServerChoice} which are presented when the initial message is
|
||||
* sent to the bot
|
||||
@@ -15,9 +12,5 @@ import java.util.List;
|
||||
@Setter
|
||||
@Builder
|
||||
public class ModMailServerChooserModel {
|
||||
/**
|
||||
* A list of {@link ServerChoice} which contains the common servers of the user and the bot, but only those
|
||||
* in which the mod mail feature is currently enabled
|
||||
*/
|
||||
private List<ServerChoice> commonGuilds;
|
||||
private ServerChoices choices;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package dev.sheldan.abstracto.modmail.model.template;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class ServerChoice {
|
||||
private String serverName;
|
||||
private Long serverId;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package dev.sheldan.abstracto.modmail.model.template;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class ServerChoices {
|
||||
private Map<String, ServerChoice> commonGuilds;
|
||||
private Long userId;
|
||||
private Long messageId;
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package dev.sheldan.abstracto.modmail.model.template;
|
||||
|
||||
import dev.sheldan.abstracto.core.utils.ChannelUtils;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.dv8tion.jda.api.entities.Category;
|
||||
|
||||
/**
|
||||
* Model which is used when setting up the mod mail feature. The category property will be used when there is already a category
|
||||
@@ -13,5 +13,10 @@ import net.dv8tion.jda.api.entities.Category;
|
||||
@Setter
|
||||
@Builder
|
||||
public class SetupModMailCategoryMessageModel {
|
||||
private Category category;
|
||||
private Long serverId;
|
||||
private Long categoryId;
|
||||
|
||||
public String getCategoryAsMention() {
|
||||
return ChannelUtils.getAsMention(this.getCategoryId());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user