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-08-07 20:16:01 +0300
committerdiSabler <dissy@ya.ru>2017-08-07 20:16:01 +0300
commit119275bfd3bd1e6634fedface46db1946ed724b3 (patch)
tree8ebe517efc9ebfa8250ed473dda1da8f70667124
parentdcba03765e484f86e691e8906c17ab9eb1554763 (diff)
fix: RTL/LTR in logs
-rw-r--r--plugins/help.py2
-rw-r--r--plugins/logger.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/plugins/help.py b/plugins/help.py
index aa2e8f9..dc9a561 100644
--- a/plugins/help.py
+++ b/plugins/help.py
@@ -59,6 +59,7 @@ def cmd_help(raw_in, text):
rez.append((cmd[0], cmd[4], ''))
if rez:
msg = '\n'.join('/%s - %s %s' % t for t in rez)
+ msg = msg.replace(' ', ' ').strip()
else:
msg = 'Not found.'
send_msg(raw_in, msg)
@@ -79,6 +80,7 @@ def cmd_commands(raw_in):
rez.sort()
msg = 'I know commands:\n'
msg += ' | '.join('/%s %s' % t for t in rez)
+ msg = msg.replace(' ', ' ').strip()
send_msg(raw_in, msg)
def cmd_start(raw_in):
diff --git a/plugins/logger.py b/plugins/logger.py
index c7c34a3..603643a 100644
--- a/plugins/logger.py
+++ b/plugins/logger.py
@@ -62,6 +62,9 @@ except:
if not os.path.exists(LOG_FOLDER % ''):
os.mkdir(LOG_FOLDER % '')
+def lr(t):
+ return ''.join([['?', l][12288>=ord(l)<=40960] for l in t])
+
def cmd_log(raw_in, text):
if LOG_URL:
chat_id = raw_in['message'].get('chat', {}).get('id', '')
@@ -180,7 +183,8 @@ def logger(raw_in):
if SYMLINK:
CT = CHAT_TITLE
if CHAT_NAME:
- CT += ' - %s' % CHAT_NAME
+ CT += ' - @%s' % CHAT_NAME
+ CT = lr(CT)
if CT and not os.path.exists(LOG_FOLDER % CT):
os.symlink('%s' % chat_id, LOG_FOLDER % CT)
if CHAT_NAME:
@@ -190,6 +194,7 @@ def logger(raw_in):
HB = HB.replace('DATE_TITLE', '/'.join(DATE))
HB = HB.replace('DATE_LINK', _DATE)
HB = HB.replace('BODY', data_all)
+ HB = lr(HB)
writefile(LOG_FOLDER % FOLDER_HTML, HB)
commands = [['log', cmd_log, False, 'all', 'Show log info']]