public class lo {
public int N;
private final String Ec;
private String co;
private String F;
private String dc;
private boolean T;
private List jc = new ArrayList();
public lo(String url) {
this.Ec = url;
}
public void t(String var1) {
to.co = var1;
}
public void U(String no) {
no.F = no;
}
public void setAvatarUrl(String avatarUrl) {
this.dc = avatarUrl;
}
public void setTts(boolean tts) {
this.T = tts;
}
public void addEmbed(Co embed) {
this.jc.add(embed);
}
public void execute() throws IOException {
if (this.co == null && this.jc.isEmpty()) {
throw new IllegalArgumentException("Set content or add at least one EmbedObject");
} else {
eo json = new eo(this, (ro)null);
json.put("content", this.co);
json.put("username", this.F);
json.put("avatar_url", this.dc);
json.put("tts", this.T);
if (!this.jc.isEmpty()) {
List embedObjects = new ArrayList();
Iterator var3 = this.jc.iterator();
code
while(var3.hasNext()) {
Co embed = (Co)var3.next();
eo jsonEmbed = new eo(this, (ro)null);
jsonEmbed.put("title", embed.getTitle());
jsonEmbed.put("description", embed.getDescription());
jsonEmbed.put("url", embed.getUrl());
if (embed.getColor() != null) {
Color color = embed.getColor();
int rgb = color.getRed();
rgb = (rgb << 8) + color.getGreen();
rgb = (rgb << 8) + color.getBlue();
jsonEmbed.put("color", rgb);
}
no footer = embed.getFooter();
ao image = embed.getImage();
to thumbnail = embed.getThumbnail();
do author = embed.getAuthor();
List<io> fields = embed.getFields();
eo jsonAuthor;
if (footer != null) {
jsonAuthor = new eo(this, (ro)null);
jsonAuthor.put("text", no.l(footer));
jsonAuthor.put("icon_url", no.access$200(footer));
jsonEmbed.put("footer", jsonAuthor);
}
if (image != null) {
jsonAuthor = new eo(this, (ro)null);
jsonAuthor.put("url", ao.E(image));
jsonEmbed.put("image", jsonAuthor);
}
if (thumbnail != null) {
jsonAuthor = new eo(this, (ro)null);
jsonAuthor.put("url", to.C(thumbnail));
jsonEmbed.put("thumbnail", jsonAuthor);
}
if (author != null) {
jsonAuthor = new eo(this, (ro)null);
jsonAuthor.put("name", do.access$500(author));
jsonAuthor.put("url", do.a(author));
jsonAuthor.put("icon_url", do.access$700(author));
jsonEmbed.put("author", jsonAuthor);
}
List<eo> jsonFields = new ArrayList();
Iterator var12 = fields.iterator();
while(var12.hasNext()) {
io field = (io)var12.next();
eo jsonField = new eo(this, (ro)null);
jsonField.put("name", io.access$800(field));
jsonField.put("value", io.access$900(field));
jsonField.put("inline", io.access$1000(field));
jsonFields.add(jsonField);
}
jsonEmbed.put("fields", jsonFields.toArray());
embedObjects.add(jsonEmbed);
}
json.put("embeds", embedObjects.toArray());
}
URL url = new URL(this.Ec);
HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
connection.addRequestProperty("Content-Type", "application/json");
connection.addRequestProperty("User-Agent", "Java-DiscordWebhook-BY-Gelox_");
connection.setDoOutput(true);
connection.setRequestMethod("POST");
OutputStream stream = connection.getOutputStream();
stream.write(json.toString().getBytes(StandardCharsets.UTF_8));
stream.flush();
stream.close();
connection.getInputStream().close();
connection.disconnect();
}