From b6bec2630492212b1957dd637285256b3030fee4 Mon Sep 17 00:00:00 2001 From: NovaFox161 Date: Tue, 10 Dec 2024 00:12:42 -0600 Subject: [PATCH] Attempting to fix the double @ announcement bug yet again --- .../dreamexposure/discal/core/object/new/Announcement.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/org/dreamexposure/discal/core/object/new/Announcement.kt b/core/src/main/kotlin/org/dreamexposure/discal/core/object/new/Announcement.kt index 9bf30c88..3f02ccd3 100644 --- a/core/src/main/kotlin/org/dreamexposure/discal/core/object/new/Announcement.kt +++ b/core/src/main/kotlin/org/dreamexposure/discal/core/object/new/Announcement.kt @@ -18,7 +18,7 @@ data class Announcement( val channelId: Snowflake, - val subscribers: Subscribers = Subscribers(), + val subscribers: Subscribers = Subscribers(guildId = guildId), val eventId: String? = null, val eventColor: EventColor = EventColor.NONE, @@ -41,6 +41,7 @@ data class Announcement( subscribers = Subscribers( roles = data.subscribersRole.asStringListFromDatabase().toSet(), users = data.subscribersUser.asStringListFromDatabase().map(Snowflake::of).toSet(), + guildId = data.guildId.asSnowflake(), ), eventId = if (data.eventId.isBlank() || data.eventId.equals("N/a", ignoreCase = true)) null else data.eventId, eventColor = EventColor.fromNameOrHexOrId(data.eventColor), @@ -62,6 +63,7 @@ data class Announcement( data class Subscribers( val roles: Set = setOf(), val users: Set = setOf(), + val guildId: Snowflake, ) { fun buildMentions(): String { if (users.isEmpty() && roles.isEmpty()) return "" @@ -69,7 +71,7 @@ data class Announcement( val userMentions = users.map { "<@${it.asLong()}> " } val roleMentions = roles.map { - if (it.equals("everyone", true)) "@everyone " + if (it.equals("everyone", true)) "<@&${guildId.asString()}> " else if (it.equals("here", true)) "@here " else "<@&$it> " }