Skip to content

Commit

Permalink
Only include first line when relaying replies to IRC
Browse files Browse the repository at this point in the history
  • Loading branch information
randomnetcat committed Mar 22, 2024
1 parent c07175a commit 3aea4c2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/kotlin/org/randomcat/agorabot/irc/IrcEndpoint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ private suspend fun IrcChannel.sendDiscordMessage(message: DiscordMessage) {
val replySection = run {
if (referencedMessage != null) {
val replyName = referencedMessage.retrieveEffectiveSenderName().await()
"In response to $replyName saying: ${formatRelayDiscordContent(referencedMessage.contentDisplay)}\n"
val cleanContent = formatRelayDiscordContent(referencedMessage.contentDisplay)

val contentLines = cleanContent.lines()
val ellipsis = if (contentLines.size > 1) "..." else ""

"In response to $replyName saying: ${contentLines.first()}$ellipsis\n"
} else {
""
}
Expand Down

0 comments on commit 3aea4c2

Please sign in to comment.