bots: Print send_message errors for dev debugging.
MODIFY
zulip_bots/zulip_bots/lib.py
zulip_bots/zulip_bots/lib.py
@@ -140,7 +140,10 @@ class ExternalBotHandler(object):
def send_message(self, message: (Dict[str, Any])) -> Dict[str, Any]:
if not self._rate_limit.is_legal():
self._rate_limit.show_error_and_exit()
- return self._client.send_message(message)
+ resp = self._client.send_message(message)
+ if resp.get('result') == 'error':
+ print("ERROR!: " + str(resp))
+ return resp
def send_reply(self, message: Dict[str, Any], response: str, widget_content: Optional[str]=None) -> Dict[str, Any]:
if message['type'] == 'private':

MODIFY
zulip_bots/zulip_bots/tests/test_lib.py
zulip_bots/zulip_bots/tests/test_lib.py
@@ -32,7 +32,9 @@ class FakeClient:
)
def send_message(self, message):
- pass
+ return dict(
+ result='success',
+ )
class FakeBotHandler:
def usage(self):

bots: Print send_message errors for dev debugging.