From 11a8e66caab50f9d470ffe53b720155b89168215 Mon Sep 17 00:00:00 2001 From: iouAkira Date: Tue, 23 Mar 2021 18:06:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95tg=E6=B6=88=E6=81=AF=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E6=94=AF=E6=8C=81=E5=88=B055=E8=A1=8C=EF=BC=8C?= =?UTF-8?q?=E5=86=99=E5=85=A5log=E6=96=87=E4=BB=B6=E7=9A=84=E9=98=88?= =?UTF-8?q?=E5=80=BC=E6=94=B9=E6=88=9050?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/bot/jd_bot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/bot/jd_bot b/docker/bot/jd_bot index 1c645561..d65a5514 100644 --- a/docker/bot/jd_bot +++ b/docker/bot/jd_bot @@ -738,13 +738,13 @@ def shcmd(update, context): cmd, shell=True, timeout=60, stderr=subprocess.STDOUT) out_text = out_bytes.decode('utf-8') - if len(out_text.split('\n')) > 100: + if len(out_text.split('\n')) > 50: msg = context.bot.sendMessage(text='```{}```'.format( helpers.escape_markdown(' ↓↓↓ %s 执行结果超长,请查看log ↓↓↓' % cmd)), chat_id=update.effective_chat.id, parse_mode=ParseMode.MARKDOWN_V2) log_name = '%sbot_%s_%s.log' % (_logs_dir, 'cmd', commands[0]) - with open(log_name, 'a+') as wf: + with open(log_name, 'w') as wf: wf.write(out_text) msg.reply_document( reply_to_message_id=msg.message_id, quote=True, document=open(log_name, 'rb'))