Skip to content

q4ev/telegram-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Config file for this component can look like this:

return [
    'db' => require __DIR__ . '/db.php',
    'request' => [
        // your settings
    ],
    'response' => [
        // your settings
    ],
    'telegramBot' => [
        'class' => 'q4ev\telegram\TelegramBot',
        // where to send
        'url' => 'https://api.telegram.org/bot000000000:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
        // where '000000000' is your bot's id
        // and 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' token of your bot
        // chats we're using
        // u can use actual id, but in hindsight quick nicknames look easier
        'chats' => [
            // channels
            '-1000000000000' => ['ch', 'channel'],
            // personal
            '100000000'  => ['me', 'spiderman'],
            '90000000'   => ['mf', 'my-friend'],
            '1000000000' => ['gf', 'his-girlfriend'],
        ],
        'contextOptions' => [ // options for file_get_contents (it's used for usual text sending)
            'ssl' => [
                'allow_self_signed' => true,
                'verify_peer' => false,
                'verify_peer_name' => false,
            ],
        ],
        'nicknameByDefault' => static fn () => \Yii::$app->params['tgBotDefaultSender'],
         // or
         // 'nicknameByDefault' => static fn () => 'me',	
    ],
];

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages