From f169157a3446ade62903d9587241db055944bafb Mon Sep 17 00:00:00 2001 From: pacuraro <122358966+pacuraro@users.noreply.github.com> Date: Tue, 1 Apr 2025 12:47:08 +0300 Subject: [PATCH 01/18] Update run_bot.py Signed-off-by: pacuraro <122358966+pacuraro@users.noreply.github.com> --- slackbot/management/commands/run_bot.py | 32 ++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/slackbot/management/commands/run_bot.py b/slackbot/management/commands/run_bot.py index fdbc077..74d67d4 100644 --- a/slackbot/management/commands/run_bot.py +++ b/slackbot/management/commands/run_bot.py @@ -40,6 +40,31 @@ def handle_message(self, **payload): close_old_connections() self.handle_message_really(**payload) + def handle_reaction(self, **payload): + event = payload.get("event", {}) + # Extract channel from the item that was reacted to + channel = event.get("item", {}).get("channel") + user = event.get("user") + # Use event timestamp if available + ts = event.get("event_ts", event.get("ts", "")) + + processed_at_least_one = False + for p in self.processors: + try: + # Pass an empty string for message since reactions don't have text content, + # but you can still use the event in `raw` to let your processors decide what to do. + r = p.process("", user=user, channel=channel, ts=ts, raw=event) + if r: + if not isinstance(r, tuple): + r = (r,) + if MessageProcessor.PROCESSED in r: + processed_at_least_one = True + if MessageProcessor.STOP in r: + break + except Exception as exc: + self.log_exception(f"Processor {str(p)} failed with {str(exc)} for reaction event {event}") + return processed_at_least_one + def handle_message_really(self, **payload): event = payload.get("event") @@ -118,8 +143,13 @@ def process(self, client: SocketModeClient, req: SocketModeRequest): response = SocketModeResponse(envelope_id=req.envelope_id) client.send_socket_mode_response(response) - if req.payload["event"]["type"] == "message" and req.payload["event"].get("subtype") is None: + event = req.payload.get("event", {}) + event_type = event.get("type") + + if event_type == "message" and event.get("subtype") is None: return self.handle_message(**req.payload) + elif event_type in ("reaction_added", "reaction_removed"): + return self.handle_reaction(**req.payload) def handle(self, *args, **options): # faster cold boot From fa50862225a0fba88d23f703472ef5f70b4298f4 Mon Sep 17 00:00:00 2001 From: Ovidiu Pacurar Date: Tue, 1 Apr 2025 14:34:52 +0300 Subject: [PATCH 02/18] Remformat with black --- slackbot/management/commands/run_bot.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/slackbot/management/commands/run_bot.py b/slackbot/management/commands/run_bot.py index 74d67d4..180eb8b 100644 --- a/slackbot/management/commands/run_bot.py +++ b/slackbot/management/commands/run_bot.py @@ -47,12 +47,10 @@ def handle_reaction(self, **payload): user = event.get("user") # Use event timestamp if available ts = event.get("event_ts", event.get("ts", "")) - + processed_at_least_one = False for p in self.processors: try: - # Pass an empty string for message since reactions don't have text content, - # but you can still use the event in `raw` to let your processors decide what to do. r = p.process("", user=user, channel=channel, ts=ts, raw=event) if r: if not isinstance(r, tuple): From ebaa8a51db3ad9ef0b5a77374d56965d086da0ed Mon Sep 17 00:00:00 2001 From: Ovidiu Pacurar Date: Tue, 1 Apr 2025 14:53:04 +0300 Subject: [PATCH 03/18] Adding test --- testapp/tests/test_run_bot.py | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 testapp/tests/test_run_bot.py diff --git a/testapp/tests/test_run_bot.py b/testapp/tests/test_run_bot.py new file mode 100644 index 0000000..4c2f5c9 --- /dev/null +++ b/testapp/tests/test_run_bot.py @@ -0,0 +1,56 @@ +import unittest +from unittest.mock import patch, MagicMock +from slackbot.management.commands.run_bot import Command +from slack_sdk.socket_mode.request import SocketModeRequest + + +class TestSlackBotCommand(unittest.TestCase): + def setUp(self): + self.command = Command() + self.command.web = MagicMock() + self.command.client = MagicMock() + self.command.my_id = "U123456" + self.command.my_id_match = "<@U123456>" + self.command.processors = [] + + @patch("slackbot.management.commands.run_bot.close_old_connections") + def test_handle_message(self, mock_close_old_connections): + payload = { + "event": { + "channel": "C12345", + "user": "U67890", + "text": "Hello, bot!", + "ts": "123456.789", + } + } + result = self.command.handle_message(**payload) + self.assertFalse(result) # No processors, so should return False + + def test_handle_reaction(self): + payload = { + "event": { + "type": "reaction_added", + "item": {"channel": "C12345"}, + "user": "U67890", + "event_ts": "123456.789", + } + } + result = self.command.handle_reaction(**payload) + self.assertFalse(result) # No processors, so should return False + + def test_process_event_message(self): + request = SocketModeRequest( + type="events_api", + envelope_id="envelope123", + payload={"event": {"type": "message", "subtype": None, "text": "Hello!"}}, + ) + + self.command.handle_message = MagicMock(return_value=True) + result = self.command.process(self.command.client, request) + + self.command.handle_message.assert_called_once() + self.assertTrue(result) + + +if __name__ == "__main__": + unittest.main() From f6038c1ae005fc61785c59050bd2769d72dc47d2 Mon Sep 17 00:00:00 2001 From: Ovidiu Pacurar Date: Tue, 1 Apr 2025 15:12:10 +0300 Subject: [PATCH 04/18] Another test --- testapp/tests/test_run_bot.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/testapp/tests/test_run_bot.py b/testapp/tests/test_run_bot.py index 4c2f5c9..f28c7a5 100644 --- a/testapp/tests/test_run_bot.py +++ b/testapp/tests/test_run_bot.py @@ -26,6 +26,20 @@ def test_handle_message(self, mock_close_old_connections): result = self.command.handle_message(**payload) self.assertFalse(result) # No processors, so should return False + @patch("threading.Event.wait", return_value=None) + @patch("slackbot.management.commands.run_bot.SocketModeClient") + @patch("slackbot.management.commands.run_bot.settings") + def test_handle(self, mock_settings, mock_socket_client, mock_event_wait): + mock_settings.SLACKBOT_BOT_TOKEN = "xoxb-123" + mock_settings.SLACKBOT_APP_TOKEN = "xapp-123" + + mock_client_instance = mock_socket_client.return_value + self.command.set_up = MagicMock() + self.command.handle() + + self.command.set_up.assert_called_once() + mock_client_instance.connect.assert_called_once() + def test_handle_reaction(self): payload = { "event": { From f6c177730c33599c5d03ab196aa4f7db6f50aad6 Mon Sep 17 00:00:00 2001 From: pacuraro <122358966+pacuraro@users.noreply.github.com> Date: Tue, 1 Apr 2025 15:20:36 +0300 Subject: [PATCH 05/18] Update __init__.py Signed-off-by: pacuraro <122358966+pacuraro@users.noreply.github.com> --- slackbot/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slackbot/__init__.py b/slackbot/__init__.py index f0ad6b9..ff83e31 100644 --- a/slackbot/__init__.py +++ b/slackbot/__init__.py @@ -1,6 +1,6 @@ from functools import lru_cache -__version__ = "0.1.6" +__version__ = "0.1.7" @lru_cache From dba27409495fcebd49d49dec53c05c6b8099f176 Mon Sep 17 00:00:00 2001 From: Ovidiu Pacurar Date: Tue, 1 Apr 2025 15:28:31 +0300 Subject: [PATCH 06/18] even more tests --- testapp/tests/test_run_bot.py | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/testapp/tests/test_run_bot.py b/testapp/tests/test_run_bot.py index f28c7a5..6a1061e 100644 --- a/testapp/tests/test_run_bot.py +++ b/testapp/tests/test_run_bot.py @@ -65,6 +65,43 @@ def test_process_event_message(self): self.command.handle_message.assert_called_once() self.assertTrue(result) + def test_post_message(self): + self.command.post_message(channel="C12345", text="Hello!") + self.command.web.chat_postMessage.assert_called_once_with( + channel="C12345", text="Hello!", as_user=1 + ) + + def test_post_ephemeral(self): + self.command.post_ephemeral(channel="C12345", text="Hello!", user="U67890") + self.command.web.chat_postEphemeral.assert_called_once_with( + channel="C12345", text="Hello!", user="U67890", as_user=True + ) + + @patch( + "slackbot.management.commands.run_bot.unicodedata.normalize", + return_value="Hello bot!", + ) + def test_handle_message_really_reacts_when_no_processors(self, mock_normalize): + self.command.web.reactions_add = MagicMock() + self.command.post_ephemeral = MagicMock() + + payload = { + "event": { + "channel": "D12345", + "user": "U67890", + "text": "Hello!", + "ts": "123456.789", + "team": "T123", + } + } + + self.command.handle_message_really(**payload) + + self.command.web.reactions_add.assert_called_once_with( + name="surface_not_found", channel="D12345", timestamp="123456.789" + ) + self.command.post_ephemeral.assert_called_once() + if __name__ == "__main__": unittest.main() From 42c20c0ee65c7c8f8175c32306216be435c5e32d Mon Sep 17 00:00:00 2001 From: Ovidiu Pacurar Date: Tue, 1 Apr 2025 15:30:01 +0300 Subject: [PATCH 07/18] reforamt --- testapp/tests/test_run_bot.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/testapp/tests/test_run_bot.py b/testapp/tests/test_run_bot.py index 6a1061e..f6d1461 100644 --- a/testapp/tests/test_run_bot.py +++ b/testapp/tests/test_run_bot.py @@ -67,9 +67,7 @@ def test_process_event_message(self): def test_post_message(self): self.command.post_message(channel="C12345", text="Hello!") - self.command.web.chat_postMessage.assert_called_once_with( - channel="C12345", text="Hello!", as_user=1 - ) + self.command.web.chat_postMessage.assert_called_once_with(channel="C12345", text="Hello!", as_user=1) def test_post_ephemeral(self): self.command.post_ephemeral(channel="C12345", text="Hello!", user="U67890") From d6a7c51fc15eef501e9708dcf752080bd540b5f8 Mon Sep 17 00:00:00 2001 From: pacuraro <122358966+pacuraro@users.noreply.github.com> Date: Tue, 1 Apr 2025 15:59:48 +0300 Subject: [PATCH 08/18] Update slackbot/management/commands/run_bot.py Co-authored-by: Duarte Duarte Signed-off-by: pacuraro <122358966+pacuraro@users.noreply.github.com> --- slackbot/management/commands/run_bot.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/slackbot/management/commands/run_bot.py b/slackbot/management/commands/run_bot.py index 180eb8b..5d3aab3 100644 --- a/slackbot/management/commands/run_bot.py +++ b/slackbot/management/commands/run_bot.py @@ -141,12 +141,11 @@ def process(self, client: SocketModeClient, req: SocketModeRequest): response = SocketModeResponse(envelope_id=req.envelope_id) client.send_socket_mode_response(response) - event = req.payload.get("event", {}) - event_type = event.get("type") + event = req.payload["event"] - if event_type == "message" and event.get("subtype") is None: + if event["type"] == "message" and event.get("subtype") is None: return self.handle_message(**req.payload) - elif event_type in ("reaction_added", "reaction_removed"): + elif event["type"] in ("reaction_added", "reaction_removed"): return self.handle_reaction(**req.payload) def handle(self, *args, **options): From c6635103db3d2db320e61697838f17c2ffbd7c2b Mon Sep 17 00:00:00 2001 From: Ovidiu Pacurar Date: Tue, 1 Apr 2025 16:16:38 +0300 Subject: [PATCH 09/18] Adding a new method for processing reaction --- slackbot/management/commands/run_bot.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/slackbot/management/commands/run_bot.py b/slackbot/management/commands/run_bot.py index 5d3aab3..9802548 100644 --- a/slackbot/management/commands/run_bot.py +++ b/slackbot/management/commands/run_bot.py @@ -51,7 +51,7 @@ def handle_reaction(self, **payload): processed_at_least_one = False for p in self.processors: try: - r = p.process("", user=user, channel=channel, ts=ts, raw=event) + r = p.process_reaction(user=user, channel=channel, ts=ts, raw=event) if r: if not isinstance(r, tuple): r = (r,) @@ -145,7 +145,13 @@ def process(self, client: SocketModeClient, req: SocketModeRequest): if event["type"] == "message" and event.get("subtype") is None: return self.handle_message(**req.payload) - elif event["type"] in ("reaction_added", "reaction_removed"): + + def process_reaction(self, client: SocketModeClient, req: SocketModeRequest): + if req.type == "events_api": + response = SocketModeResponse(envelope_id=req.envelope_id) + client.send_socket_mode_response(response) + event = req.payload["event"] + if event["type"] in ("reaction_added", "reaction_removed"): return self.handle_reaction(**req.payload) def handle(self, *args, **options): From 762a94a2f2ce3889826a1a0fa77cea3f037d1b2f Mon Sep 17 00:00:00 2001 From: Ovidiu Pacurar Date: Tue, 1 Apr 2025 17:28:39 +0300 Subject: [PATCH 10/18] Move the handle_reaction to be separate --- slackbot/base.py | 18 ++++++++++++++++++ slackbot/management/commands/run_bot.py | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/slackbot/base.py b/slackbot/base.py index e9316ca..760b42d 100644 --- a/slackbot/base.py +++ b/slackbot/base.py @@ -27,6 +27,24 @@ def post_ephemeral(self, **kwargs): kwargs["as_user"] = kwargs.get("as_user", 1) return self.web.chat_postEphemeral(**kwargs) + def process_reaction(self, reaction_event: dict) -> Optional[Union[int, tuple[int, int]]]: + """ + Handles reactions added or removed in Slack messages. + + :param reaction_event: A dictionary containing reaction event data. + :return: None, self.STOP, self.PROCESSED, or tuple (self.PROCESSED, self.STOP) + + PROCESSED if anything was done with input + STOP if no other processor should be called after this one + """ + if "reaction" not in reaction_event: + return # Ignore events that are not reactions + + return self.handle_reaction(reaction_event) + + def handle_reaction(self, reaction_event) -> Optional[Union[int, tuple[int, int]]]: + return None + def process(self, message, **kw) -> Optional[Union[int, tuple[int, int]]]: """ :return: None, self.STOP, self.PROCESSED, or tuple PROCESSED,STOP diff --git a/slackbot/management/commands/run_bot.py b/slackbot/management/commands/run_bot.py index 9802548..916ef03 100644 --- a/slackbot/management/commands/run_bot.py +++ b/slackbot/management/commands/run_bot.py @@ -51,7 +51,7 @@ def handle_reaction(self, **payload): processed_at_least_one = False for p in self.processors: try: - r = p.process_reaction(user=user, channel=channel, ts=ts, raw=event) + r = p.process_reaction(event) if r: if not isinstance(r, tuple): r = (r,) @@ -166,6 +166,7 @@ def handle(self, *args, **options): ) self.set_up() self.client.socket_mode_request_listeners.append(self.process) + self.client.socket_mode_request_listeners.append(self.process_reaction) self.stdout.write("Connecting...\n") self.client.connect() From 2edf12d6dbfbb376221b339d32351e32bc1d7a12 Mon Sep 17 00:00:00 2001 From: pacuraro <122358966+pacuraro@users.noreply.github.com> Date: Tue, 1 Apr 2025 17:40:35 +0300 Subject: [PATCH 11/18] Remove unused variables Signed-off-by: pacuraro <122358966+pacuraro@users.noreply.github.com> --- slackbot/management/commands/run_bot.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/slackbot/management/commands/run_bot.py b/slackbot/management/commands/run_bot.py index 916ef03..0795dd1 100644 --- a/slackbot/management/commands/run_bot.py +++ b/slackbot/management/commands/run_bot.py @@ -42,12 +42,6 @@ def handle_message(self, **payload): def handle_reaction(self, **payload): event = payload.get("event", {}) - # Extract channel from the item that was reacted to - channel = event.get("item", {}).get("channel") - user = event.get("user") - # Use event timestamp if available - ts = event.get("event_ts", event.get("ts", "")) - processed_at_least_one = False for p in self.processors: try: From bb68565d0d9ec75c295afd747e2aa14222ab9724 Mon Sep 17 00:00:00 2001 From: pacuraro <122358966+pacuraro@users.noreply.github.com> Date: Tue, 1 Apr 2025 17:46:13 +0300 Subject: [PATCH 12/18] Return reaction_event Signed-off-by: pacuraro <122358966+pacuraro@users.noreply.github.com> --- slackbot/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slackbot/base.py b/slackbot/base.py index 760b42d..b49082b 100644 --- a/slackbot/base.py +++ b/slackbot/base.py @@ -43,7 +43,7 @@ def process_reaction(self, reaction_event: dict) -> Optional[Union[int, tuple[in return self.handle_reaction(reaction_event) def handle_reaction(self, reaction_event) -> Optional[Union[int, tuple[int, int]]]: - return None + return reaction_event def process(self, message, **kw) -> Optional[Union[int, tuple[int, int]]]: """ From 781df536f6605c088cf4e9883579bd6b293eca86 Mon Sep 17 00:00:00 2001 From: Ovidiu Pacurar Date: Wed, 2 Apr 2025 11:44:41 +0300 Subject: [PATCH 13/18] Solving comments --- slackbot/base.py | 2 +- slackbot/management/commands/run_bot.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/slackbot/base.py b/slackbot/base.py index b49082b..bfcc438 100644 --- a/slackbot/base.py +++ b/slackbot/base.py @@ -43,7 +43,7 @@ def process_reaction(self, reaction_event: dict) -> Optional[Union[int, tuple[in return self.handle_reaction(reaction_event) def handle_reaction(self, reaction_event) -> Optional[Union[int, tuple[int, int]]]: - return reaction_event + raise NotImplementedError() def process(self, message, **kw) -> Optional[Union[int, tuple[int, int]]]: """ diff --git a/slackbot/management/commands/run_bot.py b/slackbot/management/commands/run_bot.py index 0795dd1..3c32dea 100644 --- a/slackbot/management/commands/run_bot.py +++ b/slackbot/management/commands/run_bot.py @@ -53,8 +53,8 @@ def handle_reaction(self, **payload): processed_at_least_one = True if MessageProcessor.STOP in r: break - except Exception as exc: - self.log_exception(f"Processor {str(p)} failed with {str(exc)} for reaction event {event}") + except Exception as e: + self.log_exception("Processor failed for reaction event: %s", event, e) return processed_at_least_one def handle_message_really(self, **payload): @@ -97,8 +97,8 @@ def handle_message_really(self, **payload): processed_at_least_one = True if MessageProcessor.STOP in r: break - except Exception as exc: - self.log_exception(f"Processor {str(p)} failed with {str(exc)} for message {message}") + except Exception as e: + self.log_exception("Processor failed for message: %s", message, e) # If private DM if channel[0] == "D": From c0e944c400abe37e574dd1b5976ba6230c596a74 Mon Sep 17 00:00:00 2001 From: pacuraro <122358966+pacuraro@users.noreply.github.com> Date: Wed, 2 Apr 2025 11:55:51 +0300 Subject: [PATCH 14/18] Remove brackets Signed-off-by: pacuraro <122358966+pacuraro@users.noreply.github.com> --- slackbot/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slackbot/base.py b/slackbot/base.py index bfcc438..d97e611 100644 --- a/slackbot/base.py +++ b/slackbot/base.py @@ -43,7 +43,7 @@ def process_reaction(self, reaction_event: dict) -> Optional[Union[int, tuple[in return self.handle_reaction(reaction_event) def handle_reaction(self, reaction_event) -> Optional[Union[int, tuple[int, int]]]: - raise NotImplementedError() + raise NotImplementedError def process(self, message, **kw) -> Optional[Union[int, tuple[int, int]]]: """ From 6372f16ec5a4c63dcef422e921710e4c5e144405 Mon Sep 17 00:00:00 2001 From: pacuraro <122358966+pacuraro@users.noreply.github.com> Date: Wed, 2 Apr 2025 12:01:34 +0300 Subject: [PATCH 15/18] Revert Signed-off-by: pacuraro <122358966+pacuraro@users.noreply.github.com> --- slackbot/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slackbot/base.py b/slackbot/base.py index d97e611..bfcc438 100644 --- a/slackbot/base.py +++ b/slackbot/base.py @@ -43,7 +43,7 @@ def process_reaction(self, reaction_event: dict) -> Optional[Union[int, tuple[in return self.handle_reaction(reaction_event) def handle_reaction(self, reaction_event) -> Optional[Union[int, tuple[int, int]]]: - raise NotImplementedError + raise NotImplementedError() def process(self, message, **kw) -> Optional[Union[int, tuple[int, int]]]: """ From fa1abd9832086aba2d9be0ffed06f6a79ad83226 Mon Sep 17 00:00:00 2001 From: pacuraro <122358966+pacuraro@users.noreply.github.com> Date: Wed, 2 Apr 2025 12:09:18 +0300 Subject: [PATCH 16/18] Changed to pass in handle_reaction() Signed-off-by: pacuraro <122358966+pacuraro@users.noreply.github.com> --- slackbot/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slackbot/base.py b/slackbot/base.py index bfcc438..fc0dc9a 100644 --- a/slackbot/base.py +++ b/slackbot/base.py @@ -43,7 +43,7 @@ def process_reaction(self, reaction_event: dict) -> Optional[Union[int, tuple[in return self.handle_reaction(reaction_event) def handle_reaction(self, reaction_event) -> Optional[Union[int, tuple[int, int]]]: - raise NotImplementedError() + pass def process(self, message, **kw) -> Optional[Union[int, tuple[int, int]]]: """ From 71eef146870d5da6592d3eddcbad3ba2ad3abfff Mon Sep 17 00:00:00 2001 From: pacuraro <122358966+pacuraro@users.noreply.github.com> Date: Wed, 2 Apr 2025 14:52:17 +0300 Subject: [PATCH 17/18] Added comment Signed-off-by: pacuraro <122358966+pacuraro@users.noreply.github.com> --- slackbot/base.py | 1 + 1 file changed, 1 insertion(+) diff --git a/slackbot/base.py b/slackbot/base.py index fc0dc9a..2c6a72f 100644 --- a/slackbot/base.py +++ b/slackbot/base.py @@ -43,6 +43,7 @@ def process_reaction(self, reaction_event: dict) -> Optional[Union[int, tuple[in return self.handle_reaction(reaction_event) def handle_reaction(self, reaction_event) -> Optional[Union[int, tuple[int, int]]]: + # This method is currently a placeholder. pass def process(self, message, **kw) -> Optional[Union[int, tuple[int, int]]]: From 36d2c47ff7c7184cbdbdbc3d516e5ef0bbec9a9d Mon Sep 17 00:00:00 2001 From: pacuraro <122358966+pacuraro@users.noreply.github.com> Date: Wed, 2 Apr 2025 15:34:39 +0300 Subject: [PATCH 18/18] Change to self.log_exception Signed-off-by: pacuraro <122358966+pacuraro@users.noreply.github.com> --- slackbot/management/commands/run_bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slackbot/management/commands/run_bot.py b/slackbot/management/commands/run_bot.py index 3c32dea..cae007f 100644 --- a/slackbot/management/commands/run_bot.py +++ b/slackbot/management/commands/run_bot.py @@ -54,7 +54,7 @@ def handle_reaction(self, **payload): if MessageProcessor.STOP in r: break except Exception as e: - self.log_exception("Processor failed for reaction event: %s", event, e) + self.log_exception("Processor failed for reaction event: %s %s", event, str(e)) return processed_at_least_one def handle_message_really(self, **payload): @@ -98,7 +98,7 @@ def handle_message_really(self, **payload): if MessageProcessor.STOP in r: break except Exception as e: - self.log_exception("Processor failed for message: %s", message, e) + self.log_exception("Processor failed for message: %s %s", message, str(e)) # If private DM if channel[0] == "D":