Skip to content

Commit

Permalink
remove sqldelight
Browse files Browse the repository at this point in the history
  • Loading branch information
NikkyAI committed Oct 21, 2023
1 parent 1a650fb commit de33e9a
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 578 deletions.
29 changes: 0 additions & 29 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
@file:Suppress("GradlePackageUpdate")

import de.fayard.refreshVersions.core.versionFor


plugins {
kotlin("jvm")
kotlin("plugin.serialization")
id("com.google.devtools.ksp")
id("com.github.johnrengelman.shadow")
id("app.cash.sqldelight")
application
}

Expand All @@ -25,10 +21,6 @@ repositories {
maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
name = "Sonatype Snapshots"
}

// maven(url = "https://maven.kotlindiscord.com/repository/maven-public/") {
// name = "Kotlin Discord"
// }
}

application {
Expand All @@ -45,7 +37,6 @@ kotlin {
}

dependencies {
// implementation("dev.kord:kord-core:_")
implementation("com.kotlindiscord.kord.extensions:kord-extensions:_")
implementation("com.kotlindiscord.kord.extensions:annotations:_")
implementation("com.kotlindiscord.kord.extensions:extra-phishing:_")
Expand All @@ -66,16 +57,9 @@ dependencies {

implementation(KotlinX.coroutines.core)
implementation(KotlinX.coroutines.debug)
// implementation(KotlinX.serialization.json)

implementation("br.com.colman:dice-helper:_")

implementation("app.cash.sqldelight:sqlite-driver:_")
implementation("app.cash.sqldelight:primitive-adapters:_")
implementation("app.cash.sqldelight:coroutines-extensions:_")

// implementation(Square.okio)

implementation("io.klogging:klogging-jvm:_")
implementation("io.klogging:slf4j-klogging:_")

Expand All @@ -96,19 +80,6 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
}
}

sqldelight {
databases {
create("DiscordbotDatabase") {
packageName.set("moe.nikky.db")
// generateAsync.set(true)
deriveSchemaFromMigrations.set(true)
schemaOutputDirectory.set(file("src/main/sqldelight/databases"))
dialect("app.cash.sqldelight:sqlite-3-38-dialect:${versionFor("version.app.cash.sqldelight")}")
verifyMigrations.set(true)
}
}
}

tasks {
test {
useJUnitPlatform()
Expand Down
26 changes: 0 additions & 26 deletions src/main/kotlin/moe/nikky/ConfigurationExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSub
import com.kotlindiscord.kord.extensions.commands.converters.impl.role
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
import com.kotlindiscord.kord.extensions.extensions.event
import com.kotlindiscord.kord.extensions.storage.Data
import com.kotlindiscord.kord.extensions.storage.StorageType
import com.kotlindiscord.kord.extensions.storage.StorageUnit
Expand All @@ -20,16 +19,13 @@ import dev.kord.common.entity.Snowflake
import dev.kord.core.behavior.GuildBehavior
import dev.kord.core.entity.Role
import dev.kord.core.event.Event
import dev.kord.core.event.guild.GuildCreateEvent
import dev.kord.core.event.interaction.InteractionCreateEvent
import io.github.xn32.json5k.SerialComment
import io.klogging.Klogging
import kotlinx.serialization.Serializable
import moe.nikky.checks.anyCheck
import moe.nikky.checks.hasRoleNullable
import moe.nikky.db.DiscordbotDatabase
import net.peanuuutz.tomlkt.TomlComment
import org.koin.core.component.inject
import org.koin.dsl.module
import java.util.*

Expand Down Expand Up @@ -112,14 +108,6 @@ class ConfigurationExtension : Extension(), Klogging {
}
}
}

event<GuildCreateEvent> {
action {
if(event.guild.config().get() == null) {
convertConfig(event.guild)
}
}
}
}

suspend fun CheckContext<InteractionCreateEvent>.requiresBotControl() {
Expand Down Expand Up @@ -151,20 +139,6 @@ class ConfigurationExtension : Extension(), Klogging {
}
}

private suspend fun convertConfig(guild: GuildBehavior) {
val database: DiscordbotDatabase by inject()
val guildConfig = database.guildConfigQueries.get(guild.id).executeAsOne()

val adminRole = guildConfig.adminRole(guild)

guild.config().save(
GuildConfig(
adminRole = adminRole?.id,
adminRoleName = adminRole?.name
)
)
}

suspend fun loadConfig(guild: GuildBehavior): GuildConfig? {
return guild.config().get()
}
Expand Down
145 changes: 0 additions & 145 deletions src/main/kotlin/moe/nikky/DBExtensions.kt

This file was deleted.

Loading

0 comments on commit de33e9a

Please sign in to comment.