too tired to desc

too tired to desc
This commit is contained in:
Denny Dai
2015-06-26 13:19:40 +08:00
parent 72a36e5164
commit 88c6a081dd
6 changed files with 11 additions and 16 deletions
+1 -7
View File
@@ -1,6 +1,5 @@
<?php
namespace DBot\Telegram;
class Base
{
protected $_fp;
@@ -12,17 +11,13 @@ class Base
}
stream_set_timeout($this->_fp, 1);
}
public function __destruct()
{
fclose($this->_fp);
}
public function exec($command)
{
fwrite($this->_fp, str_replace("\n", '\n', $command) . PHP_EOL);
$answer = fgets($this->_fp);
if (is_string($answer)) {
if (substr($answer, 0, 7) === 'ANSWER ') {
@@ -35,7 +30,6 @@ class Base
return true;
}
}
return false;
}
}
}
+34
View File
@@ -0,0 +1,34 @@
<?php
require_once('config.inc.php');
require_once('functions.php');
$plugins = [];
if($_GET['from'] != escapePeer(BOT_NAME)){
//is group?
if ($_GET['to'] == escapePeer(BOT_NAME)) {
$isgroup = false;
}else{
$isgroup = true;
}
//reply to...
if ($isgroup) {
$from = $_GET['to'];
}else{
$from = $_GET['from'];
$BOT->exec("msg ".escapePeer(OWNER_NAME)." ".json_encode($_GET));
}
//load plugins
$load_plugins = glob(PATH.'plugins'.DIRECTORY_SEPARATOR.'*.php');
foreach ($load_plugins as $key => $value) {
if ($value == PATH.'plugins'.DIRECTORY_SEPARATOR.'help.php') {
unset($load_plugins[$key]);
}
}
foreach ($load_plugins as $value) {
require_once $value;
}
require_once PATH.'plugins'.DIRECTORY_SEPARATOR.'help.php';
}