Skip to content

MamadAliGit/yii2-bale-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bale Bot Extension

Bale bot api docs

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist mamadali/yii2-bale-bot "*"

or add

"mamadali/yii2-bale-bot": "*"

to the require section of your composer.json file.

Usage

First create your bot in @botfateher in bale messanger and get bot token

Then add this code to components section of config.php or if use advanced project common/config/main.php

    'components' => [
        ...
        'bale' => [
            'class' => 'mamadali\bale\Bale',
            'botToken' => '<Enter your bot token here>',
        ],
        ...
    ];

Once the extension is installed, simply use it in your code by :

<?= Yii::$app->bale->sendMessage([
        'chat_id' => '<Enter chat id here>',
        'text' => 'test',
    ]); ?>

Usable methods list

sendMessage
sendPhoto
sendAudio
sendDocument
sendVideo