Skip to the content.

TeleBot

Telegram Bot Framework for creating any bots

Created By Arash Abedi



Send Photo To Client


# sendPhoto(array $params)

You can send photo to your client by calling sendPhoto() method.
You can pass parameters in array to this method


see sendPhoto parameters on telegram doc


# examples

# Send photo to current chat (user/channel/group)


for sending photo to current chat, is not necessary to pass chat_id in send message parameters. It fill automatically by Bot class


<?php

namespace App\Controllers;

use App\Modules\ExampleModule;

class MessageHandler{

    public function run(){
        //$params=['param_name'=>'param_value']
            bot()->sendPhoto(['photo'=>'file_id or file_download_link']); //send photo to current chat
    }
   
}



# Send photo to specific chat (user/channel/group)


for sending photo to specific chat you can pass chat_id in sendPhoto parameters


<?php

namespace App\Controllers;

use App\Modules\ExampleModule;


class MessageHandler{

    public function run(){
        //$params=['param_name'=>'param_value']
            bot()->sendPhoto(['chat_id'=>'785698365','photo'=>'file_id or file_download_link']); //send photo to specific chat by chat_id
    }
   
}