forked from Fascinated/Bat
impl welcomer feature
This commit is contained in:
@ -0,0 +1,50 @@
|
||||
package cc.fascinated.bat.features.welcomer;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
|
||||
/**
|
||||
* @author Fascinated (fascinated7)
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
public class WelcomerEmbed {
|
||||
/**
|
||||
* The title of the embed
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* The description of the embed
|
||||
*/
|
||||
@NonNull private String description;
|
||||
|
||||
/**
|
||||
* The color of the embed
|
||||
*/
|
||||
@NonNull private String color;
|
||||
|
||||
/**
|
||||
* Should we ping the user before sending the message?
|
||||
*/
|
||||
private boolean pingBeforeSend;
|
||||
|
||||
/**
|
||||
* Builds the embed and replaces the placeholders
|
||||
*
|
||||
* @return The built embed
|
||||
*/
|
||||
public EmbedBuilder buildEmbed(Object... replacements) {
|
||||
EmbedBuilder embedBuilder = new EmbedBuilder();
|
||||
if (title != null) {
|
||||
embedBuilder.setTitle(WelcomerPlaceholders.replaceAllPlaceholders(title, replacements));
|
||||
}
|
||||
embedBuilder.setDescription(WelcomerPlaceholders.replaceAllPlaceholders(description, replacements));
|
||||
embedBuilder.setColor(Integer.parseInt(color, 16));
|
||||
return embedBuilder;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user