Skip to content

Commit

Permalink
Fix error occurring when trying to broadcast Sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Nov 21, 2023
1 parent b7de854 commit 89369b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ public data class Sound(
@SerialName("twemoji")
public data class Twemoji(
val value: String,
val codePoints: @Serializable(with = SequenceSerializer::class) Sequence<Int>,
val codePoints: List<Int>,
val length: Int
) : Emoji, Emoji.HasUrl {
override val url: String
get() {
val name = formatEmojiUnicode(codePoints, length)
val name = formatEmojiUnicode(codePoints.asSequence(), length)
return "https://cdn.jsdelivr.net/gh/twitter/[email protected]/assets/72x72/$name.png"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package dev.schlaubi.tonbrett.common.util

import dev.schlaubi.tonbrett.common.Sound
import dev.schlaubi.tonbrett.common.SoundGroup
import kotlin.streams.asSequence
import kotlin.streams.toList

@Suppress("USELESS_CAST") // IntelliJ is weird here
private fun Sound.DiscordEmoji.toTwemoji(): Sound.Twemoji =
Sound.Twemoji(value, (value as String).codePoints().asSequence(), value.length)
Sound.Twemoji(value, (value as String).codePoints().toList(), value.length)

/**
* Converts this emoji to contain information needed on non JVM Platforms.
Expand Down

0 comments on commit 89369b9

Please sign in to comment.