This commit is contained in:
Denny Dai 2015-07-08 16:13:12 +08:00
parent 725fc82dc0
commit 397031ec56
8 changed files with 22 additions and 6 deletions

View File

@ -24,6 +24,11 @@ require_once(PATH.'classes'.DIRECTORY_SEPARATOR.TYPE.DIRECTORY_SEPARATOR.'init.p
$plugin_sendto = $from; $plugin_sendto = $from;
require_once $value; require_once $value;
break; break;
}elseif (preg_match("/^(".preg_quote($TAG, '/').$plugin_name.")|(".preg_quote($TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.")$/", $text)) {
$plugin_text = $matches[2];
$plugin_sendto = $from;
require_once $value;
break;
} }
} }
} }

View File

@ -1,5 +1,4 @@
<?php <?php
namespace DBot;
class Base class Base
{ {
public function exec($command, $data = null) public function exec($command, $data = null)

View File

@ -1,5 +1,5 @@
<?php <?php
$BOT = new DBot\Base; $BOT = new Base;
$GET = json_decode(file_get_contents("php://input"),true); $GET = json_decode(file_get_contents("php://input"),true);
//is group? //is group?

View File

@ -1,5 +1,4 @@
<?php <?php
namespace DBot;
class Base class Base
{ {
protected $_fp; protected $_fp;

View File

@ -1,5 +1,5 @@
<?php <?php
$BOT = new DBot\Base('unix:///tmp/tg.sck'); $BOT = new Base('unix:///tmp/tg.sck');
if($_GET['from'] != escapePeer(BOT_NAME)){ if($_GET['from'] != escapePeer(BOT_NAME)){
//is group? //is group?
if ($_GET['to'] == escapePeer(BOT_NAME)) { if ($_GET['to'] == escapePeer(BOT_NAME)) {

13
composer.json Normal file
View File

@ -0,0 +1,13 @@
{
"name": "dennydai/D-bot",
"description": "A chat bot written in PHP",
"authors": [
{
"name": "dennydai",
"email": "i@daihan.cn"
}
],
"require": {
"php": ">=5.3.0",
}
}

View File

@ -1,6 +1,6 @@
<?php <?php
foreach ($TAGs as $TAG) { foreach ($TAGs as $TAG) {
if (preg_match("/^(".preg_quote($TAG, '/')."help)|(".preg_quote($TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.")$/", $text)) { if (preg_match("/^(".preg_quote($TAG, '/')."help)|(".preg_quote($TAG, '/')."help".preg_quote('@').BOT_NAME.")$/", $text)) {
foreach ($load_plugins as $value) { foreach ($load_plugins as $value) {
$plugin_name = substr($value, strlen(PATH.'plugins'.DIRECTORY_SEPARATOR), -4); $plugin_name = substr($value, strlen(PATH.'plugins'.DIRECTORY_SEPARATOR), -4);
$lines=file($value); $lines=file($value);

View File

@ -32,7 +32,7 @@ if(filter_var($var[0], FILTER_VALIDATE_IP)){
$msg .= "\nBroadcast: ".$plugin_ipcalc_broadcast; $msg .= "\nBroadcast: ".$plugin_ipcalc_broadcast;
$msg .= "\nHostMin: ".long2ip($plugin_ipcalc_first); $msg .= "\nHostMin: ".long2ip($plugin_ipcalc_first);
$msg .= "\nHostMax: ".long2ip($plugin_ipcalc_last); $msg .= "\nHostMax: ".long2ip($plugin_ipcalc_last);
$msg .= "\nHosts/Net: ".($plugin_ipcalc_hosts + 2); $msg .= "\nTotal num: ".($plugin_ipcalc_hosts + 3);
$BOT->msg($plugin_sendto, $msg); $BOT->msg($plugin_sendto, $msg);
}else{ }else{