mirror of
https://github.com/danog/filtersbot.git
synced 2024-11-30 04:19:09 +01:00
24 lines
613 B
PHP
24 lines
613 B
PHP
<?php
|
|
// Load composer
|
|
require __DIR__ . '/vendor/autoload.php';
|
|
|
|
$API_KEY = 'your_bot_api_key';
|
|
$BOT_NAME = 'username_bot';
|
|
$hook_url = 'https://yourdomain/path/to/hook.php';
|
|
try {
|
|
// Create Telegram API object
|
|
$telegram = new Longman\TelegramBot\Telegram($API_KEY, $BOT_NAME);
|
|
|
|
// Set webhook
|
|
$result = $telegram->setWebHook($hook_url);
|
|
|
|
// Uncomment to use certificate
|
|
//$result = $telegram->setWebHook($hook_url, $path_certificate);
|
|
|
|
if ($result->isOk()) {
|
|
echo $result->getDescription();
|
|
}
|
|
} catch (Longman\TelegramBot\Exception\TelegramException $e) {
|
|
echo $e;
|
|
}
|