From 6b54ed108b4d85b07844366c6c075c3f3d8bb7d0 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Thu, 19 Aug 2021 17:13:02 +0800 Subject: [PATCH] Fix unable to unset values, Fix #14 Signed-off-by: shedaniel --- .../me/shedaniel/linkie/discord/commands/SetValueCommand.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/me/shedaniel/linkie/discord/commands/SetValueCommand.kt b/src/main/kotlin/me/shedaniel/linkie/discord/commands/SetValueCommand.kt index 87b66d7..8d1fb50 100644 --- a/src/main/kotlin/me/shedaniel/linkie/discord/commands/SetValueCommand.kt +++ b/src/main/kotlin/me/shedaniel/linkie/discord/commands/SetValueCommand.kt @@ -20,6 +20,7 @@ import me.shedaniel.linkie.discord.SimpleCommand import me.shedaniel.linkie.discord.config.ConfigManager import me.shedaniel.linkie.discord.scommands.SlashCommandBuilderInterface import me.shedaniel.linkie.discord.scommands.opt +import me.shedaniel.linkie.discord.scommands.optNullable import me.shedaniel.linkie.discord.scommands.string import me.shedaniel.linkie.discord.scommands.stringUnlimited import me.shedaniel.linkie.discord.utils.CommandContext @@ -36,11 +37,11 @@ object SetValueCommand : SimpleCommand { override suspend fun SlashCommandBuilderInterface.buildCommand(slash: Boolean) { val propertyName = string("property", "The property name") - val value = stringUnlimited("value", "The property value") + val value = stringUnlimited("value", "The property value", required = false) executeCommandWith { SetValueData( property = opt(propertyName), - value = opt(value), + value = optNullable(value) ?: "", ) } }