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
36787d67
Commit
36787d67
authored
Aug 24, 2016
by
Avtandil Kikabidze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved code and doc-blocks in system commands
parent
84cd8f50
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
213 additions
and
96 deletions
+213
-96
ChatsCommand.php
src/Commands/AdminCommands/ChatsCommand.php
+2
-2
CallbackqueryCommand.php
src/Commands/SystemCommands/CallbackqueryCommand.php
+18
-9
ChannelchatcreatedCommand.php
src/Commands/SystemCommands/ChannelchatcreatedCommand.php
+9
-5
ChoseninlineresultCommand.php
src/Commands/SystemCommands/ChoseninlineresultCommand.php
+10
-6
DeletechatphotoCommand.php
src/Commands/SystemCommands/DeletechatphotoCommand.php
+9
-5
EditedmessageCommand.php
src/Commands/SystemCommands/EditedmessageCommand.php
+9
-5
GenericCommand.php
src/Commands/SystemCommands/GenericCommand.php
+13
-4
GenericmessageCommand.php
src/Commands/SystemCommands/GenericmessageCommand.php
+16
-5
GroupchatcreatedCommand.php
src/Commands/SystemCommands/GroupchatcreatedCommand.php
+9
-5
InlinequeryCommand.php
src/Commands/SystemCommands/InlinequeryCommand.php
+34
-10
LeftchatmemberCommand.php
src/Commands/SystemCommands/LeftchatmemberCommand.php
+9
-5
MigratefromchatidCommand.php
src/Commands/SystemCommands/MigratefromchatidCommand.php
+9
-5
MigratetochatidCommand.php
src/Commands/SystemCommands/MigratetochatidCommand.php
+9
-5
NewchatmemberCommand.php
src/Commands/SystemCommands/NewchatmemberCommand.php
+12
-5
NewchatphotoCommand.php
src/Commands/SystemCommands/NewchatphotoCommand.php
+9
-5
NewchattitleCommand.php
src/Commands/SystemCommands/NewchattitleCommand.php
+9
-5
StartCommand.php
src/Commands/SystemCommands/StartCommand.php
+18
-5
SupergroupchatcreatedCommand.php
src/Commands/SystemCommands/SupergroupchatcreatedCommand.php
+9
-5
No files found.
src/Commands/AdminCommands/ChatsCommand.php
View file @
36787d67
...
@@ -83,8 +83,8 @@ class ChatsCommand extends AdminCommand
...
@@ -83,8 +83,8 @@ class ChatsCommand extends AdminCommand
$whois
=
$chat
->
getId
();
$whois
=
$chat
->
getId
();
if
(
$this
->
telegram
->
getCommandObject
(
'whois'
))
{
if
(
$this
->
telegram
->
getCommandObject
(
'whois'
))
{
$whois
=
'/whois'
.
str_replace
(
'-'
,
'g'
,
// We can't use '-' in command because part of it will become unclickable
$chat
->
getId
());
//We can't use '-' in command because part of it will become unclickable
$whois
=
'/whois'
.
str_replace
(
'-'
,
'g'
,
$chat
->
getId
());
}
}
if
(
$chat
->
isPrivateChat
())
{
if
(
$chat
->
isPrivateChat
())
{
...
...
src/Commands/SystemCommands/CallbackqueryCommand.php
View file @
36787d67
...
@@ -18,16 +18,25 @@ use Longman\TelegramBot\Request;
...
@@ -18,16 +18,25 @@ use Longman\TelegramBot\Request;
*/
*/
class
CallbackqueryCommand
extends
SystemCommand
class
CallbackqueryCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'callbackquery'
;
protected
$name
=
'callbackquery'
;
/**
* @var string
*/
protected
$description
=
'Reply to callback query'
;
protected
$description
=
'Reply to callback query'
;
/**
* @var string
*/
protected
$version
=
'1.0.0'
;
protected
$version
=
'1.0.0'
;
/**#@-*/
/**
/**
* {@inheritdoc}
* Command execute method
*
* @return mixed
*/
*/
public
function
execute
()
public
function
execute
()
{
{
...
...
src/Commands/SystemCommands/ChannelchatcreatedCommand.php
View file @
36787d67
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
*/
*/
class
ChannelchatcreatedCommand
extends
SystemCommand
class
ChannelchatcreatedCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'Channelchatcreated'
;
protected
$name
=
'Channelchatcreated'
;
/**
* @var string
*/
protected
$description
=
'Channel chat created'
;
protected
$description
=
'Channel chat created'
;
protected
$version
=
'1.0.1'
;
/**#@-*/
/**
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$version
=
'1.0.1'
;
/*public function execute()
/*public function execute()
{
{
//$message = $this->getMessage();
//$message = $this->getMessage();
...
...
src/Commands/SystemCommands/ChoseninlineresultCommand.php
View file @
36787d67
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
*/
*/
class
ChoseninlineresultCommand
extends
SystemCommand
class
ChoseninlineresultCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'choseninlineresult'
;
protected
$name
=
'choseninlineresult'
;
/**
* @var string
*/
protected
$description
=
'Chosen result query'
;
protected
$description
=
'Chosen result query'
;
protected
$version
=
'1.0.1'
;
/**#@-*/
/**
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$version
=
'1.0.1'
;
/*public function execute()
/*public function execute()
{
{
//Information about chosen result is returned
//Information about chosen result is returned
...
...
src/Commands/SystemCommands/DeletechatphotoCommand.php
View file @
36787d67
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
*/
*/
class
DeletechatphotoCommand
extends
SystemCommand
class
DeletechatphotoCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'Deletechatphoto'
;
protected
$name
=
'Deletechatphoto'
;
/**
* @var string
*/
protected
$description
=
'Delete chat photo'
;
protected
$description
=
'Delete chat photo'
;
protected
$version
=
'1.0.1'
;
/**#@-*/
/**
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$version
=
'1.0.1'
;
/*public function execute()
/*public function execute()
{
{
//$message = $this->getMessage();
//$message = $this->getMessage();
...
...
src/Commands/SystemCommands/EditedmessageCommand.php
View file @
36787d67
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
*/
*/
class
EditedmessageCommand
extends
SystemCommand
class
EditedmessageCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'editedmessage'
;
protected
$name
=
'editedmessage'
;
/**
* @var string
*/
protected
$description
=
'User edited message'
;
protected
$description
=
'User edited message'
;
protected
$version
=
'1.0.0'
;
/**#@-*/
/**
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$version
=
'1.0.0'
;
/*public function execute()
/*public function execute()
{
{
$update = $this->getUpdate();
$update = $this->getUpdate();
...
...
src/Commands/SystemCommands/GenericCommand.php
View file @
36787d67
...
@@ -18,16 +18,25 @@ use Longman\TelegramBot\Request;
...
@@ -18,16 +18,25 @@ use Longman\TelegramBot\Request;
*/
*/
class
GenericCommand
extends
SystemCommand
class
GenericCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'Generic'
;
protected
$name
=
'Generic'
;
/**
* @var string
*/
protected
$description
=
'Handles generic commands or is executed by default when a command is not found'
;
protected
$description
=
'Handles generic commands or is executed by default when a command is not found'
;
/**
* @var string
*/
protected
$version
=
'1.0.1'
;
protected
$version
=
'1.0.1'
;
/**#@-*/
/**
/**
* {@inheritdoc}
* Command execute method
*
* @return mixed
*/
*/
public
function
execute
()
public
function
execute
()
{
{
...
...
src/Commands/SystemCommands/GenericmessageCommand.php
View file @
36787d67
...
@@ -19,19 +19,30 @@ use Longman\TelegramBot\Commands\SystemCommand;
...
@@ -19,19 +19,30 @@ use Longman\TelegramBot\Commands\SystemCommand;
*/
*/
class
GenericmessageCommand
extends
SystemCommand
class
GenericmessageCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'Genericmessage'
;
protected
$name
=
'Genericmessage'
;
/**
* @var string
*/
protected
$description
=
'Handle generic message'
;
protected
$description
=
'Handle generic message'
;
/**
* @var string
*/
protected
$version
=
'1.0.2'
;
protected
$version
=
'1.0.2'
;
/**
* @var bool
*/
protected
$need_mysql
=
true
;
protected
$need_mysql
=
true
;
/**#@-*/
/**
/**
* Execution if MySQL is required but not available
* Execution if MySQL is required but not available
*
*
* @return
boolean
* @return
\Longman\TelegramBot\Entities\ServerResponse
*/
*/
public
function
executeNoDb
()
public
function
executeNoDb
()
{
{
...
@@ -42,7 +53,7 @@ class GenericmessageCommand extends SystemCommand
...
@@ -42,7 +53,7 @@ class GenericmessageCommand extends SystemCommand
/**
/**
* Execute command
* Execute command
*
*
* @return
boolean
* @return
\Longman\TelegramBot\Entities\ServerResponse
*/
*/
public
function
execute
()
public
function
execute
()
{
{
...
...
src/Commands/SystemCommands/GroupchatcreatedCommand.php
View file @
36787d67
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
*/
*/
class
GroupchatcreatedCommand
extends
SystemCommand
class
GroupchatcreatedCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'Groupchatcreated'
;
protected
$name
=
'Groupchatcreated'
;
/**
* @var string
*/
protected
$description
=
'Group chat created'
;
protected
$description
=
'Group chat created'
;
protected
$version
=
'1.0.1'
;
/**#@-*/
/**
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$version
=
'1.0.1'
;
/*public function execute()
/*public function execute()
{
{
//$message = $this->getMessage();
//$message = $this->getMessage();
...
...
src/Commands/SystemCommands/InlinequeryCommand.php
View file @
36787d67
...
@@ -20,16 +20,25 @@ use Longman\TelegramBot\Request;
...
@@ -20,16 +20,25 @@ use Longman\TelegramBot\Request;
*/
*/
class
InlinequeryCommand
extends
SystemCommand
class
InlinequeryCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'inlinequery'
;
protected
$name
=
'inlinequery'
;
/**
* @var string
*/
protected
$description
=
'Reply to inline query'
;
protected
$description
=
'Reply to inline query'
;
/**
* @var string
*/
protected
$version
=
'1.0.2'
;
protected
$version
=
'1.0.2'
;
/**#@-*/
/**
/**
* {@inheritdoc}
* Command execute method
*
* @return mixed
*/
*/
public
function
execute
()
public
function
execute
()
{
{
...
@@ -42,9 +51,24 @@ class InlinequeryCommand extends SystemCommand
...
@@ -42,9 +51,24 @@ class InlinequeryCommand extends SystemCommand
if
(
$query
!==
''
)
{
if
(
$query
!==
''
)
{
$articles
=
[
$articles
=
[
[
'id'
=>
'001'
,
'title'
=>
'https://core.telegram.org/bots/api#answerinlinequery'
,
'description'
=>
'you enter: '
.
$query
,
'input_message_content'
=>
new
InputTextMessageContent
([
'message_text'
=>
' '
.
$query
])],
[
[
'id'
=>
'002'
,
'title'
=>
'https://core.telegram.org/bots/api#answerinlinequery'
,
'description'
=>
'you enter: '
.
$query
,
'input_message_content'
=>
new
InputTextMessageContent
([
'message_text'
=>
' '
.
$query
])],
'id'
=>
'001'
,
[
'id'
=>
'003'
,
'title'
=>
'https://core.telegram.org/bots/api#answerinlinequery'
,
'description'
=>
'you enter: '
.
$query
,
'input_message_content'
=>
new
InputTextMessageContent
([
'message_text'
=>
' '
.
$query
])],
'title'
=>
'https://core.telegram.org/bots/api#answerinlinequery'
,
'description'
=>
'you enter: '
.
$query
,
'input_message_content'
=>
new
InputTextMessageContent
([
'message_text'
=>
' '
.
$query
])
],
[
'id'
=>
'002'
,
'title'
=>
'https://core.telegram.org/bots/api#answerinlinequery'
,
'description'
=>
'you enter: '
.
$query
,
'input_message_content'
=>
new
InputTextMessageContent
([
'message_text'
=>
' '
.
$query
])
],
[
'id'
=>
'003'
,
'title'
=>
'https://core.telegram.org/bots/api#answerinlinequery'
,
'description'
=>
'you enter: '
.
$query
,
'input_message_content'
=>
new
InputTextMessageContent
([
'message_text'
=>
' '
.
$query
])
],
];
];
foreach
(
$articles
as
$article
)
{
foreach
(
$articles
as
$article
)
{
...
...
src/Commands/SystemCommands/LeftchatmemberCommand.php
View file @
36787d67
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
*/
*/
class
LeftchatmemberCommand
extends
SystemCommand
class
LeftchatmemberCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'Leftchatmember'
;
protected
$name
=
'Leftchatmember'
;
/**
* @var string
*/
protected
$description
=
'Left Chat Member'
;
protected
$description
=
'Left Chat Member'
;
protected
$version
=
'1.0.1'
;
/**#@-*/
/**
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$version
=
'1.0.1'
;
/*public function execute()
/*public function execute()
{
{
//$message = $this->getMessage();
//$message = $this->getMessage();
...
...
src/Commands/SystemCommands/MigratefromchatidCommand.php
View file @
36787d67
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
*/
*/
class
MigratefromchatidCommand
extends
SystemCommand
class
MigratefromchatidCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'Migratefromchatid'
;
protected
$name
=
'Migratefromchatid'
;
/**
* @var string
*/
protected
$description
=
'Migrate from chat id'
;
protected
$description
=
'Migrate from chat id'
;
protected
$version
=
'1.0.1'
;
/**#@-*/
/**
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$version
=
'1.0.1'
;
/*public function execute()
/*public function execute()
{
{
//$message = $this->getMessage();
//$message = $this->getMessage();
...
...
src/Commands/SystemCommands/MigratetochatidCommand.php
View file @
36787d67
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
*/
*/
class
MigratetochatidCommand
extends
SystemCommand
class
MigratetochatidCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'Migratetochatid'
;
protected
$name
=
'Migratetochatid'
;
/**
* @var string
*/
protected
$description
=
'Migrate to chat id'
;
protected
$description
=
'Migrate to chat id'
;
protected
$version
=
'1.0.1'
;
/**#@-*/
/**
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$version
=
'1.0.1'
;
/*public function execute()
/*public function execute()
{
{
//$message = $this->getMessage();
//$message = $this->getMessage();
...
...
src/Commands/SystemCommands/NewchatmemberCommand.php
View file @
36787d67
...
@@ -18,16 +18,23 @@ use Longman\TelegramBot\Request;
...
@@ -18,16 +18,23 @@ use Longman\TelegramBot\Request;
*/
*/
class
NewchatmemberCommand
extends
SystemCommand
class
NewchatmemberCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'Newchatmember'
;
protected
$name
=
'Newchatmember'
;
/**
* @var string
*/
protected
$description
=
'New Chat Member'
;
protected
$description
=
'New Chat Member'
;
/**
* @var string
*/
protected
$version
=
'1.0.1'
;
protected
$version
=
'1.0.1'
;
/**#@-*/
/**
/**
*
{@inheritdoc}
*
@return mixed
*/
*/
public
function
execute
()
public
function
execute
()
{
{
...
...
src/Commands/SystemCommands/NewchatphotoCommand.php
View file @
36787d67
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
*/
*/
class
NewchatphotoCommand
extends
SystemCommand
class
NewchatphotoCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'Newchatphoto'
;
protected
$name
=
'Newchatphoto'
;
/**
* @var string
*/
protected
$description
=
'New chat Photo'
;
protected
$description
=
'New chat Photo'
;
protected
$version
=
'1.0.1'
;
/**#@-*/
/**
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$version
=
'1.0.1'
;
/*public function execute()
/*public function execute()
{
{
//$message = $this->getMessage();
//$message = $this->getMessage();
...
...
src/Commands/SystemCommands/NewchattitleCommand.php
View file @
36787d67
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
*/
*/
class
NewchattitleCommand
extends
SystemCommand
class
NewchattitleCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'Newchattitle'
;
protected
$name
=
'Newchattitle'
;
/**
* @var string
*/
protected
$description
=
'New chat Title'
;
protected
$description
=
'New chat Title'
;
protected
$version
=
'1.0.1'
;
/**#@-*/
/**
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$version
=
'1.0.1'
;
/*public function execute()
/*public function execute()
{
{
//$message = $this->getMessage();
//$message = $this->getMessage();
...
...
src/Commands/SystemCommands/StartCommand.php
View file @
36787d67
...
@@ -18,17 +18,30 @@ use Longman\TelegramBot\Request;
...
@@ -18,17 +18,30 @@ use Longman\TelegramBot\Request;
*/
*/
class
StartCommand
extends
SystemCommand
class
StartCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'start'
;
protected
$name
=
'start'
;
/**
* @var string
*/
protected
$description
=
'Start command'
;
protected
$description
=
'Start command'
;
/**
* @var string
*/
protected
$usage
=
'/start'
;
protected
$usage
=
'/start'
;
/**
* @var string
*/
protected
$version
=
'1.0.1'
;
protected
$version
=
'1.0.1'
;
/**#@-*/
/**
/**
* {@inheritdoc}
* Command execute method
*
* @return mixed
*/
*/
public
function
execute
()
public
function
execute
()
{
{
...
...
src/Commands/SystemCommands/SupergroupchatcreatedCommand.php
View file @
36787d67
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
...
@@ -17,17 +17,21 @@ use Longman\TelegramBot\Commands\SystemCommand;
*/
*/
class
SupergroupchatcreatedCommand
extends
SystemCommand
class
SupergroupchatcreatedCommand
extends
SystemCommand
{
{
/**
#@+
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$name
=
'Supergroupchatcreated'
;
protected
$name
=
'Supergroupchatcreated'
;
/**
* @var string
*/
protected
$description
=
'Super group chat created'
;
protected
$description
=
'Super group chat created'
;
protected
$version
=
'1.0.1'
;
/**#@-*/
/**
/**
*
{@inheritdoc}
*
@var string
*/
*/
protected
$version
=
'1.0.1'
;
/*public function execute()
/*public function execute()
{
{
//$message = $this->getMessage();
//$message = $this->getMessage();
...
...
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