diff --git a/CHANGELOG.md b/CHANGELOG.md index 07cf37b8..5bc7a009 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Unreleased +- Minor: Remove boss image embed from kill count notifications with screenshots disabled. (#578) + ## 1.10.12 - Minor: Add rarity information on select pickpocketing drops. (#571) diff --git a/src/main/java/dinkplugin/notifiers/KillCountNotifier.java b/src/main/java/dinkplugin/notifiers/KillCountNotifier.java index 56b7489f..20e3b2a8 100644 --- a/src/main/java/dinkplugin/notifiers/KillCountNotifier.java +++ b/src/main/java/dinkplugin/notifiers/KillCountNotifier.java @@ -1,9 +1,7 @@ package dinkplugin.notifiers; -import dinkplugin.message.Embed; import dinkplugin.message.templating.Replacements; import dinkplugin.message.templating.Template; -import dinkplugin.util.ItemUtils; import dinkplugin.util.KillCountService; import dinkplugin.util.TimeUtils; import dinkplugin.util.Utils; @@ -11,8 +9,6 @@ import dinkplugin.message.NotificationType; import dinkplugin.notifiers.data.BossNotificationData; import lombok.extern.slf4j.Slf4j; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; import net.runelite.api.Varbits; import net.runelite.api.annotations.Varbit; import net.runelite.api.events.WidgetLoaded; @@ -25,9 +21,6 @@ import javax.inject.Singleton; import java.time.Duration; -import java.util.Arrays; -import java.util.Collections; -import java.util.Objects; import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; @@ -144,34 +137,13 @@ private void handleKill(BossNotificationData data) { .replacement("%TIME%", Replacements.ofText(time)) .build(); - // Prepare body - NotificationBody.NotificationBodyBuilder body = - NotificationBody.builder() - .text(content) - .extra(data) - .playerName(player) - .type(NotificationType.KILL_COUNT); - - // Add embed if not screenshotting - boolean screenshot = config.killCountSendImage(); - if (!screenshot && config.discordRichEmbeds()) { - if (ba) { - body.embeds(Collections.singletonList(Embed.ofImage(ItemUtils.getNpcImageUrl(NpcID.PENANCE_QUEEN)))); - } else { - Arrays.stream(client.getCachedNPCs()) - .filter(Objects::nonNull) - .filter(npc -> data.getBoss().equalsIgnoreCase(npc.getName())) - .findAny() - .map(NPC::getId) - .map(ItemUtils::getNpcImageUrl) - .map(Embed::ofImage) - .map(Collections::singletonList) - .ifPresent(body::embeds); - } - } - // Call webhook - createMessage(screenshot, body.build()); + createMessage(config.killCountSendImage(), NotificationBody.builder() + .text(content) + .extra(data) + .playerName(player) + .type(NotificationType.KILL_COUNT) + .build()); } private boolean checkKillInterval(int killCount, @Nullable Boolean pb) { diff --git a/src/test/java/dinkplugin/notifiers/KillCountNotifierTest.java b/src/test/java/dinkplugin/notifiers/KillCountNotifierTest.java index c63995a4..f73283ff 100644 --- a/src/test/java/dinkplugin/notifiers/KillCountNotifierTest.java +++ b/src/test/java/dinkplugin/notifiers/KillCountNotifierTest.java @@ -1,16 +1,13 @@ package dinkplugin.notifiers; import com.google.inject.testing.fieldbinder.Bind; -import dinkplugin.message.Embed; import dinkplugin.message.templating.Replacements; import dinkplugin.message.templating.Template; -import dinkplugin.util.ItemUtils; import dinkplugin.util.TimeUtils; import dinkplugin.message.NotificationBody; import dinkplugin.message.NotificationType; import dinkplugin.notifiers.data.BossNotificationData; import net.runelite.api.NPC; -import net.runelite.api.NpcID; import net.runelite.api.Varbits; import net.runelite.api.events.WidgetLoaded; import net.runelite.api.widgets.ComponentID; @@ -22,7 +19,6 @@ import org.mockito.InjectMocks; import java.time.Duration; -import java.util.Collections; import java.util.stream.IntStream; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; @@ -479,7 +475,6 @@ void testNotifyBarbarianAssault() { .extra(new BossNotificationData(boss, count, "The Queen is dead!", null, null)) .playerName(PLAYER_NAME) .type(NotificationType.KILL_COUNT) - .embeds(Collections.singletonList(Embed.ofImage(ItemUtils.getNpcImageUrl(NpcID.PENANCE_QUEEN)))) .build() ); }