PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Mateo   PHP Telegram Bot Handler   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP Telegram Bot Handler
Create a Telegram bot to respond to certain events
Author: By
Last change:
Date: 1 year ago
Size: 1,071 bytes
 

Contents

Class file image Download

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);