TeleBot
Telegram Bot Framework for creating any bots
Created By Arash Abedi
Send Poll To Client
# sendPoll(array $params)
You can send poll to your client by calling sendPoll() method.
You can pass parameters in array to this method
see sendPoll parameters on telegram doc
# examples
# Send poll to current chat (user/channel/group)
for sending poll to current chat, is not necessary to pass chat_id in send sendPoll 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']
$options=json_encode(['red','yellow','black'])
bot()->sendPoll(['question'=>'what color do you like?','options'=>$options]); //send poll to current chat
}
}
# Send poll to specific chat (user/channel/group)
for sending poll to specific chat you can pass chat_id in sendPoll parameters
<?php
namespace App\Controllers;
use App\Modules\ExampleModule;
class MessageHandler{
public function run(){
//$params=['param_name'=>'param_value']
$options=json_encode(['red','yellow','black'])
bot()->sendPoll(['chat_id'=>'785698365','question'=>'what color do you like?','options'=>$options]); //send poll to specific chat by chat_id
}
}