PHP code example of californiamountainsnake / longmantelegrambot-utils
1. Go to this page and download the library: Download californiamountainsnake/longmantelegrambot-utils library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
californiamountainsnake / longmantelegrambot-utils example snippets
class TestCommand extends Command
{
use TelegramUtils;
use SendUtils;
use ConversationUtils;
/**
* @var Conversation|null
*/
protected $conversation;
public function getTelegramMessage(): ?Message
{
return $this->getMessage();
}
protected function getStateNoteName(): string
{
return 'state';
}
protected function getConversation(): ?Conversation
{
return $this->conversation;
}
protected function setConversation(?Conversation $_new_conversation_state): void
{
$this->conversation = $_new_conversation_state;
}
/**
* Execute command
*
* @return ServerResponse
* @throws TelegramException
*/
public function execute(): ServerResponse
{
return $this->sendTextMessage('Test!');
}
}