private function onFirstNight(Game $game)
{
$client = $this->client;
foreach ($game->getPlayers() as $player) {
$client->getDMByUserId($player->getId())->then(function (DirectMessageChannel $dmc) use($client, $player, $game) {
$client->send("Your role is {$player->role}", $dmc);
if ($player->role == Role::WEREWOLF) {
if ($game->getNumRole(Role::WEREWOLF) > 1) {
$werewolves = PlayerListFormatter::format($game->getPlayersOfRole(Role::WEREWOLF));
$client->send("The other werewolves are: {$werewolves}", $dmc);
} else {
$client->send("You are the only werewolf.", $dmc);
}
}
if ($player->role == Role::SEER) {
$client->send("Seer, select a player by saying !see #channel @username.", $dmc);
}
});
}
$playerList = PlayerListFormatter::format($game->getPlayers());
$roleList = RoleListFormatter::format($game->getPlayers());
$msg = ":wolf: A new game of Werewolf is starting! For a tutorial, type !help.\r\n\r\n";
$msg .= "Players: {$playerList}\r\n";
$msg .= "Roles: {$roleList}\r\n\r\n";
$msg .= ":crescent_moon: :zzz: It is the middle of the night and the village is sleeping. The game will begin when the Seer chooses someone.";
$this->client->getChannelGroupOrDMByID($game->getId())->then(function (Channel $channel) use($msg, $client) {
$client->send($msg, $channel);
});
}