m1roff / yii2-telegram-notifications

Telegram 通知

2.0.0 2022-09-08 17:31 UTC

This package is auto-updated.

Last update: 2024-09-08 21:50:20 UTC


README

安装

安装此扩展的首选方式是通过composer

运行以下命令:

composer require m1roff/yii2-telegram-notifications "dev-master"

配置

将以下行添加到您的项目配置文件中

'components' => [
    ...,
    'telegram' => [
        'class' => \m1roff\TelegramNotifications::class,
        'token' => ***', // Token of your bot
        'chat' => ***, // Notifications chat id
        'extraTitle' => "⚠️⚠️⚠️ Some extra title added to message⚠️⚠️⚠️\n", // optional
        'proxy' => 'socks5://LOGIN:PASS@PROXY_ADDRESS:PROXY_PORT', // optional, if needed to use proxy, like in Russia
    ],
],

如何操作

如何找出我的用户ID或聊天ID?

  • 向机器人发送消息
  • 查看最后更新的信息,请访问 https://api.telegram.org/bot{BOT_TOKEN}/getUpdates
  • {BOT_TOKEN} - 用您的机器人令牌替换