From 006af32efa0d05f508a451fd6eceb9afdd87e480 Mon Sep 17 00:00:00 2001 From: SantioMC Date: Fri, 13 Dec 2024 20:22:26 -0500 Subject: [PATCH] feat: Make changing tag type possible --- .../kotlin/me/santio/minehututils/commands/impl/TagCommand.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/kotlin/me/santio/minehututils/commands/impl/TagCommand.kt b/src/main/kotlin/me/santio/minehututils/commands/impl/TagCommand.kt index 06cec4a..8e94fa4 100644 --- a/src/main/kotlin/me/santio/minehututils/commands/impl/TagCommand.kt +++ b/src/main/kotlin/me/santio/minehututils/commands/impl/TagCommand.kt @@ -51,6 +51,7 @@ class TagCommand : SlashCommand { addOptions( Option("id", "The id of the tag to edit", true, true), + Option("type", "How should the tag be detected", false, true), Option("global", "Whether the tag should be edited globally") ) }, @@ -165,6 +166,7 @@ class TagCommand : SlashCommand { val tagId = event.getOption("id")?.asString ?: error("Tag id not provided") val tag = TagManager.get(tagId.toInt()) ?: error("Tag not found") val global = event.getOption("global")?.asBoolean == true + val type = event.getOption("type")?.asString ?: tag.searchAlg().id val id = UUID.randomUUID().toString() val modal = Modal("minehut:tag:edit:$id", "Edit a tag") { @@ -186,6 +188,7 @@ class TagCommand : SlashCommand { tag.searchValue = searchValue tag.body = body tag.guildId = if (global) null else event.guild!!.id + tag.searchAlg(SearchAlgorithm.from(type) ?: error("Invalid search algorithm provided")) TagManager.save(tag)