Change Help commands
telegram.py is developing, cannot be use yet, plzz ignore it
This commit is contained in:
parent
1cc087643e
commit
5c511bbe58
@ -2,3 +2,5 @@
|
||||
define('TAG', '#');
|
||||
define('OWNER_NAME', 'Denny Dai');
|
||||
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");
|
||||
|
16
init.php
16
init.php
@ -4,21 +4,7 @@ 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));
|
||||
}
|
||||
$from = $_GET['from']
|
||||
|
||||
//load plugins
|
||||
$load_plugins = glob(dirname(__FILE__).DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.'*.php');
|
||||
|
@ -1,9 +1,10 @@
|
||||
<?php
|
||||
PluginList("help", "Ask for help");
|
||||
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) {
|
||||
$plugin_list .= "\n".$value;
|
||||
}
|
||||
$plugin_list .= "\n\n".HELP_END;
|
||||
$BOT->exec("msg ".$from." ".escapeString($plugin_list));
|
||||
}
|
11
readmes/Telegram/Telegram.py
Normal file
11
readmes/Telegram/Telegram.py
Normal 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
|
Loading…
Reference in New Issue
Block a user