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

import com.mrpowergamerbr.loritta.commands.CommandBase
import com.mrpowergamerbr.loritta.commands.CommandCategory
import com.mrpowergamerbr.loritta.commands.CommandContext
import com.mrpowergamerbr.loritta.utils.f
import com.mrpowergamerbr.loritta.utils.getOrCreateWebhook
import com.mrpowergamerbr.loritta.utils.locale.BaseLocale
import com.mrpowergamerbr.temmiewebhook.DiscordEmbed
import com.mrpowergamerbr.temmiewebhook.DiscordMessage
import com.mrpowergamerbr.temmiewebhook.embed.ThumbnailEmbed
import org.jsoup.Jsoup
import java.net.URLEncoder
import java.util.*

class ReceitasCommand : CommandBase() {
	override fun getLabel(): String {
		return "anamaria";
	}

	override fun getAliases(): MutableList<String> {
		return Arrays.asList("receitas");
	}

	override fun getDescription(locale: BaseLocale): String {
		return locale.get("RECEITAS_DESCRIPTION")
	}

	override fun getCategory(): CommandCategory {
		return CommandCategory.UTILS
	}

	override fun hasCommandFeedback(): Boolean {
		return false;
	}

	override fun getUsage(): String {
		return "<texto>";
	}

	override fun getExtendedExamples(): Map<String, String> {
		return mapOf("bolo" to "Procura \"bolo\" no livro de receitas da Ana Maria Braga™")
	}

	override fun run(context: CommandContext) {
		if (context.args.size > 0) {
			val query = context.args.joinToString(" ");

			val jsoup = Jsoup.connect("http://anamariabraga.globo.com/Publicacao/Filtrar?term=" + URLEncoder.encode(query, "UTF-8") + "&pagina=1&quantidadePorPagina=30").get()

			println(jsoup.body())

			var classes = jsoup.getElementsByClass("col-lg-4");

			var finalMessage: DiscordMessage? = null

			for (c in classes) {
				try {
					var links = c.select("a[href]");
					var comida = c.select("h3");
					var reason = c.getElementsByClass("text-uppercase")[0].text()

					var img = c.getElementsByClass("hover-zoom")[0].attr("abs:data-image")

					var embed = DiscordEmbed.builder()
							.thumbnail(ThumbnailEmbed(img, null, 700, 700))
							.title("\uD83E\uDD58 ${comida.html()}")
							.url(links[0].attr("abs:href"))
							.description(context.locale.RECEITAS_INFO.f(reason))
							.color(744725)
							.build()<commit_msg>:bug: | Corrigir "+anamaria"<commit_after>package com.mrpowergamerbr.loritta.commands.vanilla.utils;

import com.mrpowergamerbr.loritta.commands.CommandBase
import com.mrpowergamerbr.loritta.commands.CommandCategory
import com.mrpowergamerbr.loritta.commands.CommandContext
import com.mrpowergamerbr.loritta.utils.f
import com.mrpowergamerbr.loritta.utils.getOrCreateWebhook
import com.mrpowergamerbr.loritta.utils.locale.BaseLocale
import com.mrpowergamerbr.temmiewebhook.DiscordEmbed
import com.mrpowergamerbr.temmiewebhook.DiscordMessage
import com.mrpowergamerbr.temmiewebhook.embed.ThumbnailEmbed
import org.jsoup.Jsoup
import java.net.URLEncoder
import java.util.*

class ReceitasCommand : CommandBase() {
	override fun getLabel(): String {
		return "anamaria";
	}

	override fun getAliases(): MutableList<String> {
		return Arrays.asList("receitas");
	}

	override fun getDescription(locale: BaseLocale): String {
		return locale.get("RECEITAS_DESCRIPTION")
	}

	override fun getCategory(): CommandCategory {
		return CommandCategory.UTILS
	}

	override fun hasCommandFeedback(): Boolean {
		return false;
	}

	override fun getUsage(): String {
		return "<texto>";
	}

	override fun getExtendedExamples(): Map<String, String> {
		return mapOf("bolo" to "Procura \"bolo\" no livro de receitas da <NAME>™")
	}

	override fun run(context: CommandContext) {
		if (context.args.size > 0) {
			val query = context.args.joinToString(" ");

			val jsoup = Jsoup.connect("http://anamariabraga.globo.com/Publicacao/Filtrar?term=" + URLEncoder.encode(query, "UTF-8") + "&pagina=1&quantidadePorPagina=30&tipoPublicacao=&idCategoria=&videoOnly=false").get()

			println(jsoup.body())

			var classes = jsoup.getElementsByClass("col-lg-4");

			var finalMessage: DiscordMessage? = null

			for (c in classes) {
				try {
					var links = c.select("a[href]");
					var comida = c.select("h3");
					var reason = c.getElementsByClass("text-uppercase")[0].text()

					var img = c.getElementsByClass("hover-zoom")[0].attr("abs:data-image")

					var embed = DiscordEmbed.builder()
							.thumbnail(ThumbnailEmbed(img, null, 700, 700))
							.title("\uD83E\uDD58 ${comida.html()}")
							.url(links[0].attr("abs:href"))
							.description(context.locale.RECEITAS_INFO.f(reason))
							.color(744725)
							.build()
{'fraction_non_alphanumeric': 0.131815195971097, 'fraction_numerical': 0.011386030216772498, 'mean_word_length': 4.724310776942356, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 12, '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': '683170', 'n_tokens_mistral': 1772, 'n_tokens_neox': 1539, 'n_words': 275}