Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
75468f60
Commit
75468f60
authored
Feb 26, 2016
by
MBoretto
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/develop' into feature/smartinterface
parents
0a3ee2e5
f548fa02
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
3 deletions
+38
-3
SystemCommand.php
src/Commands/SystemCommand.php
+3
-3
Request.php
src/Request.php
+35
-0
No files found.
src/Commands/SystemCommand.php
View file @
75468f60
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
namespace
Longman\TelegramBot\Commands
;
namespace
Longman\TelegramBot\Commands
;
use
Longman\TelegramBot\
Entities\ServerResponse
;
use
Longman\TelegramBot\
Request
;
/**
/**
* Abstract System Command Class
* Abstract System Command Class
...
@@ -27,7 +27,7 @@ abstract class SystemCommand extends Command
...
@@ -27,7 +27,7 @@ abstract class SystemCommand extends Command
*/
*/
public
function
execute
()
public
function
execute
()
{
{
//System command, return
successful
ServerResponse
//System command, return
empty
ServerResponse
return
new
ServerResponse
([
'ok'
=>
true
,
'result'
=>
true
],
null
);
return
Request
::
emptyResponse
(
);
}
}
}
}
src/Request.php
View file @
75468f60
...
@@ -109,6 +109,7 @@ class Request
...
@@ -109,6 +109,7 @@ class Request
* @todo Take log verbosity into account
* @todo Take log verbosity into account
*
*
* @param string $string
* @param string $string
*
* @return mixed
* @return mixed
*/
*/
private
static
function
log
(
$string
)
private
static
function
log
(
$string
)
...
@@ -129,6 +130,7 @@ class Request
...
@@ -129,6 +130,7 @@ class Request
* Generate general fake server response
* Generate general fake server response
*
*
* @param array $data Data to add to fake response
* @param array $data Data to add to fake response
*
* @return array Fake response data
* @return array Fake response data
*/
*/
public
static
function
generateGeneralFakeServerResponse
(
array
$data
=
null
)
public
static
function
generateGeneralFakeServerResponse
(
array
$data
=
null
)
...
@@ -167,6 +169,7 @@ class Request
...
@@ -167,6 +169,7 @@ class Request
*
*
* @param string $action Action to execute
* @param string $action Action to execute
* @param array|null $data Data to attach to the execution
* @param array|null $data Data to attach to the execution
*
* @return mixed Result of the cURL call
* @return mixed Result of the cURL call
*/
*/
public
static
function
executeCurl
(
$action
,
array
$data
=
null
)
public
static
function
executeCurl
(
$action
,
array
$data
=
null
)
...
@@ -227,6 +230,7 @@ class Request
...
@@ -227,6 +230,7 @@ class Request
* Download file
* Download file
*
*
* @param Entities\File $file
* @param Entities\File $file
*
* @return boolean
* @return boolean
*/
*/
public
static
function
downloadFile
(
File
$file
)
public
static
function
downloadFile
(
File
$file
)
...
@@ -281,6 +285,7 @@ class Request
...
@@ -281,6 +285,7 @@ class Request
* Encode file
* Encode file
*
*
* @param string $file
* @param string $file
*
* @return CURLFile
* @return CURLFile
*/
*/
protected
static
function
encodeFile
(
$file
)
protected
static
function
encodeFile
(
$file
)
...
@@ -296,6 +301,7 @@ class Request
...
@@ -296,6 +301,7 @@ class Request
*
*
* @param string $action
* @param string $action
* @param array|null $data
* @param array|null $data
*
* @return Entities\ServerResponse
* @return Entities\ServerResponse
*/
*/
public
static
function
send
(
$action
,
array
$data
=
null
)
public
static
function
send
(
$action
,
array
$data
=
null
)
...
@@ -331,6 +337,7 @@ class Request
...
@@ -331,6 +337,7 @@ class Request
* @todo Could do with some cleaner recursion
* @todo Could do with some cleaner recursion
*
*
* @param array $data
* @param array $data
*
* @return mixed
* @return mixed
*/
*/
public
static
function
sendMessage
(
array
$data
)
public
static
function
sendMessage
(
array
$data
)
...
@@ -353,6 +360,7 @@ class Request
...
@@ -353,6 +360,7 @@ class Request
* Forward message
* Forward message
*
*
* @param array $data
* @param array $data
*
* @return mixed
* @return mixed
*/
*/
public
static
function
forwardMessage
(
array
$data
)
public
static
function
forwardMessage
(
array
$data
)
...
@@ -369,6 +377,7 @@ class Request
...
@@ -369,6 +377,7 @@ class Request
*
*
* @param array $data
* @param array $data
* @param string $file
* @param string $file
*
* @return mixed
* @return mixed
*/
*/
public
static
function
sendPhoto
(
array
$data
,
$file
=
null
)
public
static
function
sendPhoto
(
array
$data
,
$file
=
null
)
...
@@ -389,6 +398,7 @@ class Request
...
@@ -389,6 +398,7 @@ class Request
*
*
* @param array $data
* @param array $data
* @param string $file
* @param string $file
*
* @return mixed
* @return mixed
*/
*/
public
static
function
sendAudio
(
array
$data
,
$file
=
null
)
public
static
function
sendAudio
(
array
$data
,
$file
=
null
)
...
@@ -409,6 +419,7 @@ class Request
...
@@ -409,6 +419,7 @@ class Request
*
*
* @param array $data
* @param array $data
* @param string $file
* @param string $file
*
* @return mixed
* @return mixed
*/
*/
public
static
function
sendDocument
(
array
$data
,
$file
=
null
)
public
static
function
sendDocument
(
array
$data
,
$file
=
null
)
...
@@ -429,6 +440,7 @@ class Request
...
@@ -429,6 +440,7 @@ class Request
*
*
* @param array $data
* @param array $data
* @param string $file
* @param string $file
*
* @return mixed
* @return mixed
*/
*/
public
static
function
sendSticker
(
array
$data
,
$file
=
null
)
public
static
function
sendSticker
(
array
$data
,
$file
=
null
)
...
@@ -449,6 +461,7 @@ class Request
...
@@ -449,6 +461,7 @@ class Request
*
*
* @param array $data
* @param array $data
* @param string $file
* @param string $file
*
* @return mixed
* @return mixed
*/
*/
public
static
function
sendVideo
(
array
$data
,
$file
=
null
)
public
static
function
sendVideo
(
array
$data
,
$file
=
null
)
...
@@ -469,6 +482,7 @@ class Request
...
@@ -469,6 +482,7 @@ class Request
*
*
* @param array $data
* @param array $data
* @param string $file
* @param string $file
*
* @return mixed
* @return mixed
*/
*/
public
static
function
sendVoice
(
array
$data
,
$file
=
null
)
public
static
function
sendVoice
(
array
$data
,
$file
=
null
)
...
@@ -488,6 +502,7 @@ class Request
...
@@ -488,6 +502,7 @@ class Request
* Send location
* Send location
*
*
* @param array $data
* @param array $data
*
* @return mixed
* @return mixed
*/
*/
public
static
function
sendLocation
(
array
$data
)
public
static
function
sendLocation
(
array
$data
)
...
@@ -503,6 +518,7 @@ class Request
...
@@ -503,6 +518,7 @@ class Request
* Send chat action
* Send chat action
*
*
* @param array $data
* @param array $data
*
* @return mixed
* @return mixed
*/
*/
public
static
function
sendChatAction
(
array
$data
)
public
static
function
sendChatAction
(
array
$data
)
...
@@ -518,6 +534,7 @@ class Request
...
@@ -518,6 +534,7 @@ class Request
* Get user profile photos
* Get user profile photos
*
*
* @param array $data
* @param array $data
*
* @return mixed
* @return mixed
*/
*/
public
static
function
getUserProfilePhotos
(
array
$data
)
public
static
function
getUserProfilePhotos
(
array
$data
)
...
@@ -537,6 +554,7 @@ class Request
...
@@ -537,6 +554,7 @@ class Request
* Get updates
* Get updates
*
*
* @param array $data
* @param array $data
*
* @return mixed
* @return mixed
*/
*/
public
static
function
getUpdates
(
array
$data
)
public
static
function
getUpdates
(
array
$data
)
...
@@ -549,6 +567,7 @@ class Request
...
@@ -549,6 +567,7 @@ class Request
*
*
* @param string $url
* @param string $url
* @param string $file
* @param string $file
*
* @return mixed
* @return mixed
*/
*/
public
static
function
setWebhook
(
$url
=
''
,
$file
=
null
)
public
static
function
setWebhook
(
$url
=
''
,
$file
=
null
)
...
@@ -566,6 +585,7 @@ class Request
...
@@ -566,6 +585,7 @@ class Request
* Get file
* Get file
*
*
* @param array $data
* @param array $data
*
* @return mixed
* @return mixed
*/
*/
public
static
function
getFile
(
array
$data
)
public
static
function
getFile
(
array
$data
)
...
@@ -581,6 +601,7 @@ class Request
...
@@ -581,6 +601,7 @@ class Request
* Answer inline query
* Answer inline query
*
*
* @param array $data
* @param array $data
*
* @return mixed
* @return mixed
*/
*/
public
static
function
answerInlineQuery
(
array
$data
)
public
static
function
answerInlineQuery
(
array
$data
)
...
@@ -592,6 +613,19 @@ class Request
...
@@ -592,6 +613,19 @@ class Request
return
self
::
send
(
'answerInlineQuery'
,
$data
);
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
* Send message to all active chats
*
*
...
@@ -602,6 +636,7 @@ class Request
...
@@ -602,6 +636,7 @@ class Request
* @param boolean $send_users
* @param boolean $send_users
* @param string $date_from
* @param string $date_from
* @param string $date_to
* @param string $date_to
*
* @return array
* @return array
*/
*/
public
static
function
sendToActiveChats
(
public
static
function
sendToActiveChats
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment