Small problems fixes.
This commit is contained in:
parent
b51d2f1a6e
commit
8f9bb3a71e
|
@ -135,4 +135,3 @@ services:
|
||||||
- @doctrine.orm.entity_manager
|
- @doctrine.orm.entity_manager
|
||||||
- @twig
|
- @twig
|
||||||
- %point_id%
|
- %point_id%
|
||||||
- %point_login%
|
|
|
@ -75,11 +75,6 @@ class PrivateMessageProcessor
|
||||||
*/
|
*/
|
||||||
private $pointUserId;
|
private $pointUserId;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $pointUserLogin;
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
TgLog $client,
|
TgLog $client,
|
||||||
|
@ -87,8 +82,7 @@ class PrivateMessageProcessor
|
||||||
AccountFactory $accountFactory,
|
AccountFactory $accountFactory,
|
||||||
EntityManagerInterface $em,
|
EntityManagerInterface $em,
|
||||||
\Twig_Environment $twig,
|
\Twig_Environment $twig,
|
||||||
int $pointUserId,
|
int $pointUserId
|
||||||
string $pointUserLogin
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$this->client = $client;
|
$this->client = $client;
|
||||||
|
@ -97,7 +91,6 @@ class PrivateMessageProcessor
|
||||||
$this->em = $em;
|
$this->em = $em;
|
||||||
$this->twig = $twig;
|
$this->twig = $twig;
|
||||||
$this->pointUserId = $pointUserId;
|
$this->pointUserId = $pointUserId;
|
||||||
$this->pointUserLogin = $pointUserLogin;
|
|
||||||
|
|
||||||
$this->userRepo = $em->getRepository('SkobkinPointToolsBundle:User');
|
$this->userRepo = $em->getRepository('SkobkinPointToolsBundle:User');
|
||||||
$this->subscriptionRepo = $em->getRepository('SkobkinPointToolsBundle:Subscription');
|
$this->subscriptionRepo = $em->getRepository('SkobkinPointToolsBundle:Subscription');
|
||||||
|
@ -167,7 +160,6 @@ class PrivateMessageProcessor
|
||||||
|
|
||||||
case '/sub':
|
case '/sub':
|
||||||
case 'sub':
|
case 'sub':
|
||||||
case 'subscribers':
|
|
||||||
if (array_key_exists(1, $words)) {
|
if (array_key_exists(1, $words)) {
|
||||||
if (null !== $user = $this->userRepo->findUserByLogin($words[1])) {
|
if (null !== $user = $this->userRepo->findUserByLogin($words[1])) {
|
||||||
$this->sendUserSubscribers($sendMessage, $user);
|
$this->sendUserSubscribers($sendMessage, $user);
|
||||||
|
@ -175,8 +167,11 @@ class PrivateMessageProcessor
|
||||||
$this->sendError($sendMessage, 'User not found');
|
$this->sendError($sendMessage, 'User not found');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$user = $this->userRepo->findUserByLogin($this->pointUserLogin);
|
if ($user = $account->getUser()) {
|
||||||
$this->sendUserSubscribers($sendMessage, $user);
|
$this->sendUserSubscribers($sendMessage, $user);
|
||||||
|
} else {
|
||||||
|
$this->sendError($sendMessage, 'Account not linked', 'You must /link your account first to be able to use this command.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -298,7 +293,7 @@ class PrivateMessageProcessor
|
||||||
private function createResponseMessage(Message $message, string $parseMode = self::PARSE_MODE_MARKDOWN, bool $disableWebPreview = false): SendMessage
|
private function createResponseMessage(Message $message, string $parseMode = self::PARSE_MODE_MARKDOWN, bool $disableWebPreview = false): SendMessage
|
||||||
{
|
{
|
||||||
$sendMessage = new SendMessage();
|
$sendMessage = new SendMessage();
|
||||||
$sendMessage->chat_id = $message->chat->id;
|
$sendMessage->chat_id = (string) $message->chat->id;
|
||||||
$sendMessage->parse_mode = $parseMode;
|
$sendMessage->parse_mode = $parseMode;
|
||||||
$sendMessage->disable_web_page_preview = $disableWebPreview;
|
$sendMessage->disable_web_page_preview = $disableWebPreview;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue