Skip to content

Commit

Permalink
Allow hardcoding of bot name
Browse files Browse the repository at this point in the history
  • Loading branch information
NoComment1105 committed Feb 9, 2023
1 parent 5953ff6 commit 657d808
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
4 changes: 3 additions & 1 deletion api/doc-generator.api
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ public class org/hyacinthbots/docgenerator/builder/ConfigurationBuilder {
public field fileFormat Lorg/hyacinthbots/docgenerator/enums/SupportedFileFormat;
public field filePath Ljava/nio/file/Path;
public fun <init> ()V
public fun getBotName ()Ljava/lang/String;
public fun getCommandTypes ()Ljava/util/List;
public fun getEnabled ()Z
public fun getEnvironment ()Ljava/lang/String;
public fun getFileFormat ()Lorg/hyacinthbots/docgenerator/enums/SupportedFileFormat;
public fun getFilePath ()Ljava/nio/file/Path;
public final fun getTranslationSupport ()Lorg/hyacinthbots/docgenerator/builder/TranslationSupportBuilder;
public fun getUseBuiltinCommandList ()Z
public fun setBotName (Ljava/lang/String;)V
public fun setCommandTypes (Ljava/util/List;)V
public fun setEnabled (Z)V
public fun setEnvironment (Ljava/lang/String;)V
Expand Down Expand Up @@ -92,7 +94,7 @@ public final class org/hyacinthbots/docgenerator/exceptions/InvalidEnvironmentVa
}

public final class org/hyacinthbots/docgenerator/extensions/CommandList : com/kotlindiscord/kord/extensions/extensions/Extension {
public fun <init> (Ljava/util/List;)V
public fun <init> (Ljava/lang/String;Ljava/util/List;)V
public fun getName ()Ljava/lang/String;
public fun setup (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
Expand Down
9 changes: 4 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,23 @@ plugins {
alias(libs.plugins.git.hooks)
alias(libs.plugins.licenser)
alias(libs.plugins.binary.compatibility.validator)
alias(libs.plugins.nexus.publish)
}

group = "org.hyacinthbots"
version = "0.1.1"
version = "0.1.2"
val javaVersion = 17

repositories {
mavenCentral()

maven {
name = "Kotlin Discord"
url = uri("https://maven.kotlindiscord.com/repository/maven-public/")
name = "Sonatype Snapshots (Legacy)"
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
}

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

Expand Down
11 changes: 4 additions & 7 deletions libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
[versions]
kotlin = "1.7.22"
kordex = "1.5.6-20221216.114038-3"

kotlin = "1.8.0"
kordex = "1.5.6-20230208.121744-1"
git-hooks = "0.0.2"
licenser = "0.6.1"
bin-compat = "0.12.1"

detekt = "1.22.0"
logging = "2.1.23"
logging = "3.0.5"

junit5 = "5.9.1"
nexus-publish = "1.1.0"
junit5 = "5.9.2"

[libraries]
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8" }
Expand All @@ -26,4 +24,3 @@ git-hooks = { id = "com.github.jakemarsden.git-hooks", version.ref = "git-hooks"
licenser = { id = "org.cadixdev.licenser", version.ref = "licenser" }
binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "bin-compat" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus-publish" }
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public suspend fun ExtensibleBotBuilder.docsGenerator(
if (action.useBuiltinCommandList) {
extensions {
add {
CommandList(action.commandTypes)
CommandList(action.botName, action.commandTypes)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public open class ConfigurationBuilder {
*/
public open var useBuiltinCommandList: Boolean = false

/**
* The name of the bot the documentation is being generated for. Leave blank to pull it automatically.
*/
public open var botName: String? = null

/** @suppress Builder that should not be directly set by the user. */
public val translationSupport: TranslationSupportBuilder = TranslationSupportBuilder()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import org.hyacinthbots.docgenerator.formatPermissionsSet
import org.hyacinthbots.docgenerator.subCommandAdditionalDocumentation
import org.hyacinthbots.docgenerator.translate

public class CommandList(private val enabledCommands: List<CommandTypes>) : Extension() {
public class CommandList(private val botName: String?, private val enabledCommands: List<CommandTypes>) : Extension() {
override val name: String = "command-list"

override suspend fun setup() {
Expand Down Expand Up @@ -86,7 +86,7 @@ public class CommandList(private val enabledCommands: List<CommandTypes>) : Exte

publicSlashCommand {
name = "command-list"
description = "Shows a list of ${kord.getSelf().username}'s commands!"
description = "Shows a list of ${botName ?: kord.getSelf().username}'s commands!"

action {
val paginator = PublicResponsePaginator(
Expand Down

0 comments on commit 657d808

Please sign in to comment.