From acd1ac18b645fe0c124b20d5966ce6d3417fac5a Mon Sep 17 00:00:00 2001 From: Jean-Carol Forato Date: Fri, 10 Feb 2023 14:27:48 +0100 Subject: [PATCH 1/2] Log filtered command name If a command is blocked by a cmdfilter, the name of the command should be logged instead of logged as "None". --- errbot/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/errbot/core.py b/errbot/core.py index 390e2ef7b..6c8ffe30e 100644 --- a/errbot/core.py +++ b/errbot/core.py @@ -426,7 +426,7 @@ def _process_command_filters( for cmd_filter in self.command_filters: msg, cmd, args = cmd_filter(msg, cmd, args, dry_run) if msg is None: - return None, None, None + return None, cmd, args return msg, cmd, args except Exception: log.exception( @@ -440,7 +440,7 @@ def _process_command(self, msg, cmd, args, match): # first it must go through the command filters msg, cmd, args = self._process_command_filters(msg, cmd, args, False) if msg is None: - log.info("Command %s blocked or deferred.", cmd) + log.info("Command \"%s\" blocked or deferred.", cmd) return frm = msg.frm From cb9d0ae671a522e8d82dbe94986e1dbb2b75aafa Mon Sep 17 00:00:00 2001 From: Jean-Carol Forato Date: Fri, 10 Feb 2023 14:31:04 +0100 Subject: [PATCH 2/2] Update cmdfilter docstring Returning cmd and args is not used by anything but for logging purposes. --- errbot/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/errbot/__init__.py b/errbot/__init__.py index ce6f5cb23..1d1a407cb 100644 --- a/errbot/__init__.py +++ b/errbot/__init__.py @@ -566,7 +566,7 @@ def some_filter(self, msg, cmd, args, dry_run): command is authorized or not. \"\"\" # If wishing to block the incoming command: - return None, None, None + return None, cmd, args # Otherwise pass data through to the (potential) next filter: return msg, cmd, args