Skip to content

Commit

Permalink
Small nullable casting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gdude2002 committed May 22, 2024
1 parent bea2fe3 commit fca5007
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public open class SlashCommandParser {
currentArg = args.removeFirstOrNull()
currentArg ?: break // If it's null, we're out of arguments

logger.trace { "Current argument: ${currentArg.displayName}" }
logger.trace { "Current argument: ${currentArg!!.displayName}" }

currentValue =
values[currentArg.getDefaultTranslatedDisplayName(context.translationsProvider, context.command)]
Expand Down Expand Up @@ -110,7 +110,7 @@ public open class SlashCommandParser {
}

if (parsed) {
logger.trace { "Argument ${currentArg.displayName} successfully filled." }
logger.trace { "Argument ${currentArg!!.displayName} successfully filled." }

converter.parseSuccess = true
currentValue = null
Expand All @@ -132,7 +132,7 @@ public open class SlashCommandParser {
)
}
} catch (t: Throwable) {
logger.debug { "Argument ${currentArg.displayName} threw: $t" }
logger.debug { "Argument ${currentArg!!.displayName} threw: $t" }

if (converter.required) {
throw t
Expand Down Expand Up @@ -173,7 +173,7 @@ public open class SlashCommandParser {
}

if (parsed) {
logger.trace { "Argument ${currentArg.displayName} successfully filled." }
logger.trace { "Argument ${currentArg!!.displayName} successfully filled." }

converter.parseSuccess = true
currentValue = null
Expand All @@ -195,7 +195,7 @@ public open class SlashCommandParser {
)
}
} catch (t: Throwable) {
logger.debug { "Argument ${currentArg.displayName} threw: $t" }
logger.debug { "Argument ${currentArg!!.displayName} threw: $t" }

if (converter.required) {
throw t
Expand All @@ -210,7 +210,7 @@ public open class SlashCommandParser {
}

if (parsed) {
logger.trace { "Argument ${currentArg.displayName} successfully filled." }
logger.trace { "Argument ${currentArg!!.displayName} successfully filled." }

converter.parseSuccess = true
currentValue = null
Expand All @@ -232,7 +232,7 @@ public open class SlashCommandParser {
)
}
} catch (t: Throwable) {
logger.debug { "Argument ${currentArg.displayName} threw: $t" }
logger.debug { "Argument ${currentArg!!.displayName} threw: $t" }

if (converter.required) {
throw t
Expand All @@ -247,7 +247,7 @@ public open class SlashCommandParser {
}

if (parsed) {
logger.trace { "Argument ${currentArg.displayName} successfully filled." }
logger.trace { "Argument ${currentArg!!.displayName} successfully filled." }

converter.parseSuccess = true
currentValue = null
Expand All @@ -269,7 +269,7 @@ public open class SlashCommandParser {
)
}
} catch (t: Throwable) {
logger.debug { "Argument ${currentArg.displayName} threw: $t" }
logger.debug { "Argument ${currentArg!!.displayName} threw: $t" }

if (converter.required) {
throw t
Expand All @@ -284,7 +284,7 @@ public open class SlashCommandParser {
}

if (parsed) {
logger.trace { "Argument ${currentArg.displayName} successfully filled." }
logger.trace { "Argument ${currentArg!!.displayName} successfully filled." }

converter.parseSuccess = true
currentValue = null
Expand All @@ -306,7 +306,7 @@ public open class SlashCommandParser {
)
}
} catch (t: Throwable) {
logger.debug { "Argument ${currentArg.displayName} threw: $t" }
logger.debug { "Argument ${currentArg!!.displayName} threw: $t" }

if (converter.required) {
throw t
Expand All @@ -321,7 +321,7 @@ public open class SlashCommandParser {
}

if (parsed) {
logger.trace { "Argument ${currentArg.displayName} successfully filled." }
logger.trace { "Argument ${currentArg!!.displayName} successfully filled." }

converter.parseSuccess = true
currentValue = null
Expand All @@ -343,7 +343,7 @@ public open class SlashCommandParser {
)
}
} catch (t: Throwable) {
logger.debug { "Argument ${currentArg.displayName} threw: $t" }
logger.debug { "Argument ${currentArg!!.displayName} threw: $t" }

if (converter.required) {
throw t
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public open class ChatCommandParser : KordExKoinComponent {

val hasKwargs = kwValue != null

logger.trace { "Current argument: ${currentArg.displayName}" }
logger.trace { "Current argument: ${currentArg!!.displayName}" }
logger.trace { "Keyword arg ($hasKwargs): $kwValue" }

if (!parser.cursor.hasNext && !hasKwargs) {
Expand Down Expand Up @@ -177,7 +177,7 @@ public open class ChatCommandParser : KordExKoinComponent {
}

if (parsed) {
logger.trace { "Argument ${currentArg.displayName} successfully filled." }
logger.trace { "Argument ${currentArg!!.displayName} successfully filled." }

converter.parseSuccess = true

Expand Down Expand Up @@ -210,7 +210,7 @@ public open class ChatCommandParser : KordExKoinComponent {
)
}
} catch (t: Throwable) {
logger.debug { "Argument ${currentArg.displayName} threw: $t" }
logger.debug { "Argument ${currentArg!!.displayName} threw: $t" }

if (converter.required || hasKwargs) {
throw t
Expand Down Expand Up @@ -243,7 +243,7 @@ public open class ChatCommandParser : KordExKoinComponent {
}

if (parsed) {
logger.trace { "Argument ${currentArg.displayName} successfully filled." }
logger.trace { "Argument ${currentArg!!.displayName} successfully filled." }

converter.parseSuccess = true
}
Expand Down Expand Up @@ -276,7 +276,7 @@ public open class ChatCommandParser : KordExKoinComponent {
)
}
} catch (t: Throwable) {
logger.debug { "Argument ${currentArg.displayName} threw: $t" }
logger.debug { "Argument ${currentArg!!.displayName} threw: $t" }
}

is OptionalConverter<*> -> try {
Expand Down Expand Up @@ -305,7 +305,7 @@ public open class ChatCommandParser : KordExKoinComponent {
}

if (parsed) {
logger.trace { "Argument ${currentArg.displayName} successfully filled." }
logger.trace { "Argument ${currentArg!!.displayName} successfully filled." }

converter.parseSuccess = true
}
Expand Down Expand Up @@ -338,7 +338,7 @@ public open class ChatCommandParser : KordExKoinComponent {
)
}
} catch (t: Throwable) {
logger.debug { "Argument ${currentArg.displayName} threw: $t" }
logger.debug { "Argument ${currentArg!!.displayName} threw: $t" }

if (converter.required || hasKwargs) {
throw t
Expand Down Expand Up @@ -410,7 +410,7 @@ public open class ChatCommandParser : KordExKoinComponent {
converter.parseSuccess = true
} else {
if (parsedCount > 0) {
logger.trace { "Argument ${currentArg.displayName} successfully filled." }
logger.trace { "Argument ${currentArg!!.displayName} successfully filled." }

converter.parseSuccess = true
}
Expand Down Expand Up @@ -444,7 +444,7 @@ public open class ChatCommandParser : KordExKoinComponent {
)
}
} catch (t: Throwable) {
logger.debug { "Argument ${currentArg.displayName} threw: $t" }
logger.debug { "Argument ${currentArg!!.displayName} threw: $t" }

if (converter.required) {
throw t
Expand Down Expand Up @@ -518,7 +518,7 @@ public open class ChatCommandParser : KordExKoinComponent {
converter.validate(context)
} else {
if (parsedCount > 0) {
logger.trace { "Argument '${currentArg.displayName}' successfully filled." }
logger.trace { "Argument '${currentArg!!.displayName}' successfully filled." }

converter.parseSuccess = true

Expand Down Expand Up @@ -552,7 +552,7 @@ public open class ChatCommandParser : KordExKoinComponent {
)
}
} catch (t: Throwable) {
logger.debug { "Argument ${currentArg.displayName} threw: $t" }
logger.debug { "Argument ${currentArg!!.displayName} threw: $t" }

if (converter.required) {
throw t
Expand Down Expand Up @@ -624,7 +624,7 @@ public open class ChatCommandParser : KordExKoinComponent {
converter.parseSuccess = true
} else {
if (parsedCount > 0) {
logger.trace { "Argument '${currentArg.displayName}' successfully filled." }
logger.trace { "Argument '${currentArg!!.displayName}' successfully filled." }

converter.parseSuccess = true
}
Expand Down Expand Up @@ -658,7 +658,7 @@ public open class ChatCommandParser : KordExKoinComponent {
)
}
} catch (t: Throwable) {
logger.debug { "Argument ${currentArg.displayName} threw: $t" }
logger.debug { "Argument ${currentArg!!.displayName} threw: $t" }

if (converter.required || converter.outputError || hasKwargs) {
throw t
Expand Down Expand Up @@ -730,7 +730,7 @@ public open class ChatCommandParser : KordExKoinComponent {
converter.parseSuccess = true
} else {
if (parsedCount > 0) {
logger.trace { "Argument '${currentArg.displayName}' successfully filled." }
logger.trace { "Argument '${currentArg!!.displayName}' successfully filled." }

converter.parseSuccess = true
}
Expand Down Expand Up @@ -764,7 +764,7 @@ public open class ChatCommandParser : KordExKoinComponent {
)
}
} catch (t: Throwable) {
logger.debug { "Argument ${currentArg.displayName} threw: $t" }
logger.debug { "Argument ${currentArg!!.displayName} threw: $t" }

if (converter.required || converter.outputError) {
throw t
Expand Down

0 comments on commit fca5007

Please sign in to comment.