Page MenuHomePhabricator (Chris)

GenericmessageCommand.php
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

GenericmessageCommand.php

<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Commands\SystemCommands;
use Longman\TelegramBot\Commands\SystemCommand;
use Longman\TelegramBot\Conversation;
use Longman\TelegramBot\Request;
/**
* Generic message command
*/
class GenericmessageCommand extends SystemCommand
{
/**
* @var string
*/
protected $name = 'genericmessage';
/**
* @var string
*/
protected $description = 'Handle generic message';
/**
* @var string
*/
protected $version = '1.1.0';
/**
* @var bool
*/
protected $need_mysql = true;
/**
* Execution if MySQL is required but not available
*
* @return \Longman\TelegramBot\Entities\ServerResponse
*/
public function executeNoDb()
{
//Do nothing
return Request::emptyResponse();
}
/**
* Execute command
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
//If a conversation is busy, execute the conversation command after handling the message
$conversation = new Conversation(
$this->getMessage()->getFrom()->getId(),
$this->getMessage()->getChat()->getId()
);
//Fetch conversation command if it exists and execute it
if ($conversation->exists() && ($command = $conversation->getCommand())) {
return $this->telegram->executeCommand($command);
}
return Request::emptyResponse();
}
}

File Metadata

Mime Type
text/x-php
Expires
Sun, Nov 15, 12:03 AM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
152000
Default Alt Text
GenericmessageCommand.php (1 KB)

Event Timeline