Skip to content

Commit c76dc0b

Browse files
committed
wip
1 parent 8a26646 commit c76dc0b

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

orga2Utils.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,22 @@ def asm(update, context):
3838
return
3939

4040
mnemonic = " ".join(context.args).upper()
41+
response_text = ""
4142
with get_session() as session:
4243
all_instructions = session.query(models.AsmInstruction).all()
4344
possibles = [i for i in all_instructions
4445
if levenshtein(mnemonic, i.mnemonic.upper()) < 2]
45-
if not possibles:
46-
msg = update.message.reply_text(
47-
"No pude encontrar esa instrucción.", quote=False)
48-
else:
49-
instr_match = [i for i in possibles if i.mnemonic.upper() == mnemonic]
50-
if instr_match:
51-
response_text = ""
52-
response_text += "\n".join(getasminfo(i) for i in instr_match)
46+
if not possibles:
47+
response_text = "No pude encontrar esa instrucción."
5348
else:
54-
response_text = ("No pude encontrar esa instrucción.\n"
55-
"Quizás quisiste decir:\n")
56-
response_text += "\n".join(getasminfo(i) for i in possibles)
57-
msg = update.message.reply_text(response_text, quote=False)
49+
instr_match = [i for i in possibles if i.mnemonic.upper() == mnemonic]
50+
if instr_match:
51+
response_text = "\n".join(getasminfo(i) for i in instr_match)
52+
else:
53+
response_text = ("No pude encontrar esa instrucción.\n"
54+
"Quizás quisiste decir:\n")
55+
response_text += "\n".join(getasminfo(i) for i in possibles)
56+
msg = update.message.reply_text(response_text, quote=False)
5857
context.sent_messages.append(msg)
5958

6059

0 commit comments

Comments
 (0)