Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F631193
EchoCommand.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
EchoCommand.php
View Options
<?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
\
UserCommands
;
use
Longman
\
TelegramBot
\
Commands
\
UserCommand
;
use
Longman
\
TelegramBot
\
Request
;
/**
* User "/echo" command
*/
class
EchoCommand
extends
UserCommand
{
/**
* @var string
*/
protected
$name
=
'echo'
;
/**
* @var string
*/
protected
$description
=
'Show text'
;
/**
* @var string
*/
protected
$usage
=
'/echo <text>'
;
/**
* @var string
*/
protected
$version
=
'1.1.0'
;
/**
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
function
execute
(
)
{
$message
=
$this
->
getMessage
(
)
;
$chat_id
=
$message
->
getChat
(
)
->
getId
(
)
;
$text
=
trim
(
$message
->
getText
(
true
)
)
;
if
(
$text
===
''
)
{
$text
=
'Command usage: '
.
$this
->
getUsage
(
)
;
}
$data
=
[
'chat_id'
=>
$chat_id
,
'text'
=>
$text
,
]
;
return
Request
::
sendMessage
(
$data
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 15, 11:24 AM (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
137614
Default Alt Text
EchoCommand.php (1 KB)
Attached To
Mode
R123 php-telegram-bot
Attached
Detach File
Event Timeline