Skip to the content.

TeleBot

Telegram Bot Framework for creating any bots

Created By Arash Abedi



Send Voice To Client


# sendVoice(array $params)

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


see sendVoice parameters on telegram doc


# examples

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


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



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


for sending voice to specific chat you can pass chat_id in sendVoice parameters


<?php

namespace App\Controllers;

use App\Modules\ExampleModule;


class MessageHandler{

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