<commit_before><?php declare(strict_types=1);

function get_turns_message($player) {
	// turns only update when the player is active, so calculate current turns
	$turns = min($player->getTurns() + $player->getTurnsGained(time(), true),
	             $player->getMaxTurns());
	$msg = $player->getPlayerName() . " has $turns/" . $player->getMaxTurns() . " turns.";

	// Calculate time to max turns if under the max
	$timeToMax = $player->getTimeUntilMaxTurns(time(), true);
	if ($timeToMax > 0) {
		$msg .= " At max turns in " . format_time($timeToMax, true) . ".";
	}

	return $msg;
}

$fn_turns = function($message) {
	$link = new GameLink($message->channel, $message->author);
	if (!$link->valid) {
		return;
	}

	$msg = get_turns_message($link->player);
	$message->channel->sendMessage($msg);
};

$fn_turns_all = function($message) {
	$link = new GameLink($message->channel, $message->author);
	if (!$link->valid) {
		return;
	}
	$player = $link->player;

	$results = array_map('get_turns_message', $player->getSharingPlayers(true));
	$message->channel->sendMessage(join("\n", $results));
};

$cmd_turns = $discord->registerCommand('turns', mysql_cleanup($fn_turns), ['description' => 'Get current turns']);

$cmd_turns->registerSubCommand('all', mysql_cleanup($fn_turns_all), ['description' => 'Get current turns for all players whose info is shared with you']);<commit_msg>Autopilot: remove all subcommand from turns<commit_after><?php declare(strict_types=1);

function get_turns_message($player) {
	// turns only update when the player is active, so calculate current turns
	$turns = min($player->getTurns() + $player->getTurnsGained(time(), true),
	             $player->getMaxTurns());
	$msg = $player->getPlayerName() . " has $turns/" . $player->getMaxTurns() . " turns.";

	// Calculate time to max turns if under the max
	$timeToMax = $player->getTimeUntilMaxTurns(time(), true);
	if ($timeToMax > 0) {
		$msg .= " At max turns in " . format_time($timeToMax, true) . ".";
	}

	return $msg;
}

$fn_turns = function($message) {
	$link = new GameLink($message->channel, $message->author);
	if (!$link->valid) {
		return;
	}
	$player = $link->player;

	$results = array_map('get_turns_message', $player->getSharingPlayers(true));
	$message->channel->sendMessage(join("\n", $results));
};

$cmd_turns = $discord->registerCommand('turns', mysql_cleanup($fn_turns), ['description' => 'Show current turns']);
{'fraction_non_alphanumeric': 0.1833264205723766, 'fraction_numerical': 0.0016590626296142678, 'mean_word_length': 5.03, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, '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': '647565', 'n_tokens_mistral': 821, 'n_tokens_neox': 804, 'n_words': 179}