californiamountainsnake / longmantelegrambot-inlinecalendar
This package is abandoned and no longer maintained.
No replacement package was suggested.
This is the calendar in form of inline keyboard.
1.4.3
2021-05-03 11:15 UTC
Requires
- php: ^7.1
- ext-curl: *
- ext-json: *
- californiamountainsnake/longmantelegrambot-inlinemenu: ^1.2.0
- californiamountainsnake/php-utils: ^1.0.11
- myclabs/php-enum: ^1.5
- psr/log: ^1.1
Requires (Dev)
- ext-dom: *
- phpunit/phpunit: ^7.0
README
This is the calendar in form of inline keyboard intended for using with longman/telegram-bot
and californiamountainsnake/longmantelegrambot-inlinemenu
libraries.
Install:
Require this package with Composer
Install this package through Composer.
Edit your project's composer.json
file to require californiamountainsnake/longmantelegrambot-inlinecalendar
:
{ "name": "yourproject/yourproject", "type": "project", "require": { "php": "^7.1", "californiamountainsnake/longmantelegrambot-inlinecalendar": "*" } }
and run composer update
or
run this command in your command line:
composer require californiamountainsnake/longmantelegrambot-inlinecalendar
Usage:
- Include trait into your bot command and realise the abstract methods (mostly contains lang strings):
<?php class TestCommand extends BaseUserCommand { use InlineCalendar; }
- Create the calendar config:
<?php class TestCommand extends BaseUserCommand { use InlineCalendar; private function getCalendarConfig(): CalendarConfig { $min = [2019, 8, 28]; $max = [2037, 12, 31]; $def = $min; return new CalendarConfig('Date selection', $min, $max, $def); } }
- Use calendar!
<?php class TestCommand extends BaseUserCommand { use InlineCalendar; public function execute(): ServerResponse { // Conversation start $this->startConversation(); $isSelected = $this->selectDate($this->getCalendarConfig(), 'Please select the date:', $this->getMessage()); if (!$isSelected) { return $this->emptyResponse(); } $msg = $this->sendTextMessage (\print_r($this->getCalendarDate($this->getCalendarConfig()), true)); $this->stopConversation(); return $msg; } }