mirror of
https://github.com/DreamExposure/DisCal-Discord-Bot.git
synced 2026-05-24 12:09:07 -05:00
Messing with formatting and logic
This commit is contained in:
+3
-2
@@ -65,8 +65,9 @@ object CalendarEmbed : EmbedMaker {
|
||||
.append(" - ")
|
||||
.append(it.end.asDiscordTimestamp(DiscordTimestampFormat.SHORT_TIME))
|
||||
.append(" | ")
|
||||
if (it.name.isNotBlank()) content.append("`${it.name}`").append(" | ")
|
||||
content.append("`${it.eventId}`").append("\n")
|
||||
if (it.name.isNotBlank()) content.append(it.name).append(" | ")
|
||||
else content.append(getMessage("calendar", "link.field.id", settings)).append(" ${it.eventId}")
|
||||
content.append(it.eventId).append("\n")
|
||||
}
|
||||
|
||||
builder.addField(fieldTitle, content.toString(), false)
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.dreamexposure.discal.core.extensions
|
||||
|
||||
import org.dreamexposure.discal.core.entities.Event
|
||||
import java.time.ZonedDateTime
|
||||
import java.time.temporal.ChronoUnit
|
||||
import java.time.temporal.TemporalAdjusters
|
||||
import java.util.stream.Collectors
|
||||
|
||||
@@ -23,7 +24,7 @@ fun MutableList<String>.asStringList(): String {
|
||||
fun MutableList<Event>.groupByDate(): Map<ZonedDateTime, List<Event>> {
|
||||
return this.stream()
|
||||
.collect(Collectors.groupingBy {
|
||||
ZonedDateTime.ofInstant(it.start, it.timezone)
|
||||
ZonedDateTime.ofInstant(it.start, it.timezone).truncatedTo(ChronoUnit.DAYS)
|
||||
.with(TemporalAdjusters.ofDateAdjuster { identity -> identity })
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user