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\Conversation;
use Longman\TelegramBot\Request;
use Longman\TelegramBot\Commands\SystemCommand;
/**
* Generic message command
*/
class GenericmessageCommand extends SystemCommand
{
/**#@+
* {@inheritdoc}
*/
protected $name = 'Genericmessage';
protected $description = 'Handle generic message';
protected $version = '1.0.2';
protected $need_mysql = true;
/**#@-*/
/**
* Execution if MySQL is required but not available
*
* @return boolean
*/
public function executeNoDB()
{
//Do nothing
return Request::emptyResponse();
}
/**
* Execute command
*
* @return boolean
*/
public function execute()
{
//If a conversation is busy, execute the conversation command after handling the message
$conversation = new Conversation(
$this->getMessage()->getChat()->getId(),
$this->getMessage()->getFrom()->getId()
);
//Fetch conversation command if it exists and execute it
if ($conversation->exists() && ($command = $conversation->getCommand())) {
return $this->telegram->executeCommand($command, $this->update);
}
return Request::emptyResponse();
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Nov 14, 9:59 PM (11 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
151747
Default Alt Text
GenericmessageCommand.php (1 KB)

Event Timeline