Slackwolf\Game\GameManager::onFirstNight PHP Method

onFirstNight() private method

private onFirstNight ( Game $game )
$game Game
    private function onFirstNight(Game $game)
    {
        $client = $this->client;
        foreach ($game->getLivingPlayers() as $player) {
            $client->getDMByUserId($player->getId())->then(function (DirectMessageChannel $dmc) use($client, $player, $game) {
                $client->send("Your role is {$player->role->getName()}", $dmc);
                if ($player->role->isWerewolfTeam()) {
                    if (count($game->getWerewolves()) > 1) {
                        $werewolves = PlayerListFormatter::format($game->getWerewolves());
                        $client->send("The werewolves are: {$werewolves}", $dmc);
                    } else {
                        $client->send("You are the only werewolf.", $dmc);
                    }
                }
                if ($player->role->isRole(Role::SEER)) {
                    $client->send("Seer, select a player by saying !see #channel @username.\r\nDO NOT DISCUSS WHAT YOU SEE DURING THE NIGHT, ONLY DISCUSS DURING THE DAY IF YOU ARE NOT DEAD!", $dmc);
                }
                if ($player->role->isRole(Role::BEHOLDER)) {
                    $seers = $game->getPlayersOfRole(Role::SEER);
                    $seers = PlayerListFormatter::format($seers);
                    $client->send("The seer is: {$seers}", $dmc);
                }
            });
        }
        $playerList = PlayerListFormatter::format($game->getLivingPlayers());
        $roleList = RoleListFormatter::format($game->getLivingPlayers());
        $msg = ":wolf: It is raining, and a new game of Werewolf is starting! For a tutorial, type !help.\r\n\r\n";
        $msg .= "Players: {$playerList}\r\n";
        $msg .= "Possible Roles: {$game->getRoleStrategy()->getRoleListMsg()}\r\n\r\n";
        if ($this->optionsManager->getOptionValue(OptionName::role_seer)) {
            $msg .= ":moon: :rain_cloud: The rain comes down in torrents as the village sleeps, unaware of the horror the lurks outside in the wet. It is the middle of the night.";
            $msg .= " The game will begin when the Seer chooses someone.";
        }
        $this->sendMessageToChannel($game, $msg);
        if (!$this->optionsManager->getOptionValue(OptionName::role_seer)) {
            $this->changeGameState($game->getId(), GameState::NIGHT);
        }
    }