-
-
Notifications
You must be signed in to change notification settings - Fork 959
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
88 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,57 @@ | ||
<?php | ||
//README | ||
//This configuration file is intented to run the bot with the webhook method. | ||
//Uncommented parameters must be filled | ||
//Please notice that if you open this file with your browser you'll get the "Input is empty!" Exception. | ||
//This is a normal behaviour because this address has to be reached only by Telegram server | ||
|
||
//Composer Loader | ||
$dir = realpath(__DIR__.'/..'); | ||
$loader = require $dir.'/vendor/autoload.php'; | ||
|
||
$API_KEY = 'your_bot_api_key'; | ||
$BOT_NAME = 'namebot'; | ||
//$COMMANDS_FOLDER = __DIR__.'/Commands/'; | ||
/*$credentials = array( | ||
'host'=>'localhost', | ||
'user'=>'dbuser', | ||
'password'=>'dbpass', | ||
'database'=>'dbname' | ||
);*/ | ||
//$credentials = [ | ||
// 'host'=>'localhost', | ||
// 'user'=>'dbuser', | ||
// 'password'=>'dbpass', | ||
// 'database'=>'dbname' | ||
//]; | ||
|
||
try { | ||
// create Telegram API object | ||
$telegram = new Longman\TelegramBot\Telegram($API_KEY, $BOT_NAME); | ||
|
||
//Options | ||
|
||
//$telegram->enableMySQL($credentials); | ||
////Options | ||
$telegram->enableMySQL($credentials); | ||
|
||
////Enable mysql with table prefix | ||
//$telegram->enableMySQL($credentials, $BOT_NAME.'_'); | ||
|
||
//$telegram->addCommandsPath($COMMANDS_FOLDER); | ||
// here you can set some command specified parameters, | ||
// for example, google geocode/timezone api key for date command: | ||
|
||
////Here you can enable admin interface ache the channel you want to manage | ||
//$telegram->enableAdmins(['your_telegram_id']); | ||
//$telegram->setCommandConfig('sendtochannel', ['your_channel'=>'@type_here_your_channel']); | ||
|
||
////Here you can set some command specified parameters, | ||
////for example, google geocode/timezone api key for date command: | ||
//$telegram->setCommandConfig('date', array('google_api_key'=>'your_google_api_key_here')); | ||
|
||
////Logging | ||
//$telegram->setLogRequests(true); | ||
//$telegram->setLogPath($BOT_NAME.'.log'); | ||
//$telegram->setLogVerbosity(4); | ||
//$telegram->setLogVerbosity(3); | ||
|
||
//$telegram->setDownloadPath("../Download"); | ||
//$telegram->setUploadPath("../Upload"); | ||
|
||
// handle telegram webhook request | ||
$telegram->handle(); | ||
|
||
} catch (Longman\TelegramBot\Exception\TelegramException $e) { | ||
//Silence is gold! | ||
// log telegram errors | ||
// echo $e; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters