1st commit

1st commit
This commit is contained in:
CM
2021-04-17 17:53:59 +02:00
parent bab7a08ff8
commit ace990e449
10 changed files with 747 additions and 0 deletions

32
set.php Normal file
View 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();
}