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

import com.mrpowergamerbr.loritta.commands.*
import com.mrpowergamerbr.loritta.utils.Constants
import com.mrpowergamerbr.loritta.utils.DateUtils
import com.mrpowergamerbr.loritta.utils.isValidSnowflake
import com.mrpowergamerbr.loritta.utils.locale.BaseLocale
import com.mrpowergamerbr.loritta.utils.lorittaShards
import net.dv8tion.jda.core.EmbedBuilder
import net.dv8tion.jda.core.entities.Emote

class EmojiInfoCommand : AbstractCommand("emojiinfo", category = CommandCategory.DISCORD) {
	override fun getDescription(locale: BaseLocale): String {
		return locale.format { commands.discord.emojiInfo.description }
	}

	override fun getUsage(locale: BaseLocale): CommandArguments {
		return arguments {
			argument(ArgumentType.EMOTE) {}
		}
	}

	override suspend fun run(context: CommandContext, locale: BaseLocale) {
		if (context.rawArgs.isNotEmpty()) {
			val arg0 = context.rawArgs[0]
			val firstEmote = context.message.emotes.firstOrNull()
			if (arg0 == firstEmote?.asMention) {
				// Emoji do Discord (via menção)
				showDiscordEmoteInfo(context, firstEmote)
				return
			}

			if (arg0.isValidSnowflake()) {
				val emote = lorittaShards.getEmoteById(arg0)
				if (emote != null) {
					// Emoji do Discord (via ID)
					showDiscordEmoteInfo(context, emote)
					return
				}
			}

			val guild = context.guild
			val foundEmote = guild.getEmotesByName(arg0, true).firstOrNull()
			if (foundEmote != null) {
				// Emoji do Discord (via nome)
				showDiscordEmoteInfo(context, foundEmote)
				return
			}
		} else {
			context.explain()
		}
	}

	suspend fun showDiscordEmoteInfo(context: CommandContext, emote: Emote) {
		val embed = EmbedBuilder()
		embed.setColor(Constants.DISCORD_BLURPLE)
		embed.setTitle("${emote.asMention} Sobre o Emoji")
		embed.setThumbnail(emote.imageUrl)
		embed.addField("\uD83D\uDD16 Nome do Emoji", "`${emote.name}", true)
		embed.addField("\uD83D\uDCBB ID do Emoji", "`${emote.id}", true)
		embed.addField("\uD83D\uDC40 Menção", "``${emote.asMention}`", true)
		embed.addField("\uD83D\uDCC5 Criado há", DateUtils.formatDateDiff(emote.creationTime.toInstant().toEpochMilli(), context.locale), true)
		embed.addField("\uD83D\uDD0E Avistado em", "`${emote.guild?.name}", true)
	}
}<commit_msg>...enviar a mensagem sempre é bom, né?<commit_after>package com.mrpowergamerbr.loritta.commands.vanilla.discord

import com.mrpowergamerbr.loritta.commands.*
import com.mrpowergamerbr.loritta.utils.Constants
import com.mrpowergamerbr.loritta.utils.DateUtils
import com.mrpowergamerbr.loritta.utils.isValidSnowflake
import com.mrpowergamerbr.loritta.utils.locale.BaseLocale
import com.mrpowergamerbr.loritta.utils.lorittaShards
import net.dv8tion.jda.core.EmbedBuilder
import net.dv8tion.jda.core.entities.Emote

class EmojiInfoCommand : AbstractCommand("emojiinfo", category = CommandCategory.DISCORD) {
	override fun getDescription(locale: BaseLocale): String {
		return locale.format { commands.discord.emojiInfo.description }
	}

	override fun getUsage(locale: BaseLocale): CommandArguments {
		return arguments {
			argument(ArgumentType.EMOTE) {}
		}
	}

	override suspend fun run(context: CommandContext, locale: BaseLocale) {
		if (context.rawArgs.isNotEmpty()) {
			val arg0 = context.rawArgs[0]
			val firstEmote = context.message.emotes.firstOrNull()
			if (arg0 == firstEmote?.asMention) {
				// Emoji do Discord (via menção)
				showDiscordEmoteInfo(context, firstEmote)
				return
			}

			if (arg0.isValidSnowflake()) {
				val emote = lorittaShards.getEmoteById(arg0)
				if (emote != null) {
					// Emoji do Discord (via ID)
					showDiscordEmoteInfo(context, emote)
					return
				}
			}

			val guild = context.guild
			val foundEmote = guild.getEmotesByName(arg0, true).firstOrNull()
			if (foundEmote != null) {
				// Emoji do Discord (via nome)
				showDiscordEmoteInfo(context, foundEmote)
				return
			}
		} else {
			context.explain()
		}
	}

	suspend fun showDiscordEmoteInfo(context: CommandContext, emote: Emote) {
		val embed = EmbedBuilder()
		embed.setColor(Constants.DISCORD_BLURPLE)
		embed.setTitle("${emote.asMention} Sobre o Emoji")
		embed.setThumbnail(emote.imageUrl)
		embed.addField("\uD83D\uDD16 Nome do Emoji", "`${emote.name}", true)
		embed.addField("\uD83D\uDCBB ID do Emoji", "`${emote.id}", true)
		embed.addField("\uD83D\uDC40 Menção", "``${emote.asMention}`", true)
		embed.addField("\uD83D\uDCC5 Criado há", DateUtils.formatDateDiff(emote.creationTime.toInstant().toEpochMilli(), context.locale), true)
		embed.addField("\uD83D\uDD0E Avistado em", "`${emote.guild?.name}", true)

		context.sendMessage(context.getAsMention(true), embed.build())
	}
}
{'fraction_non_alphanumeric': 0.12449628844114528, 'fraction_numerical': 0.010180275715800637, 'mean_word_length': 4.627684964200477, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5016239', 'n_tokens_mistral': 1860, 'n_tokens_neox': 1677, 'n_words': 294}