From 3982458acaf0ff9aee3c6e442aa4a03851df9a60 Mon Sep 17 00:00:00 2001 From: Fedor Zhukov Date: Wed, 21 May 2025 10:57:14 +0200 Subject: [PATCH] feature: add nullbytes for answers with %send_nl=0 this depends on gnetcli feature: https://github.com/annetutil/gnetcli/pull/198/ --- annet/deploy.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/annet/deploy.py b/annet/deploy.py index 9fd2ab87..e88fef4b 100644 --- a/annet/deploy.py +++ b/annet/deploy.py @@ -157,14 +157,15 @@ def __call__(self, dev: Connector, cmd: Command, match_content: bytes): def rb_question_to_question(q: MakeMessageMatcher, a: Answer) -> Question: # TODO: drop MakeMessageMatcher - if not a.send_nl: - raise Exception("not supported false send_nl") text: str = q._text # pylint: disable=protected-access + answer: str = a.text is_regexp = False if text.startswith("/") and text.endswith("/"): is_regexp = True text = text[1:-1] - res = Question(question=text, answer=a.text, is_regexp=is_regexp) + if not a.send_nl: + answer += "\x00" + res = Question(question=text, answer=answer, is_regexp=is_regexp) return res