nicolabs / nicobot

🤟 A collection of *cool* chat bots 🤟
MIT License
1 stars 0 forks source link

askbot prints the JSON output 2 times instead of one #49

Closed nicobo closed 3 years ago

nicobo commented 3 years ago

This is problematic to extract the output.

Sample session :

$> docker run --rm -it nicolabs/nicobot askbot -b jabber -U mybot@myserver.im -r me@myserver.im --jabber-password 'mybotpassword' -m "Hello Toto !" -p bye 'bye' -v ERROR
{"args": {"backend": "jabber", "config_file": "/usr/src/app/config.yml", "config_dir": "/usr/src/app", "input_file": "<_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>", "max_count": -1, "patterns": [["bye", "bye"]], "stealth": false, "timeout": null, "verbosity": "ERROR", "username": "mybot@myserver.im", "recipients": ["mybot@myserver.im"], "debug": false, "jabber_username": null, "jabber_recipients": [], "jabber_password": "(obfuscated)", "signal_cli": null, "signal_username": null, "signal_group": null, "signal_recipients": [], "signal_stealth": false, "message": "Hello Toto !", "message_file": "<_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>"}, "result": {"max_count": false, "events": [{"message": "Romania", "matched_patterns": []}, {"message": "Byebye", "matched_patterns": ["bye"]}]}}
{'args': {'backend': 'jabber', 'config_file': '/usr/src/app/config.yml', 'config_dir': '/usr/src/app', 'input_file': <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>, 'max_count': -1, 'patterns': [['bye', 'bye']], 'stealth': False, 'timeout': None, 'verbosity': 'ERROR', 'username': 'mybot@myserver.im', 'recipients': ['mybot@myserver.im'], 'debug': False, 'jabber_username': None, 'jabber_recipients': [], 'jabber_password': '(obfuscated)', 'signal_cli': None, 'signal_username': None, 'signal_group': None, 'signal_recipients': [], 'signal_stealth': False, 'message': 'Hello Toto !', 'message_file': <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>}, 'result': {'max_count': False, 'events': [{'message': 'Romania', 'matched_patterns': []}, {'message': 'Byebye', 'matched_patterns': ['bye']}]}}
nicobo commented 3 years ago

Not reproduced from the source code with the latest content of master. Still to rebuild docker and test.

nicobo commented 3 years ago

This is a bug with the packaged versions : the command scripts generated by setup.py have this line, which prints out the return value from run even though it has printed it already :

sys.exit(run())