<commit_before>package com.mrpowergamerbr.loritta.commands.vanilla.utils

import com.github.kevinsawicki.http.HttpRequest
import com.mrpowergamerbr.loritta.Loritta
import com.mrpowergamerbr.loritta.commands.AbstractCommand
import com.mrpowergamerbr.loritta.commands.CommandContext
import com.mrpowergamerbr.loritta.commands.vanilla.utils.PackageInfoCommand.PackageSource.CORREIOS
import com.mrpowergamerbr.loritta.commands.vanilla.utils.PackageInfoCommand.PackageSource.CTT
import com.mrpowergamerbr.loritta.utils.Constants
import com.mrpowergamerbr.loritta.utils.correios.CorreiosResponse
import com.mrpowergamerbr.loritta.utils.correios.EncomendaResponse
import net.perfectdreams.loritta.common.locale.BaseLocale
import net.perfectdreams.loritta.common.locale.LocaleKeyData
import net.dv8tion.jda.api.EmbedBuilder
import net.perfectdreams.loritta.common.commands.CommandCategory
import net.perfectdreams.loritta.api.messages.LorittaReply
import java.awt.Color
import java.util.*

class PackageInfoCommand : AbstractCommand("packageinfo", listOf("correios", "ctt"), CommandCategory.UTILS) {
	override fun getDescriptionKey() = LocaleKeyData("commands.command.packageinfo.description")

	override fun getExamples(): List<String> {
		return Arrays.asList("correios")
	}

	override suspend fun run(context: CommandContext,locale: BaseLocale) {
		if (context.args.size == 1) {
			val packageId = context.args[0]
			try {
				var pair = getCorreiosInfo(packageId)
				var packageSource = CORREIOS
				if (pair == null) {
					pair = getCttInfo(packageId)
					packageSource = CTT
				}

				if (pair == null) {
					context.reply(
							LorittaReply(
									message = locale["commands.command.packageinfo.couldntFind", packageId],
									prefix = Constants.ERROR
							)
					)
					return
				}

				var embed = EmbedBuilder()

				var color = when (packageSource) {
					CORREIOS -> Color(253, 220, 1)
					CTT -> Color(223, 0, 36)<commit_msg>Recommend users to use `/package track` instead of `+correios`<commit_after>package com.mrpowergamerbr.loritta.commands.vanilla.utils

import com.github.kevinsawicki.http.HttpRequest
import com.mrpowergamerbr.loritta.Loritta
import com.mrpowergamerbr.loritta.commands.AbstractCommand
import com.mrpowergamerbr.loritta.commands.CommandContext
import com.mrpowergamerbr.loritta.commands.vanilla.utils.PackageInfoCommand.PackageSource.CORREIOS
import com.mrpowergamerbr.loritta.commands.vanilla.utils.PackageInfoCommand.PackageSource.CTT
import com.mrpowergamerbr.loritta.utils.Constants
import com.mrpowergamerbr.loritta.utils.correios.CorreiosResponse
import com.mrpowergamerbr.loritta.utils.correios.EncomendaResponse
import net.dv8tion.jda.api.EmbedBuilder
import net.perfectdreams.loritta.api.messages.LorittaReply
import net.perfectdreams.loritta.common.commands.CommandCategory
import net.perfectdreams.loritta.common.locale.BaseLocale
import net.perfectdreams.loritta.common.locale.LocaleKeyData
import net.perfectdreams.loritta.utils.OutdatedCommandUtils
import java.awt.Color
import java.util.*

class PackageInfoCommand : AbstractCommand("packageinfo", listOf("correios", "ctt"), CommandCategory.UTILS) {
	override fun getDescriptionKey() = LocaleKeyData("commands.command.packageinfo.description")

	override fun getExamples(): List<String> {
		return Arrays.asList("correios")
	}

	override suspend fun run(context: CommandContext,locale: BaseLocale) {
		if (context.args.size == 1) {
			OutdatedCommandUtils.sendOutdatedCommandMessage(context, locale, "package track")
			val packageId = context.args[0]

			try {
				var pair = getCorreiosInfo(packageId)
				var packageSource = CORREIOS
				if (pair == null) {
					pair = getCttInfo(packageId)
					packageSource = CTT
				}

				if (pair == null) {
					context.reply(
							LorittaReply(
									message = locale["commands.command.packageinfo.couldntFind", packageId],
									prefix = Constants.ERROR
							)
					)
					return
				}

				var embed = EmbedBuilder()

				var color = when (packageSource) {
					CORREIOS -> Color(253, 220, 1)
					CTT -> Color(223, 0, 36)
{'fraction_non_alphanumeric': 0.09904622157006603, 'fraction_numerical': 0.007825874296894107, 'mean_word_length': 4.752461322081575, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '7595757', 'n_tokens_mistral': 1516, 'n_tokens_neox': 1268, 'n_words': 217}