Skip to content

class send

Oliver edited this page Apr 26, 2020 · 3 revisions

www/includes/telegrambot.inc.php


send

In dieser Klasse befinden sich alle Funktionen zum Senden von Telegram-Messages über einen Telegram-Bot

Package

zorg

TODO

  • Add method-call routes for all additional Telegram Message types

Overview

Public Properties

No public properties found

Constants

DISABLE_NOTIFICATION() | DISABLE_WEB_PAGE_PREVIEW() | PARSE_MODE() |

Public Methods

document() | event() | formatText() | gallery() | location() | mentionUser() | message() | photo() | send() |

Constants

DISABLE_NOTIFICATION

DISABLE_NOTIFICATION = 'false' :

DISABLE_WEB_PAGE_PREVIEW

DISABLE_WEB_PAGE_PREVIEW = 'false' :

PARSE_MODE

PARSE_MODE = 'html' :

Define global default Telegram Bot Settings (can be overwritten on a Message level by passing as $parameter)

Tags
  • const: TELEGRAM_BOT_PARSE_MODE Specifies the Message Format to use - either empty, Markdown or HTML
  • const: TELEGRAM_BOT_DISABLE_WEB_PAGE_PREVIEW Specifies whether link previews for links in the message should be enabled or disabled
  • const: TELEGRAM_BOT_DISABLE_NOTIFICATION Specifies whether the Bot's messages should be silent or regular notifications

Methods

document()

sendDocument

Send as File

public document(mixed $scope, mixed $document, mixed $caption = NULL, mixed $parameters = []) : mixed

event()

sendVenue

Send a static Location info for a certain Place

public event(mixed $scope, float $latitude, float $longitude, mixed $title, mixed $address, mixed $foursquare_id = NULL, mixed $parameters = []) : mixed

formatText()

Cleanup Message for Telegram Messenger Notification

public formatText(string $notificationText) : string

See also

Tags
  • author: IneX
  • date: 25.05.2018
  • version: 3.0
  • since: 1.0 initial function
  • since: 2.0 line breaks are possible using encoded "\n" - won't strip those anymore. Added missing allowed strong & .
  • since: 3.0 22.10.2018 changed strip_html() to remove_html(), changed order of cleanup, removed valid HTML-Tags due to issue with nested tags

gallery()

sendMediaGroup

Send a compilation of multiple Media files (e.g. Photo Gallery)

public gallery(mixed $scope, array $inputMedia, mixed $parameters = []) : mixed

See also

location()

sendLocation

Send a Location Ping for a temporary amount of time

public location(mixed $scope, float $latitude, float $longitude, mixed $live_period = NULL, mixed $parameters = []) : mixed

mentionUser()

(NOT IMPLEMENTED YET!) Format Link to Mention Telegram User inline

Gibt einen Link aus, welcher Telegram benutzt um einen spezifischen Telegram Benutzer zu @mention. Example: inline mention of a user

public mentionUser(int $userid) : string

See also

  • \usersystem::id2user()
Tags
  • author: IneX
  • date: 25.05.2018
  • version: 1.1
  • since: 1.0 IneX 25.05.2018 Method added
  • since: 1.1 IneX 18.04.2020 Code optimization and migration to mysqli_
  • TODO: Database column "telegram_user_id" must be added first, for this to work
  • TODO: probably it's more common that a userNAME is passed? => needs usersystem::user2id()
  • global: object $db Globales Class-Object mit allen MySQL-Methoden
  • global: object $user Globales Class-Object mit den User-Methoden & Variablen

message()

sendMessage

Send as regular Chat-Message

public message(mixed $scope, mixed $text, mixed $parameters = []) : mixed

photo()

sendPhoto

Send as Photo

public photo(mixed $scope, mixed $photo, mixed $caption = NULL, mixed $parameters = []) : mixed

send()

Send a Message via Telegram Messenger Schickt eine Notification an die Telegram Chats von Usern

public send(int|string $userScope, string $messageType, array $content) : bool

See also

  • Uses \usersystem::userHasTelegram() \Telegram::formatText() \Telegram::validateData()
Tags
  • author: IneX
  • date: 17.03.2018
  • version: 4.0
  • since: 1.0
  • TODO: implement this with TelegramBot\TelegramBotManager\BotManager?
  • var: mit aktuellen Telegram-Bot Settings
  • global: object $user Globales Class-Object mit den User-Methoden & Variablen
  • global: array $botconfigs Array mit allen Telegram Bot-Configs

validateData()

Validate Data agains Model for various Telegram Message Types

Check for valid parameters and returns Array with key:value pairs assigned This function is related (but no depending!) to the following MySQL-table: - Table: messages_telegram_queue - Column: :method - Column: :content - Column: :content_additional

private validateData(string $messageType, array $parameters) : array|bool

See also

Tags
  • author: IneX
  • date: 10.06.2018
  • version: 1.0
  • since: 1.0

\ » Classes » send

Clone this wiki locally