Clean up playerscouter disc (aim at specific uses, instead of general) (#1806)
This commit is contained in:
@@ -61,49 +61,20 @@ public class DiscordEmbed
|
||||
VideoEmbed video;
|
||||
ProviderEmbed provider;
|
||||
AuthorEmbed author;
|
||||
@Builder.Default
|
||||
List<FieldEmbed> fields = new ArrayList<>();
|
||||
final List<FieldEmbed> fields = new ArrayList<>();
|
||||
|
||||
public DiscordEmbed()
|
||||
public DiscordEmbed(AuthorEmbed author, ThumbnailEmbed thumb, String description, FooterEmbed footer, String color, List<FieldEmbed> fields)
|
||||
{
|
||||
|
||||
this.author = author;
|
||||
this.thumbnail = thumb;
|
||||
this.description = description;
|
||||
this.footer = footer;
|
||||
this.color = color;
|
||||
this.fields.addAll(fields);
|
||||
}
|
||||
|
||||
public DiscordEmbed(String title, String description)
|
||||
public DiscordMessage toDiscordMessage(String username, String content, String avatarUrl)
|
||||
{
|
||||
this(title, description, null);
|
||||
}
|
||||
|
||||
public DiscordEmbed(String title, String description, String url)
|
||||
{
|
||||
setTitle(title);
|
||||
setDescription(description);
|
||||
setUrl(url);
|
||||
}
|
||||
|
||||
public static DiscordMessage toDiscordMessage(DiscordEmbed embed, String username, String avatarURL)
|
||||
{
|
||||
return DiscordMessage.builder()
|
||||
.username(username)
|
||||
.avatarUrl(avatarURL)
|
||||
.content("")
|
||||
.embed(embed)
|
||||
.build();
|
||||
}
|
||||
|
||||
public DiscordMessage toDiscordMessage(String username, String avatarUrl)
|
||||
{
|
||||
return DiscordEmbed.toDiscordMessage(this, username, avatarUrl);
|
||||
}
|
||||
|
||||
public static class DiscordEmbedBuilder
|
||||
{
|
||||
List<FieldEmbed> fields = new ArrayList<>();
|
||||
|
||||
public DiscordEmbedBuilder field(FieldEmbed field)
|
||||
{
|
||||
fields.add(field);
|
||||
return this;
|
||||
}
|
||||
return new DiscordMessage(username, content, avatarUrl, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,16 +29,12 @@ package net.runelite.http.api.discord;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
public class DiscordMessage
|
||||
{
|
||||
@@ -48,24 +44,14 @@ public class DiscordMessage
|
||||
String avatarUrl;
|
||||
@SerializedName("tts")
|
||||
boolean textToSpeech;
|
||||
List<DiscordEmbed> embeds = new ArrayList<>();
|
||||
final List<DiscordEmbed> embeds = new ArrayList<>();
|
||||
|
||||
public DiscordMessage()
|
||||
DiscordMessage(String username, String content, String avatar_url, DiscordEmbed embed)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DiscordMessage(String username, String content, String avatar_url)
|
||||
{
|
||||
this(username, content, avatar_url, false);
|
||||
}
|
||||
|
||||
public DiscordMessage(String username, String content, String avatar_url, boolean tts)
|
||||
{
|
||||
setUsername(username);
|
||||
setContent(content);
|
||||
setAvatarUrl(avatar_url);
|
||||
setTextToSpeech(tts);
|
||||
this.username = username;
|
||||
this.content = content;
|
||||
this.avatarUrl = avatar_url;
|
||||
this.embeds.add(embed);
|
||||
}
|
||||
|
||||
public void setUsername(String username)
|
||||
@@ -79,15 +65,4 @@ public class DiscordMessage
|
||||
this.username = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class DiscordMessageBuilder
|
||||
{
|
||||
List<DiscordEmbed> embeds = new ArrayList<>();
|
||||
|
||||
public DiscordMessageBuilder embed(DiscordEmbed embed)
|
||||
{
|
||||
embeds.add(embed);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -586,7 +586,6 @@ public class PlayerScouter extends Plugin
|
||||
|
||||
message(name, icon, image, fieldList, color);
|
||||
player.setScouted(true);
|
||||
fieldList.clear();
|
||||
}
|
||||
|
||||
private void message(String name, String iconUrl, ThumbnailEmbed thumbnail, List<FieldEmbed> fields, String color)
|
||||
@@ -602,25 +601,24 @@ public class PlayerScouter extends Plugin
|
||||
|
||||
final Date currentTime = new Date(System.currentTimeMillis());
|
||||
|
||||
DiscordEmbed discordEmbed = DiscordEmbed.builder()
|
||||
.author(AuthorEmbed.builder()
|
||||
DiscordEmbed discordEmbed = new DiscordEmbed(
|
||||
AuthorEmbed.builder()
|
||||
.icon_url(iconUrl)
|
||||
.name(name)
|
||||
.build())
|
||||
.thumbnail(thumbnail)
|
||||
.description(" ")
|
||||
.fields(fields)
|
||||
.footer(FooterEmbed.builder()
|
||||
.build(),
|
||||
thumbnail,
|
||||
" ",
|
||||
FooterEmbed.builder()
|
||||
.icon_url("https://raw.githubusercontent.com/runelite/runelite/master/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/ultimate_ironman.png")
|
||||
.text("Gabon Scouter | Time: " + SDF.format(currentTime))
|
||||
.build())
|
||||
.color(color)
|
||||
.build();
|
||||
.build(),
|
||||
color,
|
||||
fields
|
||||
);
|
||||
|
||||
DiscordMessage discordMessage = discordEmbed.toDiscordMessage("Gabon Scouter", " ", "https://i.imgur.com/2A6dr7q.png");
|
||||
|
||||
DiscordMessage discordMessage = new DiscordMessage("Gabon Scouter", " ", "https://i.imgur.com/2A6dr7q.png");
|
||||
discordMessage.getEmbeds().add(discordEmbed);
|
||||
DISCORD_CLIENT.message(this.webhook, discordMessage);
|
||||
fields.clear();
|
||||
}
|
||||
|
||||
private String location(PlayerContainer player)
|
||||
|
||||
Reference in New Issue
Block a user