PHP Classes

File: examples/getUpdates.php

Recommend this page to a friend!
  Classes of Mateo   PHP Telegram Bot Handler   examples/getUpdates.php   Download  
File: examples/getUpdates.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Telegram Bot Handler
Create a Telegram bot to respond to certain events
Author: By
Last change:
Date: 5 months ago
Size: 489 bytes
 

Contents

Class file image Download
<?php

use Mateodioev\Bots\Telegram\Methods;
use
Mateodioev\TgHandler\Commands;

require
__DIR__ . '/../vendor/autoload.php';
require
__DIR__ . '/functions.php';

// Support for /start, !start, .start
$cmd = new Commands(cmd_prefix: ['/', '!', '.']);
$cmd->setBotUsername('your bot username');

// https://telegram.me/botfather
$bot = new Methods('your telegram bot token');

$cmd->on('message', 'onText');
$cmd->CmdMessage('start', 'sendHelloWithButton', [$bot]);

noWebhook($bot, $cmd);