PHP Classes

PHP Telegram Bot Handler: Create a Telegram bot to respond to certain events

Recommend this page to a friend!
  Info   View files Example   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2022-09-03 (28 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 34 This week: 1All time: 10,566 This week: 209Up
Version License PHP version Categories
telegram-bot-handler 1.0.0MIT/X Consortium ...5PHP 5, Web services, Chat
Description Author

This package can create a Telegram bot to respond to specific events.

It can register the event handler to react when the package calls certain Telegram chat events happento functions that the package will call.

Currently can register callback functions to handle events like:

- Message

- Photo

- Video

- Audio

- Voice

- Documment

- Sticker

- Venue

- Location

- Inline

- Callback

- New chat member

- Left chat member

- New chat title

- New chat photo

- Group chat created

- Supergroup chat created

- Migrate to chat id

- Migrate from chat id

- Edited

- Game

- Channel

- Edited channel

Picture of Mateo
  Performance   Level  
Name: Mateo <contact>
Classes: 12 packages by
Country: Peru Peru
Innovation award
Innovation award
Nominee: 4x

Details

Telegram bot handler

Installation

composer require mateodioev/tg-handler

Usage

See examples folder for more information.

use Mateodioev\TgHandler\Commands;
$cmd = new Commands($namespace, $commandsPrefix);

Register commands

Text commands

$cmd->CmdMessage($cmd, $callable, $functionParams);

Callback data

$cmd->CmdCallback($cmd, $callable, $functionParams);

Inline querys

$cmd->CmdInline($cmd, $callable, $functionParams);

Middlewares

Middlewares are executed before the command is executed.

_Types:_ message, photo, video, audio, voice, documment, sticker, venue, location, inline, callback, new_chat_member, left_chat_member, new_chat_title, new_chat_photo, group_chat_created, supergroup_chat_created, migrate_to_chat_id, migrate_from_chat_id, edited, game, channel, edited_channel

$cmd->on($type, $callable, $functionParams);

Run commands

Run all comands registered and execute after middleware.

// Optional param
$cmd->run($afterMidleware);
  Files folder image Files  
File Role Description
Files folder imageexamples (4 files)
Files folder imagesrc (3 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  examples  
File Role Description
  Accessible without login Plain text file functions.php Example Example script
  Accessible without login Plain text file getUpdates.php Example Example script
  Accessible without login Plain text file hello.php Example Example script
  Accessible without login Plain text file send_button.php Example Example script

  Files folder image Files  /  src  
File Role Description
  Plain text file Commands.php Class Class source
  Plain text file Updates.php Class Class source
  Plain text file UpdatesTrait.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:34
This week:1
All time:10,566
This week:209Up
For more information send a message to info at phpclasses dot org.