{"size": 1150, "ext": "js", "max_stars_repo_path": "src/commands/admin/UnblockCommand.js", "max_stars_repo_name": "romain22222/DraftBot", "max_stars_repo_stars_event_min_datetime": "2021-12-22T17:50:23.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-22T17:50:23.000Z", "max_issues_repo_path": "src/commands/admin/UnblockCommand.js", "max_issues_repo_name": "romain22222/DraftBot", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/commands/admin/UnblockCommand.js", "max_forks_repo_name": "romain22222/DraftBot", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.5555555556, "max_line_length": 81, "alphanum_fraction": 0.6834782609}
/**
 * @param {("fr"|"en")} language - Language to use in the response
 * @param {module:"discord.js".Message} message - Message from the discord server
 * @param {String[]} args=[] - Additional arguments sent with the command
 */

const UnblockCommand = async function (language, message, args) {
	if ((await canPerformCommand(message, language,
		PERMISSION.ROLE.BOT_OWNER)) !== true) {
		return;
	}

	if (args.length === 1) {
		if (!hasBlockedPlayer(args[0])) {
			await message.channel.send("Not blocked");
			return;
		}
		removeBlockedPlayer(args[0]);
		await message.channel.send("Unblocked with success");
		let user = await client.users.fetch(args[0]);
		const [entity] = await Entities.getOrRegister(args[0]);
		if (entity.Player.dmnotification) {
			sendDirectMessage(
				user,
				JsonReader.commands.unblock.getTranslation(language).title,
				JsonReader.commands.unblock.getTranslation(language).description,
				JsonReader.bot.embed.default,
				language
			)
		}


	} else {
		await message.channel.send("Usage: !unblock <discord id>");
	}
};

module.exports = {
	commands: [
		{
			name: 'unblock',
			func: UnblockCommand
		}
	]
};