update docker/bot/jd_bot.

fix index
This commit is contained in:
iouAkira
2021-03-23 15:38:55 +08:00
committed by Gitee
parent 699649bb59
commit e7d915fa28

View File

@ -720,9 +720,9 @@ def shcmd(update, context):
if is_admin(update.message.from_user.id):
commands = update.message.text.split()
commands.remove('/cmd')
if len(commands) > 1:
if len(commands) > 0:
support_cmd = ["ls", "cp", "mv", "wget", "cat", "sed", "git", "sh", "docker_entrypoint.sh"]
if commands[1] in support_cmd:
if commands[0] in support_cmd:
cmd = ' '.join(commands)
try:
out_bytes = subprocess.check_output(
@ -755,7 +755,7 @@ def shcmd(update, context):
else:
update.message.reply_text(
text='```{}```'.format(
helpers.escape_markdown(f' →→→ {commands[1]}指令不在支持命令范围,请输入其他支持的指令{"|".join(commands)} ←←← ')),
helpers.escape_markdown(f' →→→ {commands[0]}指令不在支持命令范围,请输入其他支持的指令{"|".join(support_cmd)} ←←← ')),
parse_mode=ParseMode.MARKDOWN_V2)
else:
update.message.reply_text(