-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from jaavid/Summer
Summer
- Loading branch information
Showing
13 changed files
with
484 additions
and
256 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
*~ | ||
vendor | ||
composer.lock | ||
config.php |
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,7 +1,5 @@ | ||
{ | ||
"require": { | ||
"zelenin/telegram-bot-api": "~0.0", | ||
"joshcam/mysqli-database-class": "dev-master", | ||
"dg/rss-php": "^1.2" | ||
"longman/telegram-bot": "^0.45.0" | ||
} | ||
} |
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,15 +1,16 @@ | ||
<?php | ||
//Robat Token Give from @botfather | ||
$token = ""; | ||
//Group Id To forward Message to group | ||
$agroup = ""; | ||
//Database Configuration | ||
$dbconf = array ( | ||
'host' => '', | ||
'username' => '', | ||
'password' => '', | ||
'db' => '', | ||
'port' => 3306, | ||
'charset' => 'utf8'); | ||
// Add you bot's API key and name | ||
$bot_api_key = ''; | ||
$bot_username = ''; | ||
$botan = ''; | ||
// Define all IDs of admin users in this array (leave as empty array if not used) | ||
$admin_users = [208627,]; | ||
|
||
// Enter your MySQL database credentials | ||
$mysql_credentials = [ | ||
'host' => 'localhost', | ||
'user' => '', | ||
'password' => '', | ||
'database' => '', | ||
]; | ||
?> |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
// Add you bot's API key and name | ||
$bot_api_key = ''; | ||
$bot_username = ''; | ||
$botan = ''; | ||
// Define all IDs of admin users in this array (leave as empty array if not used) | ||
$admin_users = [208627,]; | ||
|
||
// Enter your MySQL database credentials | ||
$mysql_credentials = [ | ||
'host' => 'localhost', | ||
'user' => '', | ||
'password' => '', | ||
'database' => '', | ||
]; | ||
?> |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
// Load composer | ||
require_once __DIR__ . '/vendor/autoload.php'; | ||
require_once __DIR__ . '/config.php'; | ||
|
||
// Define all paths for your custom commands in this array (leave as empty array if not used) | ||
$commands_paths = [ | ||
__DIR__ . '/jcommands/', | ||
]; | ||
|
||
try { | ||
// Create Telegram API object | ||
$telegram = new Longman\TelegramBot\Telegram($bot_api_key, $bot_username); | ||
|
||
// Add commands paths containing your custom commands | ||
$telegram->addCommandsPaths($commands_paths); | ||
|
||
// Enable admin users | ||
$telegram->enableAdmins($admin_users); | ||
|
||
// Enable MySQL | ||
$telegram->enableMySql($mysql_credentials); | ||
|
||
// Logging (Error, Debug and Raw Updates) | ||
//Longman\TelegramBot\TelegramLog::initErrorLog(__DIR__ . "/{$bot_username}_error.log"); | ||
//Longman\TelegramBot\TelegramLog::initDebugLog(__DIR__ . "/{$bot_username}_debug.log"); | ||
//Longman\TelegramBot\TelegramLog::initUpdateLog(__DIR__ . "/{$bot_username}_update.log"); | ||
|
||
// If you are using a custom Monolog instance for logging, use this instead of the above | ||
//Longman\TelegramBot\TelegramLog::initialize($your_external_monolog_instance); | ||
|
||
// Set custom Upload and Download paths | ||
//$telegram->setDownloadPath(__DIR__ . '/Download'); | ||
//$telegram->setUploadPath(__DIR__ . '/Upload'); | ||
|
||
// Here you can set some command specific parameters | ||
// e.g. Google geocode/timezone api key for /date command | ||
//$telegram->setCommandConfig('date', ['google_api_key' => 'your_google_api_key_here']); | ||
|
||
// Botan.io integration | ||
$telegram->enableBotan($botan); | ||
|
||
// Requests Limiter (tries to prevent reaching Telegram API limits) | ||
$telegram->enableLimiter(); | ||
|
||
// Handle telegram webhook request | ||
$telegram->handle(); | ||
|
||
} catch (Longman\TelegramBot\Exception\TelegramException $e) { | ||
// Silence is golden! | ||
//echo $e; | ||
// Log telegram errors | ||
Longman\TelegramBot\TelegramLog::error($e); | ||
} catch (Longman\TelegramBot\Exception\TelegramLogException $e) { | ||
// Silence is golden! | ||
// Uncomment this to catch log initialisation errors | ||
//echo $e; | ||
} |
Oops, something went wrong.