While trying to respond to a webhook in slack channel, I have encountered an issue where re_botcmd matched message does not contain the dictionary a slack message should, more specifically the dictionary called _channel_info in the person.py file
log cleared of personal info (***** substitutes the personal info):
Traceback (most recent call last):
File "*******/env38/lib/python3.8/site-packages/errbot/core.py", line 574, in _execute_and_send
reply = method(msg, match) if match else method(msg, args)
File "*******/testrunner/testrunner.py", line 458, in parse_rapid7_scan
channel = msg.frm.channelname
File "*******/env38/lib/python3.8/site-packages/slackv3/person.py", line 128, in channelname
if self._channel_info["is_im"] is True:
KeyError: 'is_im'
As you can see trying to access the channelname this way causes an error, I have fixed it by utilising msg.frm.room.channelname instead which just takes the channelname without executing the problematic part of the code.
I suggest at least temporarily modifying the line to something like
if self._channel_info.get("is_im") is True:
or similar method that won't just stop the execution of the command due to KeyError
While trying to respond to a webhook in slack channel, I have encountered an issue where
re_botcmd
matched message does not contain the dictionary a slack message should, more specifically the dictionary called_channel_info
in the person.py filelog cleared of personal info (***** substitutes the personal info):
As you can see trying to access the channelname this way causes an error, I have fixed it by utilising
msg.frm.room.channelname
instead which just takes the channelname without executing the problematic part of the code.I suggest at least temporarily modifying the line to something like
or similar method that won't just stop the execution of the command due to KeyError
Thank you