2017 © Pedro Peláez
 

package telebot

Telegram bot with dialogs and session management

image

prowebcraft/telebot

Telegram bot with dialogs and session management

  • Sunday, July 29, 2018
  • by prowebcraft
  • Repository
  • 1 Watchers
  • 2 Stars
  • 81 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 12 Versions
  • 9 % Grown

The README.md

Telegram Bot Framework

Telegram bot with dialogs support and session management, (*1)

PHP Telegram Bot Api

Latest Version on Packagist Software License Total Downloads, (*2)

Based on php wrapper for Telegram Bot API, telebot provides flexible diablogs system (inlines and buttons mode), ability to track responses. Telebot can work in daemon or webhook mode., (*3)

Bots: An introduction for developers

Bots are special Telegram accounts designed to handle messages automatically. Users can interact with bots by sending them command messages in private or group chats., (*4)

You control your bots using HTTPS requests to bot API., (*5)

The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram. To learn how to create and set up a bot, please consult Introduction to Bots and Bot FAQ., (*6)

Install

Via Composer, (*7)

``` bash $ composer require prowebcraft/telebot, (*8)


## Usage See example [Telegram Id Bot](https://github.com/prowebcraft/telegram-id-bot). This bot in Telegram - [@identybot](https://t.me/identybot) #### Create your bot YourBot.php class extended of \Prowebcraft\Telebot\Telebot ``` php <?php class YourBot extends \Prowebcraft\Telebot\Telebot { }

Create some public methods with Command suffix

/**
* Welcome message based on context
*/
public function hiCommand()
{
    if ($this->isChatGroup()) {
        $this->reply('Hey everybody in this chat!');
    } else {
        $this->reply('Hello, human!');
    }
}

Run your bot in daemon mode.

Create daemon.php, (*9)

<?php

require_once './vendor/autoload.php';
require_once "YourBot.php";

$config = [];
$bot = new YourBot('YourBotName', []);
$bot->start();

And run it in console ``` bash $ php daemon.php, (*10)


At first run data.json will be created with some template options: ``` json { "config": { "api": "TELEGRAM_BOT_API_KEY", "globalAdmin": 70863438, "admins": [], "trust": [], "whiteGroups": [] } }

Set your bot token to config.api, (*11)

Set yourself as global admin (you can get your id from @identybot), (*12)

Send /hi to your bot, (*13)

Credits

License

The MIT License (MIT). Please see License File for more information., (*14)

The Versions

29/07 2018

dev-master

9999999-dev

Telegram bot with dialogs and session management

  Sources   Download

MIT

The Requires

 

by Andrey Mistulov

php bot telegram bot api

24/07 2018

0.5.5

0.5.5.0

Telegram bot with dialogs and session management

  Sources   Download

MIT

The Requires

 

by Andrey Mistulov

php bot telegram bot api

16/04 2018

0.5.4

0.5.4.0

Telegram bot with dialogs and session management

  Sources   Download

MIT

The Requires

 

by Andrey Mistulov

php bot telegram bot api

16/04 2018

0.5.3

0.5.3.0

Telegram bot with dialogs and session management

  Sources   Download

MIT

The Requires

 

by Andrey Mistulov

php bot telegram bot api

21/02 2018

0.5.2

0.5.2.0

Telegram bot with dialogs and session management

  Sources   Download

MIT

The Requires

 

by Andrey Mistulov

php bot telegram bot api

21/02 2018

0.5.1

0.5.1.0

Telegram bot with dialogs and session management

  Sources   Download

MIT

The Requires

 

by Andrey Mistulov

php bot telegram bot api

21/02 2018

0.5.0

0.5.0.0

Telegram bot with dialogs and session management

  Sources   Download

MIT

The Requires

 

by Andrey Mistulov

php bot telegram bot api

16/02 2018

0.4.1

0.4.1.0

Telegram bot with dialogs and session management

  Sources   Download

MIT

The Requires

 

by Andrey Mistulov

php bot telegram bot api

15/02 2018

0.4.0

0.4.0.0

Telegram bot with dialogs and session management

  Sources   Download

MIT

The Requires

 

by Andrey Mistulov

php bot telegram bot api

22/01 2018

0.3

0.3.0.0

Telegram bot with dialogs and session management

  Sources   Download

MIT

The Requires

 

by Andrey Mistulov

php bot telegram bot api

17/08 2017

0.2

0.2.0.0

Telegram bot with dialogs and session management

  Sources   Download

MIT

The Requires

 

by Andrey Mistulov

php bot telegram bot api

10/07 2017

0.1

0.1.0.0

Telegram bot with dialogs and session management

  Sources   Download

MIT

The Requires

 

by Andrey Mistulov

php bot telegram bot api