Change Help commands

telegram.py is developing, cannot be use yet, plzz ignore it
This commit is contained in:
Denny Dai 2015-05-31 17:30:05 +08:00
parent 1cc087643e
commit 5c511bbe58
4 changed files with 16 additions and 16 deletions

View File

@ -2,3 +2,5 @@
define('TAG', '#'); define('TAG', '#');
define('OWNER_NAME', 'Denny Dai'); define('OWNER_NAME', 'Denny Dai');
define('BOT_NAME', 'Dx. Dennx'); define('BOT_NAME', 'Dx. Dennx');
define('HELP_BEGIN', "Welcome to use TG-BOT");
define('HELP_END', "GitHub: https://github.com/dennydai/D-bot\nAuthor: @DennyDai");

View File

@ -4,21 +4,7 @@ require_once('config.inc.php');
require_once('functions.php'); require_once('functions.php');
$plugins = []; $plugins = [];
if($_GET['from'] != escapePeer(BOT_NAME)){ $from = $_GET['from']
//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
$load_plugins = glob(dirname(__FILE__).DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.'*.php'); $load_plugins = glob(dirname(__FILE__).DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.'*.php');

View File

@ -1,9 +1,10 @@
<?php <?php
PluginList("help", "Ask for help"); PluginList("help", "Ask for help");
if (preg_match("/^".TAG."help$/", $_GET['text'])) { if (preg_match("/^".TAG."help$/", $_GET['text'])) {
$plugin_list = "Welcome to use TG-BOT From Dennx.com"; $plugin_list = HELP_BEGIN."\n";
foreach ($plugins as $value) { foreach ($plugins as $value) {
$plugin_list .= "\n".$value; $plugin_list .= "\n".$value;
} }
$plugin_list .= "\n\n".HELP_END;
$BOT->exec("msg ".$from." ".escapeString($plugin_list)); $BOT->exec("msg ".$from." ".escapeString($plugin_list));
} }

View File

@ -0,0 +1,11 @@
#coding:utf-8
import tgl
import urllib
import urllib2
def on_msg_receive(msg):
get="from="+urllib.quote(msg.dest.name)+"&text="+urllib.quote(msg.text)
url="http://1.vps.dennx.com/onmessage.php?"
req=urllib2.Request(url+get)
res=urllib2.urlopen(req).read()
print res