All Projects → duhow → Telegram Php

duhow / Telegram Php

Licence: gpl-3.0

Projects that are alternatives of or similar to Telegram Php

Novagram
An Object-Oriented PHP library for Telegram Bots
Stars: ✭ 112 (+261.29%)
Mutual labels:  api, telegram-bot, telegram
Telebot.nim
Async client for Telegram Bot API in pure Nim [Bot API 5.1]
Stars: ✭ 93 (+200%)
Mutual labels:  api, telegram-bot, telegram
Telegram Api
Complete async capable Telegram bot API implementation for PHP7
Stars: ✭ 650 (+1996.77%)
Mutual labels:  telegram-bot, telegram
Flowerss Bot
A telegram bot for rss reader. 一个支持应用内阅读的 Telegram RSS Bot。
Stars: ✭ 660 (+2029.03%)
Mutual labels:  telegram-bot, telegram
Java Telegram Bot Api
Telegram Bot API for Java
Stars: ✭ 819 (+2541.94%)
Mutual labels:  telegram-bot, telegram
Rssbot
Lightweight Telegram RSS bot for notifications only. 用于消息通知的轻量级 Telegram RSS 机器人
Stars: ✭ 952 (+2970.97%)
Mutual labels:  telegram-bot, telegram
Telegram Bot
Rust Library for creating a Telegram Bot
Stars: ✭ 633 (+1941.94%)
Mutual labels:  telegram-bot, telegram
Informer
A Telegram Mass Surveillance Bot in Python
Stars: ✭ 745 (+2303.23%)
Mutual labels:  telegram-bot, telegram
Shell Bot
🤖 Telegram bot that executes commands and sends the live output
Stars: ✭ 470 (+1416.13%)
Mutual labels:  telegram-bot, telegram
Torpedo
Pluggable, multi-network asynchronous chat bot written in Go
Stars: ✭ 19 (-38.71%)
Mutual labels:  telegram-bot, telegram
Micha
Client lib for Telegram bot api
Stars: ✭ 18 (-41.94%)
Mutual labels:  telegram-bot, telegram
Vk To Telegram
Utility to forward posts from VK through callback API to telegram channel or chat
Stars: ✭ 24 (-22.58%)
Mutual labels:  api, telegram
Node Telegram Bot Api
Telegram Bot API for NodeJS
Stars: ✭ 5,782 (+18551.61%)
Mutual labels:  api, telegram
Mtproto
Full-native go implementation of Telegram API
Stars: ✭ 566 (+1725.81%)
Mutual labels:  telegram-bot, telegram
Telegram Sms
An SMS-forwarding Robot Running on Your Android Device.
Stars: ✭ 641 (+1967.74%)
Mutual labels:  telegram-bot, telegram
Telegraf
Modern Telegram Bot Framework for Node.js
Stars: ✭ 5,178 (+16603.23%)
Mutual labels:  telegram-bot, telegram
Zabbix In Telegram
Zabbix Notifications with graphs in Telegram
Stars: ✭ 710 (+2190.32%)
Mutual labels:  telegram-bot, telegram
Pytelbot
A playful bot in telegram
Stars: ✭ 12 (-61.29%)
Mutual labels:  telegram-bot, telegram
Tgbot Cpp
C++ library for Telegram bot API
Stars: ✭ 439 (+1316.13%)
Mutual labels:  telegram-bot, telegram
Telegram
✈️ Telegram Notifications Channel for Laravel
Stars: ✭ 450 (+1351.61%)
Mutual labels:  telegram-bot, telegram

Telegram-PHP

Another library to use Telegram bots with PHP.

  • Include the src/Autoloader.php file.
  • Create a Telegram\Bot object.
  • Create a Telegram\Receiver object using the $bot.
$bot = new Telegram\Bot("11111111:AAAAAAAAAAzzzzzzzzzzzzzzzzzzz", "MyUserBot", "The Name of Bot");
$tg  = new Telegram\Receiver($bot);

You can create as many Bots and Receivers or Senders as you want. Using Receiver includes a Sender.

Usage

Once the page is loaded (manually or via webhook), you can send or reply the requests.

To send a message to a user or group chat:

$tg->send
  ->chat("123456")
  ->text("Hello world!")
->send();

To reply a user command:

if($tg->text_command("start")){
  $tg->send
    ->text("Hi!")
  ->send();
}

To reply a user message:

if($tg->text_has("are you alive")){
  $tg->send
    ->text("Yes!")
  ->send();
}

NEW: To parse a string:

if($tg->text_regex("I'm {N:age}") and $tg->words() <= 4){
  $num = $tg->input->age;
  $str = "So old...";
  if($num < 18){ $str = "You're young!"; }
  $tg->send
    ->text($str)
  ->send();
}elseif($tg->text_regex("My name's {name}")){
  $tg->send
    ->text("Nice to meet you, " .$tg->input->name ."!")
  ->send();
}

Send an Inline Keyboard and parse it:

if($tg->callback == "but 1"){
  $tg->answer_if_callback(""); // Stop loading button.
  $tg->send
    ->message(TRUE)
    ->chat(TRUE)
    ->text("You pressed the first button!")
  ->edit("text");
}elseif($tg->callback == "but 2"){
  $tg->answer_if_callback("You pressed the second button!", TRUE);
  // Display an alert and stop loading button.
}

if($tg->text_has("matrix") and $tg->words() <= 5){
  $tg->send
    ->text("Red or blue. You choose.")
    ->inline_keyboard()
      ->row()
        ->button("Red",  "but 1")
        ->button("Blue", "but 2")
      ->end_row()
    ->show()
  ->send();
}

Examples

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].