Skip to content

Representaion of telegram bot types in php classes

Notifications You must be signed in to change notification settings

thundersquared/Types

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Types

Representaion of telegram bot types in php classes. Generated by madmagestelegram/TypesGenerator.

Install

composer require madmagestelegram/types

Usage

Simplest usage is getting and setting data

$message = new Message();
$message->setText('Hello world!');

echo $message->getText(); // "Hello world!"
// as assoc array
print_r($message->_getRawData());// ['text' => 'Hello world!']

more fields

$message = ( new Message() )
        ->setMessageId(1)
        ->setDate(time())
        ->setChat(( new Chat() )->setId(1)->setType('channel'))
        ->setText('Hello world!')
        ->setAudio(
            ( new Audio() )
                ->setFileId("1")
                ->setDuration(60)
                ->setTitle('Some title')
                ->setThumb(( new PhotoSize() )
                    ->setFileId("1")
                    ->setHeight(100)
                    ->setWidth(100)
                )
        )->setLocation(
            ( new Location() )
                ->setLatitude(60.60)
                ->setLongitude(60.60)
        );

    print_r($message->_getRawData());
    
/*
    
Array
(
    [message_id] => 1
    [date] => 1570945477
    [chat] => Array
        (
            [id] => 1
            [type] => channel
        )

    [text] => Hello world!
    [audio] => Array
        (
            [file_id] => 1
            [duration] => 60
            [title] => Some title
            [thumb] => Array
                (
                    [file_id] => 1
                    [width] => 100
                    [height] => 100
                )

        )

    [location] => Array
        (
            [longitude] => 60.6
            [latitude] => 60.6
        )

)
*/

About

Representaion of telegram bot types in php classes

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%