agtong / yii2-telegram-bot
为 Yii 2 的 Telegram 机器人
v1.0.0
2020-04-19 14:48 UTC
Requires
- yiisoft/yii2: ~2.0.0
- yiisoft/yii2-httpclient: ~2.0.0
This package is auto-updated.
Last update: 2024-09-20 00:22:57 UTC
README
Yii2 Telegram 机器人。
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一:
composer require agtong/yii2-telegram-bot
或
"agtong/yii2-telegram-bot": "*"
将其添加到你的 composer.json
文件的 require 部分。
使用方法
使用以下代码发送消息。
$bot = new TelegramBot(['token' => '123456:abcde');
$bot->sendMessage('123456', 'Hello World!');
以下展示了 sendMessage
函数及其可选参数。
sendMessage($chat_id, $text, $parse_mode = null, $disable_web_page_preview = null, $disable_notification = null, $reply_to_message_id = null, $reply_markup = null)
有关参数的更多信息请参阅 此处。