<commit_before>package net.perfectdreams.loritta.api.commands

import com.mrpowergamerbr.loritta.utils.locale.BaseLocale
import net.perfectdreams.loritta.api.LorittaBot
import net.perfectdreams.loritta.api.platform.PlatformFeature

fun Any?.command(
		loritta: LorittaBot,
		labels: List<String>,
		category: CommandCategory,
		builder: CommandBuilder<CommandContext>.() -> (Unit)
) = command(loritta, this?.let { this::class.simpleName } ?: "UnknownCommand", labels, category, builder)

fun command(loritta: LorittaBot, commandName: String, labels: List<String>, category: CommandCategory, builder: CommandBuilder<CommandContext>.() -> (Unit)): Command<CommandContext> {
	val b = CommandBuilder<CommandContext>(loritta, commandName, labels, category)
	builder.invoke(b)
	return b.build()
}

open class CommandBuilder<context : CommandContext>(
		// Needs to be private to avoid accessing this variable on the builder itself
		private val loritta: LorittaBot,
		val commandName: String,
		val labels: List<String>,
		val category: CommandCategory
) {
	var canUseInPrivateChannel = false
	var needsToUploadFiles = false
	var hideInHelp = false
	var requiredFeatures = listOf<PlatformFeature>()
	var onlyOwner = false
	var similarCommands = listOf<String>()

	var descriptionCallback: ((BaseLocale) -> (String))? = null
	var usageCallback: (CommandArgumentsBuilder.() -> Unit)? = null
	var examplesCallback: ((BaseLocale) -> (List<String>))? = null
	var executeCallback: (suspend context.() -> (Unit))? = null

	/**
	 * Gets the description from the specified [localeKey] with the [arguments] from the [BaseLocale]
	 *
	 * This is a helper method for the [description] method
	 *
	 * @see BaseLocale
	 * @see description
	 */
	fun localizedDescription(localeKey: String, vararg arguments: Any?) = description { it[localeKey, arguments] }

	fun description(callback: (BaseLocale) -> (String)) {
		this.descriptionCallback = callback
	}

	fun usage(callback: CommandArgumentsBuilder.() -> Unit) {
		this.usageCallback = callback
	}
<commit_msg>Fix "localizedDescription" arguments not being correctly used<commit_after>package net.perfectdreams.loritta.api.commands

import com.mrpowergamerbr.loritta.utils.locale.BaseLocale
import net.perfectdreams.loritta.api.LorittaBot
import net.perfectdreams.loritta.api.platform.PlatformFeature

fun Any?.command(
		loritta: LorittaBot,
		labels: List<String>,
		category: CommandCategory,
		builder: CommandBuilder<CommandContext>.() -> (Unit)
) = command(loritta, this?.let { this::class.simpleName } ?: "UnknownCommand", labels, category, builder)

fun command(loritta: LorittaBot, commandName: String, labels: List<String>, category: CommandCategory, builder: CommandBuilder<CommandContext>.() -> (Unit)): Command<CommandContext> {
	val b = CommandBuilder<CommandContext>(loritta, commandName, labels, category)
	builder.invoke(b)
	return b.build()
}

open class CommandBuilder<context : CommandContext>(
		// Needs to be private to avoid accessing this variable on the builder itself
		private val loritta: LorittaBot,
		val commandName: String,
		val labels: List<String>,
		val category: CommandCategory
) {
	var canUseInPrivateChannel = false
	var needsToUploadFiles = false
	var hideInHelp = false
	var requiredFeatures = listOf<PlatformFeature>()
	var onlyOwner = false
	var similarCommands = listOf<String>()

	var descriptionCallback: ((BaseLocale) -> (String))? = null
	var usageCallback: (CommandArgumentsBuilder.() -> Unit)? = null
	var examplesCallback: ((BaseLocale) -> (List<String>))? = null
	var executeCallback: (suspend context.() -> (Unit))? = null

	/**
	 * Gets the description from the specified [localeKey] with the [arguments] from the [BaseLocale]
	 *
	 * This is a helper method for the [description] method
	 *
	 * @see BaseLocale
	 * @see description
	 */
	fun localizedDescription(localeKey: String, vararg arguments: Any?) = description { it.get(localeKey, *arguments) }

	fun description(callback: (BaseLocale) -> (String)) {
		this.descriptionCallback = callback
	}

	fun usage(callback: CommandArgumentsBuilder.() -> Unit) {
		this.usageCallback = callback
	}

{'fraction_non_alphanumeric': 0.11565448826518268, 'fraction_numerical': 0.0, 'mean_word_length': 5.459375, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7254454', 'n_tokens_mistral': 1220, 'n_tokens_neox': 1157, 'n_words': 334}