Skip to the content.

TeleBot

Telegram Bot Framework for creating any bots

Created By Arash Abedi



Send Audio To Client


# sendAudio(array $params)

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


see sendAudio parameters on telegram doc


# examples

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


for sending audio to current chat, is not necessary to pass chat_id in sendAudio 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()->sendAudio(['audio'=>'file_id or file_download_link']); //send audio to current chat
    }
   
}



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


for sending audio to specific chat you can pass chat_id in sendAudio parameters


<?php

namespace App\Controllers;

use App\Modules\ExampleModule;


class MessageHandler{

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