Skip to content

Commit

Permalink
update kordex
Browse files Browse the repository at this point in the history
  • Loading branch information
NikkyAI committed Sep 4, 2024
1 parent e74be6b commit e963cb8
Show file tree
Hide file tree
Showing 24 changed files with 388 additions and 446 deletions.
64 changes: 24 additions & 40 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
@file:Suppress("GradlePackageUpdate")

import dev.kordex.gradle.plugins.kordex.DataCollection


plugins {
kotlin("jvm")
kotlin("plugin.serialization")
id("com.google.devtools.ksp")
id("com.github.johnrengelman.shadow")
application
id("dev.kordex.gradle.kordex")
}

group = "moe.nikky"
version = "1.0-SNAPSHOT"

repositories {
google()
mavenCentral()

maven(url = "https://oss.sonatype.org/content/repositories/snapshots") {
name = "Sonatype Snapshots (Legacy)"
}
maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
name = "Sonatype Snapshots"
}
// google()
// mavenCentral()
}

application {
mainClass.set("moe.nikky.MainKt")
kordEx {
bot {
mainClass.set("moe.nikky.MainKt")
processDotEnv.set(true)
voice.set(false)
dataCollection.set(DataCollection.None)
}
addDependencies.set(true)
addRepositories.set(true)
// kordVersion.set("latest")
// kordExVersion.set("latest")
// module("extra-phishing")
// module("extra-pluralkit")
}

kotlin {
Expand All @@ -37,18 +43,16 @@ kotlin {
}

dependencies {
implementation("com.kotlindiscord.kord.extensions:kord-extensions:_")
implementation("com.kotlindiscord.kord.extensions:annotations:_")
implementation("com.kotlindiscord.kord.extensions:extra-phishing:_")
implementation("com.kotlindiscord.kord.extensions:extra-pluralkit:_")
ksp("com.kotlindiscord.kord.extensions:annotation-processor:_")
// implementation("com.kotlindiscord.kord.extensions:kord-extensions:_")
// implementation("com.kotlindiscord.kord.extensions:annotations:_")
// implementation("com.kotlindiscord.kord.extensions:extra-phishing:_")
// implementation("com.kotlindiscord.kord.extensions:extra-pluralkit:_")
// ksp("com.kotlindiscord.kord.extensions:annotation-processor:_")

// implementation("dev.kord:kord-core:_")

implementation("dev.kord.x:emoji:_")

// implementation("dev.kord.cache:cache-map:_")

implementation("org.jetbrains.kotlinx:kotlinx-datetime:_")

implementation(KotlinX.serialization.json)
Expand All @@ -65,28 +69,8 @@ dependencies {

implementation("io.ktor:ktor-client-logging:_")
implementation("org.slf4j:slf4j-api:_")

testImplementation(Testing.Junit.jupiter.api)
testRuntimeOnly(Testing.Junit.jupiter.engine)
}

java {
// sourceCompatibility = JavaVersion.VERSION_16
// targetCompatibility = JavaVersion.VERSION_16
}

//tasks.named("compileKotlin", org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask::class.java) {
// compilerOptions {
// freeCompilerArgs.add("-Xexport-kdoc")
// }
//}

//tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask> {
// compilerOptions {
// jvmTarget = "16"
// }
//}

tasks {
test {
useJUnitPlatform()
Expand Down
7 changes: 7 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ pluginManagement {

plugins {
id("com.gradle.develocity") version "3.17"
//// # available:"3.17.1"
//// # available:"3.17.2"
//// # available:"3.17.3"
//// # available:"3.17.4"
//// # available:"3.17.5"
//// # available:"3.17.6"
//// # available:"3.18"
id("de.fayard.refreshVersions") version "0.60.5"
}

Expand Down
14 changes: 7 additions & 7 deletions src/main/kotlin/moe/nikky/BotInfoExtension.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package moe.nikky

import com.kotlindiscord.kord.extensions.DISCORD_FUCHSIA
import com.kotlindiscord.kord.extensions.DISCORD_GREEN
import com.kotlindiscord.kord.extensions.commands.Arguments
import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand
import com.kotlindiscord.kord.extensions.commands.converters.impl.role
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
import dev.kordex.core.DISCORD_FUCHSIA
import dev.kordex.core.DISCORD_GREEN
import dev.kordex.core.commands.Arguments
import dev.kordex.core.commands.application.slash.ephemeralSubCommand
import dev.kordex.core.commands.converters.impl.role
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.ephemeralSlashCommand
import dev.kord.common.entity.Permission
import dev.kord.common.entity.Permissions
import dev.kord.rest.builder.message.embed
Expand Down
26 changes: 13 additions & 13 deletions src/main/kotlin/moe/nikky/ConfigurationExtension.kt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package moe.nikky

import com.kotlindiscord.kord.extensions.checks.guildFor
import com.kotlindiscord.kord.extensions.checks.hasPermission
import com.kotlindiscord.kord.extensions.checks.types.CheckContext
import com.kotlindiscord.kord.extensions.commands.Arguments
import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand
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.storage.Data
import com.kotlindiscord.kord.extensions.storage.StorageType
import com.kotlindiscord.kord.extensions.storage.StorageUnit
import com.kotlindiscord.kord.extensions.utils.getLocale
import com.kotlindiscord.kord.extensions.utils.translate
import dev.kordex.core.checks.guildFor
import dev.kordex.core.checks.hasPermission
import dev.kordex.core.checks.types.CheckContext
import dev.kordex.core.commands.Arguments
import dev.kordex.core.commands.application.slash.ephemeralSubCommand
import dev.kordex.core.commands.converters.impl.role
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.ephemeralSlashCommand
import dev.kordex.core.storage.Data
import dev.kordex.core.storage.StorageType
import dev.kordex.core.storage.StorageUnit
import dev.kordex.core.utils.getLocale
import dev.kordex.core.utils.translate
import dev.kord.common.entity.Permission
import dev.kord.common.entity.Snowflake
import dev.kord.core.behavior.GuildBehavior
Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/moe/nikky/DiceExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import br.com.colman.dicehelper.DiceNotation
import br.com.colman.dicehelper.FixedDice
import br.com.colman.dicehelper.RandomDice
import br.com.colman.dicehelper.diceNotation
import com.kotlindiscord.kord.extensions.commands.Arguments
import com.kotlindiscord.kord.extensions.commands.converters.impl.string
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
import dev.kordex.core.commands.Arguments
import dev.kordex.core.commands.converters.impl.string
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.publicSlashCommand
import io.klogging.Klogging

class DiceExtension() : Extension(), Klogging {
Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/moe/nikky/Json5DataAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

package moe.nikky

import com.kotlindiscord.kord.extensions.storage.Data
import com.kotlindiscord.kord.extensions.storage.DataAdapter
import com.kotlindiscord.kord.extensions.storage.StorageUnit
import com.kotlindiscord.kord.extensions.storage.storageFileRoot
import dev.kordex.core.storage.Data
import dev.kordex.core.storage.DataAdapter
import dev.kordex.core.storage.StorageUnit
import dev.kordex.core.storage.storageFileRoot
import io.github.xn32.json5k.Json5
import java.io.File
import java.nio.file.Path
Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/moe/nikky/JsonDataAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

package moe.nikky

import com.kotlindiscord.kord.extensions.storage.Data
import com.kotlindiscord.kord.extensions.storage.DataAdapter
import com.kotlindiscord.kord.extensions.storage.StorageUnit
import com.kotlindiscord.kord.extensions.storage.storageFileRoot
import dev.kordex.core.storage.Data
import dev.kordex.core.storage.DataAdapter
import dev.kordex.core.storage.StorageUnit
import dev.kordex.core.storage.storageFileRoot
import kotlinx.serialization.json.Json
import java.io.File
import java.nio.file.Path
Expand Down
54 changes: 24 additions & 30 deletions src/main/kotlin/moe/nikky/KloggingExt.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package moe.nikky

import com.kotlindiscord.kord.extensions.extensions.Extension
import dev.kordex.core.extensions.Extension
import dev.kord.core.behavior.GuildBehavior
import dev.kord.core.entity.Guild
import dev.kord.core.entity.channel.GuildChannel
Expand All @@ -26,38 +26,32 @@ import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import java.io.File

val DOCKER_RENDERER: RenderString = object: RenderString {
override fun invoke(e: LogEvent): String {
val loggerOrFile = e.items["file"] ?: e.logger
val message = "${e.level.colour5} $loggerOrFile : ${e.evalTemplate()}"
val cleanedItems = e.items - "file"
val maybeItems = if (cleanedItems.isNotEmpty()) " : $cleanedItems" else ""
val maybeStackTrace = if (e.stackTrace != null) "\n${e.stackTrace}" else ""
return message + maybeItems + maybeStackTrace
}
val DOCKER_RENDERER: RenderString = RenderString { e ->
val loggerOrFile = e.items["file"] ?: e.logger
val message = "${e.level.colour5} $loggerOrFile : ${e.evalTemplate()}"
val cleanedItems = e.items - "file"
val maybeItems = if (cleanedItems.isNotEmpty()) " : $cleanedItems" else ""
val maybeStackTrace = if (e.stackTrace != null) "\n${e.stackTrace}" else ""
message + maybeItems + maybeStackTrace
}

val CUSTOM_RENDERER: RenderString = object: RenderString {
override fun invoke(e: LogEvent): String {
val loggerOrFile = e.items["file"]?.let { ".($it)" } ?: e.logger
val time = e.timestamp.localString.substring(0..22)
val message = "$time ${e.level} $loggerOrFile : ${e.evalTemplate()}"
val cleanedItems = e.items - "file"
val maybeItems = if (cleanedItems.isNotEmpty()) " : $cleanedItems" else ""
val maybeStackTrace = if (e.stackTrace != null) "\n${e.stackTrace}" else ""
return message + maybeItems + maybeStackTrace
}
val CUSTOM_RENDERER: RenderString = RenderString { e ->
val loggerOrFile = e.items["file"]?.let { ".($it)" } ?: e.logger
val time = e.timestamp.localString.substring(0..22)
val message = "$time ${e.level} $loggerOrFile : ${e.evalTemplate()}"
val cleanedItems = e.items - "file"
val maybeItems = if (cleanedItems.isNotEmpty()) " : $cleanedItems" else ""
val maybeStackTrace = if (e.stackTrace != null) "\n${e.stackTrace}" else ""
message + maybeItems + maybeStackTrace
}
val CUSTOM_RENDERER_ANSI: RenderString = object: RenderString {
override fun invoke(e: LogEvent): String {
val loggerOrFile = e.items["file"]?.let { ".($it)" } ?: e.logger
val time = e.timestamp.localString.substring(0..22)
val message = "$time ${e.level.colour5} $loggerOrFile : ${e.evalTemplate()}"
val cleanedItems = e.items - "file"
val maybeItems = if (cleanedItems.isNotEmpty()) " : $cleanedItems" else ""
val maybeStackTrace = if (e.stackTrace != null) "\n${e.stackTrace}" else ""
return message + maybeItems + maybeStackTrace
}
val CUSTOM_RENDERER_ANSI: RenderString = RenderString { e ->
val loggerOrFile = e.items["file"]?.let { ".($it)" } ?: e.logger
val time = e.timestamp.localString.substring(0..22)
val message = "$time ${e.level.colour5} $loggerOrFile : ${e.evalTemplate()}"
val cleanedItems = e.items - "file"
val maybeItems = if (cleanedItems.isNotEmpty()) " : $cleanedItems" else ""
val maybeStackTrace = if (e.stackTrace != null) "\n${e.stackTrace}" else ""
message + maybeItems + maybeStackTrace
}

//fun logFile(file: File, append: Boolean = false): SendString {
Expand Down
22 changes: 11 additions & 11 deletions src/main/kotlin/moe/nikky/LocalTimeExtension.kt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package moe.nikky

import com.kotlindiscord.kord.extensions.commands.Arguments
import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand
import com.kotlindiscord.kord.extensions.commands.converters.impl.string
import com.kotlindiscord.kord.extensions.commands.converters.impl.user
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
import com.kotlindiscord.kord.extensions.extensions.ephemeralUserCommand
import com.kotlindiscord.kord.extensions.storage.Data
import com.kotlindiscord.kord.extensions.storage.StorageType
import com.kotlindiscord.kord.extensions.storage.StorageUnit
import com.kotlindiscord.kord.extensions.utils.suggestStringMap
import dev.kordex.core.commands.Arguments
import dev.kordex.core.commands.application.slash.ephemeralSubCommand
import dev.kordex.core.commands.converters.impl.string
import dev.kordex.core.commands.converters.impl.user
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.ephemeralSlashCommand
import dev.kordex.core.extensions.ephemeralUserCommand
import dev.kordex.core.storage.Data
import dev.kordex.core.storage.StorageType
import dev.kordex.core.storage.StorageUnit
import dev.kordex.core.utils.suggestStringMap
import dev.kord.common.entity.Snowflake
import dev.kord.core.behavior.GuildBehavior
import dev.kord.core.entity.User
Expand Down
18 changes: 9 additions & 9 deletions src/main/kotlin/moe/nikky/Main.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package moe.nikky

import com.kotlindiscord.kord.extensions.ExtensibleBot
import com.kotlindiscord.kord.extensions.i18n.SupportedLocales
import com.kotlindiscord.kord.extensions.modules.extra.phishing.extPhishing
import com.kotlindiscord.kord.extensions.storage.DataAdapter
import com.kotlindiscord.kord.extensions.utils.env
import com.kotlindiscord.kord.extensions.utils.envOrNull
import com.kotlindiscord.kord.extensions.utils.getKoin
import dev.kordex.core.ExtensibleBot
import dev.kordex.core.i18n.SupportedLocales
import dev.kordex.core.storage.DataAdapter
import dev.kordex.core.utils.env
import dev.kordex.core.utils.envOrNull
import dev.kordex.core.utils.getKoin
import dev.kord.common.entity.PresenceStatus
import dev.kord.common.entity.Snowflake
import dev.kord.gateway.PrivilegedIntent
Expand Down Expand Up @@ -75,9 +74,10 @@ suspend fun main() {
deletePaginatorOnTimeout = true
pingInReply = true
}
extPhishing {

// extPhishing {
// appName = "Yuno"
}
// }
// extPluralKit()
}
presence {
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/moe/nikky/RoleChooserConfig.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package moe.nikky

import com.kotlindiscord.kord.extensions.storage.Data
import dev.kordex.core.storage.Data
import dev.kord.common.entity.Snowflake
import dev.kord.core.behavior.GuildBehavior
import dev.kord.core.behavior.getChannelOfOrNull
Expand Down
40 changes: 20 additions & 20 deletions src/main/kotlin/moe/nikky/RoleManagementExtension.kt
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
package moe.nikky

import com.kotlindiscord.kord.extensions.DiscordRelayedException
import com.kotlindiscord.kord.extensions.commands.Arguments
import com.kotlindiscord.kord.extensions.commands.CommandContext
import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand
import com.kotlindiscord.kord.extensions.commands.converters.impl.defaultingBoolean
import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalChannel
import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalColor
import com.kotlindiscord.kord.extensions.commands.converters.impl.role
import com.kotlindiscord.kord.extensions.commands.converters.impl.string
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.parsers.ColorParser
import com.kotlindiscord.kord.extensions.storage.Data
import com.kotlindiscord.kord.extensions.storage.StorageType
import com.kotlindiscord.kord.extensions.storage.StorageUnit
import com.kotlindiscord.kord.extensions.utils.any
import com.kotlindiscord.kord.extensions.utils.botHasPermissions
import com.kotlindiscord.kord.extensions.utils.getJumpUrl
import com.kotlindiscord.kord.extensions.utils.translate
import dev.kordex.core.DiscordRelayedException
import dev.kordex.core.commands.Arguments
import dev.kordex.core.commands.CommandContext
import dev.kordex.core.commands.application.slash.ephemeralSubCommand
import dev.kordex.core.commands.converters.impl.defaultingBoolean
import dev.kordex.core.commands.converters.impl.optionalChannel
import dev.kordex.core.commands.converters.impl.optionalColor
import dev.kordex.core.commands.converters.impl.role
import dev.kordex.core.commands.converters.impl.string
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.ephemeralSlashCommand
import dev.kordex.core.extensions.event
import dev.kordex.core.parsers.ColorParser
import dev.kordex.core.storage.Data
import dev.kordex.core.storage.StorageType
import dev.kordex.core.storage.StorageUnit
import dev.kordex.core.utils.any
import dev.kordex.core.utils.botHasPermissions
import dev.kordex.core.utils.getJumpUrl
import dev.kordex.core.utils.translate
import dev.kord.common.Color
import dev.kord.common.annotation.KordPreview
import dev.kord.common.asJavaLocale
Expand Down
Loading

0 comments on commit e963cb8

Please sign in to comment.