diff options
author | niklas <niklas@niklashalle.net> | 2020-08-26 12:26:37 +0200 |
---|---|---|
committer | niklas <niklas@niklashalle.net> | 2020-08-26 12:26:37 +0200 |
commit | af5a7898aa230d0f32c511c083dedc031c1b4334 (patch) | |
tree | ce5d924b685b454ea16e8a9eb3da56e940677046 | |
parent | 6a82d692200606a25054857739c71f54db812be9 (diff) | |
download | n_frontend_signal-af5a7898aa230d0f32c511c083dedc031c1b4334.tar.gz n_frontend_signal-af5a7898aa230d0f32c511c083dedc031c1b4334.zip |
fixed nested annotations
-rwxr-xr-x | main.py | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -35,22 +35,25 @@ def register_signald(number): def handle_replies(replies): answer = "" + if type(replies) is not list: + replies = [replies] for reply in replies: - answer = reply['text'] + l_answer = reply['text'] for annotation in reply["annotations"]: a_type = annotation["type"] a_extra = handle_replies(annotation["extra"]) if a_type == "command": - answer = f"/{answer}: {a_extra}\n" + l_answer = f"/{l_answer}: {a_extra}\n" elif a_type == "link": - answer = f"{a_extra} ({answer})" + l_answer = f"{a_extra} ({l_answer})" elif a_type == "bold": - answer = f"*{answer}*" + l_answer = f"*{l_answer}*" elif a_type == "italic": - answer = f"_{answer}_" + l_answer = f"_{l_answer}_" elif a_type == "strikethrough": - answer = f"~{answer}~" + l_answer = f"~{l_answer}~" + answer += l_answer return answer |