diff options
author | niklas <niklas@niklashalle.net> | 2020-08-24 09:06:50 +0200 |
---|---|---|
committer | niklas <niklas@niklashalle.net> | 2020-08-24 09:06:50 +0200 |
commit | 03056b5664c8a7cf094ae92555fef4d67ab48524 (patch) | |
tree | 542b1ee5e64c8725a77c50ca67d202cee912af6e | |
parent | 0e7032a327410ea1a979a363fc231af0265c30ec (diff) | |
download | n_frontend_signal-03056b5664c8a7cf094ae92555fef4d67ab48524.tar.gz n_frontend_signal-03056b5664c8a7cf094ae92555fef4d67ab48524.zip |
works
-rwxr-xr-x | main.py | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -37,6 +37,7 @@ def register_signald(number): def startup(number): s = Signal(number) + # with args @s.chat_handler("/([^\\s]+)\\s+(.*)", order=10) # This is case-insensitive. def klinger(message, match): # Returning `False` as the first argument will cause matching to continue @@ -45,7 +46,25 @@ def startup(number): # TODO: try catch response = requests.post('http://localhost:18080', - json={"command": match.group(1), "arguments": match.group(2)}) + json={"command": match.group(1), "arguments": strip(match.group(2))}) + + answer = "" + replies = response.json()['reply'] + for reply in replies: + answer += reply['text'] + + return stop, answer + + # no args + @s.chat_handler("/(.+)", order=20) # This is case-insensitive. + def klinger(message, match): + # Returning `False` as the first argument will cause matching to continue + # after this handler runs. + stop = True + + # TODO: try catch + response = requests.post('http://localhost:18080', + json={"command": match.group(1), "arguments": ""}) answer = "" replies = response.json()['reply'] |