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 c3a2c19b3f
commit 6a618b1bdd

View File

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