Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry stuff #99

Merged
merged 3 commits into from
Mar 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/main/kotlin/org/quiltmc/community/_Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import dev.kord.core.entity.channel.GuildMessageChannel
import dev.kord.rest.builder.message.EmbedBuilder
import dev.kord.rest.request.RestRequestException
import kotlinx.coroutines.runBlocking
import mu.KotlinLogging
import org.koin.dsl.bind
import org.quiltmc.community.database.Database
import org.quiltmc.community.database.collections.*
Expand Down Expand Up @@ -131,6 +132,8 @@ suspend fun ExtensibleBotBuilder.database(migrate: Boolean = false) {
}

suspend fun ExtensibleBotBuilder.common() {
val logger = KotlinLogging.logger { }

dataAdapter(::MongoDBDataAdapter)

applicationCommands {
Expand All @@ -140,13 +143,12 @@ suspend fun ExtensibleBotBuilder.common() {

extensions {
sentry {
val sentryDsn = envOrNull("SENTRY_DSN")
val version: String? = object {}::class.java.`package`.implementationVersion

if (sentryDsn != null) {
enable = true
enableIfDSN(envOrNull("SENTRY_DSN"))

dsn = sentryDsn
if (enable) {
logger.info { "Sentry enabled." }
}

if (version != null) {
Expand Down
Loading