Page MenuHomePhabricator (Chris)

NewchatmemberCommand.php
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

NewchatmemberCommand.php

<?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\SystemCommands;
use Longman\TelegramBot\Commands\SystemCommand;
use Longman\TelegramBot\Request;
/**
* New chat member command
*/
class NewchatmemberCommand extends SystemCommand
{
/**#@+
* {@inheritdoc}
*/
protected $name = 'Newchatmember';
protected $description = 'New Chat Member';
protected $version = '1.0.1';
/**#@-*/
/**
* {@inheritdoc}
*/
public function execute()
{
$message = $this->getMessage();
$chat_id = $message->getChat()->getId();
$member = $message->getNewChatMember();
if ($message->botAddedInChat()) {
$text = 'Hi there!';
} else {
$text = 'Hi ' . $member->tryMention() . '!';
}
$data = [
'chat_id' => $chat_id,
'text' => $text,
];
return Request::sendMessage($data);
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Nov 14, 7:13 PM (19 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
138870
Default Alt Text
NewchatmemberCommand.php (1 KB)

Event Timeline