Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/isida/vi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiSabler <dissy@ya.ru>2017-02-24 16:00:51 +0300
committerdiSabler <dissy@ya.ru>2017-02-24 16:00:51 +0300
commitcee483d2a809e89c8f42bf0f7a422c44c72059d6 (patch)
tree1258ab50ad6a321ce6a29876a8f40d844c4aa48e
parent4da72e91e519711b2f02638e8769ebe0b74a029b (diff)
fix: upper case in commands
-rw-r--r--kernel.py15
-rw-r--r--plugins/error.py2
2 files changed, 10 insertions, 7 deletions
diff --git a/kernel.py b/kernel.py
index 493ed46..4561c68 100644
--- a/kernel.py
+++ b/kernel.py
@@ -455,6 +455,8 @@ def remove_sub_space(t):
# Send message
def send_msg(raw_in, msg, parse_mode = 'HTML'):
global LAST_MESSAGE, TIMEOUT
+ if parse_mode == 'HTML':
+ msg = html_escape_soft(msg)
MSG = { 'chat_id': raw_in['message']['chat'].get('id',''),
'text': msg,
'parse_mode': parse_mode }
@@ -581,6 +583,7 @@ def check_updates():
_LAST_NAME, CMD]]),'cyan')
# name, proc, is_owner, data_type
#commands = ['whoami', cmd_whoami, False, 'raw']
+ # Command parser!
IS_COMMAND = False
for c in COMMANDS:
if c[2] and IS_OWNER:
@@ -591,10 +594,10 @@ def check_updates():
ALLOW = False
if CMD.startswith('/'):
CMD = CMD[1:]
- if CMD.startswith('%s ' % c[0]) or CMD == c[0] or \
- CMD == '%s@%s' % (c[0], BOT_NAME) or \
- CMD.startswith('%s@%s ' % (c[0], BOT_NAME)) or \
- CMD.startswith('@%s %s' % (BOT_NAME, c[0])):
+ if CMD.lower().startswith('%s ' % c[0]) or CMD.lower() == c[0] or \
+ CMD.lower() == '%s@%s' % (c[0], BOT_NAME) or \
+ CMD.lower().startswith('%s@%s ' % (c[0], BOT_NAME)) or \
+ CMD.lower().startswith('@%s %s' % (BOT_NAME, c[0])):
if ALLOW:
if c[3] == 'raw':
thr(c[1], (msg_in,), CMD)
@@ -650,7 +653,7 @@ def shell_execute(cmd):
error_answ = os.system('%s > %s 2>&1' % (cmd.encode('utf-8'),tmp_file))
if not error_answ:
try:
- body = html_escape_soft(readfile(tmp_file))
+ body = readfile(tmp_file)
except:
body = '⚠️ Command execution error.'
if len(body):
@@ -661,7 +664,7 @@ def shell_execute(cmd):
else:
result = '⚠️ Command execution error.'
try:
- result += '\n' + html_escape_soft(readfile(tmp_file))
+ result += '\n' + readfile(tmp_file)
except:
pass
except Exception, MSG:
diff --git a/plugins/error.py b/plugins/error.py
index 1fe7b10..ddbaf62 100644
--- a/plugins/error.py
+++ b/plugins/error.py
@@ -43,7 +43,7 @@ def cmd_show_error(raw_in, text):
msg = '👍🏻 No Errors!'
else:
msg = '👍🏻 No Errors!'
- send_msg(raw_in, msg)
+ send_msg(raw_in, msg, '')
commands = [['error', cmd_show_error, True, 'all', 'Show errors.']]