Skip to content

Commit

Permalink
Fixed formatting issues that caused the regex to not work
Browse files Browse the repository at this point in the history
  • Loading branch information
Taubsie committed Jun 8, 2024
1 parent 0bac372 commit b039190
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions core/src/commonMain/kotlin/Kord.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,18 @@ import kotlinx.coroutines.channels.Channel as CoroutineChannel
public val kordLogger: mu.KLogger = mu.KotlinLogging.logger { }

private val logger = KotlinLogging.logger { }
private val messageLinkRegex = """(?x) # enable comments
| (?i) # allow ignore case
| (?:https?+://)?+ # https:// (or also http:// or an empty string)
| (?:(?:canary|ptb)\\.)?+ # canary. or ptb.
| discord(?:app)?+\\.com/channels/ # discord(app).com/channels/
| (?:(?<server>[0-9]++)|@me) # @me or the server id
| / # '/'
| (?<channel>[0-9]++) # the channel id (should only be a message channel)
| / # '/'
| (?<message>[0-9]++) # the message id
| """.trimMargin().toRegex()
private val messageLinkRegex = """
|(?x) # enable comments
|(?i) # allow ignore case
|(?:https?+://)?+ # https:// (or also http:// or an empty string)
|(?:(?:canary|ptb)\.)?+ # canary. or ptb.
|discord(?:app)?+\.com/channels/ # discord(app).com/channels/
|(?:(?<server>[0-9]++)|@me) # @me or the server id
|/ # '/'
|(?<channel>[0-9]++) # the channel id (should only be a message channel)
|/ # '/'
|(?<message>[0-9]++) # the message id
""".trimMargin().toRegex()

@PublishedApi
internal fun logCaughtThrowable(throwable: Throwable): Unit = logger.catching(throwable)
Expand Down

0 comments on commit b039190

Please sign in to comment.