Skip to content

Commit

Permalink
Fix command parsing error for snowflake args
Browse files Browse the repository at this point in the history
  • Loading branch information
NovaFox161 committed Apr 12, 2024
1 parent cf9e6ad commit ef82fd2
Showing 1 changed file with 7 additions and 3 deletions.
@@ -1,5 +1,6 @@
package org.dreamexposure.discal.client.commands.dev

import discord4j.common.util.Snowflake
import discord4j.core.event.domain.interaction.ChatInputInteractionEvent
import discord4j.core.`object`.command.ApplicationCommandInteractionOption
import discord4j.core.`object`.command.ApplicationCommandInteractionOptionValue
Expand Down Expand Up @@ -37,7 +38,8 @@ class DevCommand(
private suspend fun patron(event: ChatInputInteractionEvent, settings: GuildSettings): Message {
val guildId = event.options[0].getOption("guild")
.flatMap(ApplicationCommandInteractionOption::getValue)
.map(ApplicationCommandInteractionOptionValue::asSnowflake)
.map(ApplicationCommandInteractionOptionValue::asString)
.map(Snowflake::of)
.get()

val oldTargetSettings = settingsService.getSettings(guildId)
Expand All @@ -51,7 +53,8 @@ class DevCommand(
private suspend fun dev(event: ChatInputInteractionEvent, settings: GuildSettings): Message {
val guildId = event.options[0].getOption("guild")
.flatMap(ApplicationCommandInteractionOption::getValue)
.map(ApplicationCommandInteractionOptionValue::asSnowflake)
.map(ApplicationCommandInteractionOptionValue::asString)
.map(Snowflake::of)
.get()

val oldTargetSettings = settingsService.getSettings(guildId)
Expand All @@ -65,7 +68,8 @@ class DevCommand(
private suspend fun maxCalendars(event: ChatInputInteractionEvent, settings: GuildSettings): Message {
val guildId = event.options[0].getOption("guild")
.flatMap(ApplicationCommandInteractionOption::getValue)
.map(ApplicationCommandInteractionOptionValue::asSnowflake)
.map(ApplicationCommandInteractionOptionValue::asString)
.map(Snowflake::of)
.get()
val amount = event.options[0].getOption("amount")
.flatMap(ApplicationCommandInteractionOption::getValue)
Expand Down

0 comments on commit ef82fd2

Please sign in to comment.