1st commit
1st commit
This commit is contained in:
32
set.php
Normal file
32
set.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
// Load composer
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
$config = require __DIR__ . '/config.php';
|
||||
|
||||
|
||||
$bot_api_key = $config['api_key'];
|
||||
$bot_username = $config['bot_username'];
|
||||
$hook_url = $config['webhook']['url'];
|
||||
|
||||
|
||||
try {
|
||||
// Create Telegram API object
|
||||
$telegram = new Longman\TelegramBot\Telegram($bot_api_key, $bot_username);
|
||||
|
||||
// Set webhook
|
||||
$result = $telegram->setWebhook($hook_url);
|
||||
if ($result->isOk()) {
|
||||
echo $result->getDescription();
|
||||
}
|
||||
} catch (Longman\TelegramBot\Exception\TelegramException $e) {
|
||||
// log telegram errors
|
||||
// echo $e->getMessage();
|
||||
}
|
||||
Reference in New Issue
Block a user