mamadali / yii2-bale-bot
Bale 机器人
v1.0
2022-01-12 18:35 UTC
Requires
This package is auto-updated.
Last update: 2024-09-13 01:23:31 UTC
README
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一
php composer.phar require --prefer-dist mamadali/yii2-bale-bot "*"
或
"mamadali/yii2-bale-bot": "*"
将以下内容添加到您的 composer.json
文件的 require 部分。
使用方法
首先在 bale 消息 中创建您的机器人,并获取机器人令牌
然后将此代码添加到 config.php 或使用高级项目时 common/config/main.php 的 components 部分
'components' => [ ... 'bale' => [ 'class' => 'mamadali\bale\Bale', 'botToken' => '<Enter your bot token here>', ], ... ];
一旦扩展安装完成,只需在您的代码中通过以下方式使用它
<?= Yii::$app->bale->sendMessage([ 'chat_id' => '<Enter chat id here>', 'text' => 'test', ]); ?>
可用方法列表
sendMessage sendPhoto sendAudio sendDocument sendVideo