Commit 75468f60 authored by MBoretto's avatar MBoretto

Merge remote-tracking branch 'upstream/develop' into feature/smartinterface

parents 0a3ee2e5 f548fa02
......@@ -10,7 +10,7 @@
namespace Longman\TelegramBot\Commands;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Request;
/**
* Abstract System Command Class
......@@ -27,7 +27,7 @@ abstract class SystemCommand extends Command
*/
public function execute()
{
//System command, return successful ServerResponse
return new ServerResponse(['ok' => true, 'result' => true], null);
//System command, return empty ServerResponse
return Request::emptyResponse();
}
}
......@@ -109,6 +109,7 @@ class Request
* @todo Take log verbosity into account
*
* @param string $string
*
* @return mixed
*/
private static function log($string)
......@@ -129,6 +130,7 @@ class Request
* Generate general fake server response
*
* @param array $data Data to add to fake response
*
* @return array Fake response data
*/
public static function generateGeneralFakeServerResponse(array $data = null)
......@@ -167,6 +169,7 @@ class Request
*
* @param string $action Action to execute
* @param array|null $data Data to attach to the execution
*
* @return mixed Result of the cURL call
*/
public static function executeCurl($action, array $data = null)
......@@ -227,6 +230,7 @@ class Request
* Download file
*
* @param Entities\File $file
*
* @return boolean
*/
public static function downloadFile(File $file)
......@@ -281,6 +285,7 @@ class Request
* Encode file
*
* @param string $file
*
* @return CURLFile
*/
protected static function encodeFile($file)
......@@ -296,6 +301,7 @@ class Request
*
* @param string $action
* @param array|null $data
*
* @return Entities\ServerResponse
*/
public static function send($action, array $data = null)
......@@ -331,6 +337,7 @@ class Request
* @todo Could do with some cleaner recursion
*
* @param array $data
*
* @return mixed
*/
public static function sendMessage(array $data)
......@@ -353,6 +360,7 @@ class Request
* Forward message
*
* @param array $data
*
* @return mixed
*/
public static function forwardMessage(array $data)
......@@ -369,6 +377,7 @@ class Request
*
* @param array $data
* @param string $file
*
* @return mixed
*/
public static function sendPhoto(array $data, $file = null)
......@@ -389,6 +398,7 @@ class Request
*
* @param array $data
* @param string $file
*
* @return mixed
*/
public static function sendAudio(array $data, $file = null)
......@@ -409,6 +419,7 @@ class Request
*
* @param array $data
* @param string $file
*
* @return mixed
*/
public static function sendDocument(array $data, $file = null)
......@@ -429,6 +440,7 @@ class Request
*
* @param array $data
* @param string $file
*
* @return mixed
*/
public static function sendSticker(array $data, $file = null)
......@@ -449,6 +461,7 @@ class Request
*
* @param array $data
* @param string $file
*
* @return mixed
*/
public static function sendVideo(array $data, $file = null)
......@@ -469,6 +482,7 @@ class Request
*
* @param array $data
* @param string $file
*
* @return mixed
*/
public static function sendVoice(array $data, $file = null)
......@@ -488,6 +502,7 @@ class Request
* Send location
*
* @param array $data
*
* @return mixed
*/
public static function sendLocation(array $data)
......@@ -503,6 +518,7 @@ class Request
* Send chat action
*
* @param array $data
*
* @return mixed
*/
public static function sendChatAction(array $data)
......@@ -518,6 +534,7 @@ class Request
* Get user profile photos
*
* @param array $data
*
* @return mixed
*/
public static function getUserProfilePhotos(array $data)
......@@ -537,6 +554,7 @@ class Request
* Get updates
*
* @param array $data
*
* @return mixed
*/
public static function getUpdates(array $data)
......@@ -549,6 +567,7 @@ class Request
*
* @param string $url
* @param string $file
*
* @return mixed
*/
public static function setWebhook($url = '', $file = null)
......@@ -566,6 +585,7 @@ class Request
* Get file
*
* @param array $data
*
* @return mixed
*/
public static function getFile(array $data)
......@@ -581,6 +601,7 @@ class Request
* Answer inline query
*
* @param array $data
*
* @return mixed
*/
public static function answerInlineQuery(array $data)
......@@ -592,6 +613,19 @@ class Request
return self::send('answerInlineQuery', $data);
}
/**
* Return an empty Server Response
*
* No request to telegram are sent, this function is used in commands that
* don't need to fire a message after execution
*
* @return Entities\ServerResponse
*/
public static function emptyResponse()
{
return new ServerResponse(['ok' => true, 'result' => true], null);
}
/**
* Send message to all active chats
*
......@@ -602,6 +636,7 @@ class Request
* @param boolean $send_users
* @param string $date_from
* @param string $date_to
*
* @return array
*/
public static function sendToActiveChats(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment