Slackwolf\Game\Command\RemindCommand::fire PHP Method

fire() public method

public fire ( )
    public function fire()
    {
        $client = $this->client;
        if ($this->channel[0] == 'D') {
            $client->getDMByUserId($this->userId)->then(function (DirectMessageChannel $dm) use($client) {
                $client->send(":warning: Run this command in the game channel.", $dm);
            });
            return;
        }
        if (!$this->gameManager->hasGame($this->channel)) {
            $client->getChannelGroupOrDMByID($this->channel)->then(function (ChannelInterface $channel) use($client) {
                $client->send(":warning: No game in progress.", $channel);
            });
            return;
        }
        // Look for current game and player
        $game = $this->gameManager->getGame($this->channel);
        $player = $game->getPlayerById($this->userId);
        $roleName = $player->role->getName();
        $roleDescription = $player->role->getDescription();
        // DM the player his current role and description
        $reminder_msg = "Your current role is:\r\n" . '_' . $roleName . '_ - ' . $roleDescription;
        $client->getDMByUserID($player->getId())->then(function (DirectMessageChannel $dm) use($client, $reminder_msg) {
            $client->send($reminder_msg, $dm);
        });
    }
RemindCommand