Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F618517
NewchatparticipantCommand.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
NewchatparticipantCommand.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
;
use
Longman
\
TelegramBot
\
Command
;
use
Longman
\
TelegramBot
\
Entities
\
Update
;
use
Longman
\
TelegramBot
\
Request
;
/**
* New chat participant command
*/
class
NewchatparticipantCommand
extends
Command
{
/**
* Name
*
* @var string
*/
protected
$name
=
'Newchatparticipant'
;
/**
* Description
*
* @var string
*/
protected
$description
=
'New Chat Participant'
;
/**
* Usage
*
* @var string
*/
protected
$usage
=
'/'
;
/**
* Version
*
* @var string
*/
protected
$version
=
'1.0.0'
;
/**
* If this command is enabled
*
* @var boolean
*/
protected
$enabled
=
true
;
/**
* Execute command
*
* @return boolean
*/
public
function
execute
(
)
{
$update
=
$this
->
getUpdate
(
)
;
$message
=
$this
->
getMessage
(
)
;
$chat_id
=
$message
->
getChat
(
)
->
getId
(
)
;
$participant
=
$message
->
getNewChatParticipant
(
)
;
if
(
strtolower
(
$participant
->
getUsername
(
)
)
==
strtolower
(
$this
->
getTelegram
(
)
->
getBotName
(
)
)
)
{
$text
=
'Hi there!'
;
}
else
{
$text
=
'Hi '
.
$participant
->
tryMention
(
)
.
' !'
;
}
$data
=
[
'chat_id'
=>
$chat_id
,
'text'
=>
$text
,
]
;
$result
=
Request
::
sendMessage
(
$data
)
;
return
$result
->
isOk
(
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 14, 3:12 PM (1 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
132524
Default Alt Text
NewchatparticipantCommand.php (1 KB)
Attached To
Mode
R123 php-telegram-bot
Attached
Detach File
Event Timeline