Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kirill Kholodilin
committed
Nov 21, 2016
1 parent
4766574
commit 34916ac
Showing
2 changed files
with
37 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace Chrl\AppBundle\GameAction; | ||
|
||
use Chrl\AppBundle\Entity\Game; | ||
|
||
class StopAction extends BaseGameAction implements GameActionInterface | ||
{ | ||
public function run($message, $user) | ||
{ | ||
/** @var Game $game */ | ||
$game = $this->gameService->findGame($message); | ||
|
||
if ($game->status == 1) { | ||
$game->status = 0; | ||
|
||
$this->gameService->em->persist($game); | ||
$this->gameService->em->flush(); | ||
$this->botApi->sendMessage($message['chat']['id'], 'The game has stopped!'); | ||
} else { | ||
$this->botApi->sendMessage( | ||
$message['chat']['id'], | ||
'The game is not running...Use /start command to run game.' | ||
); | ||
} | ||
} | ||
} |