Skip to content

Commit

Permalink
irc: toggle error replies (#1071)
Browse files Browse the repository at this point in the history
Adds config option to toggle Sopel replying directly to the error source.
  • Loading branch information
centipeda authored and maxpowa committed Apr 28, 2016
1 parent 2e50d5f commit 4813cc1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions sopel/config/core_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ def homedir(self):
It is a regular expression (so the default, ``\.``, means commands start
with a period), though using capturing groups will create problems."""

reply_errors = ValidatedAttribute('reply_errors', bool, default=True)
"""Whether to message the sender of a message that triggered an error with the exception."""

throttle_join = ValidatedAttribute('throttle_join', int)
"""Slow down the initial join of channels to prevent getting kicked.
Expand Down
4 changes: 2 additions & 2 deletions sopel/irc.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,10 @@ def error(self, trigger=None):
stderr("Could not save full traceback!")
LOGGER.error("Could not save traceback from %s to file: %s", trigger.sender, str(e))

if trigger and trigger.sender is not None:
if trigger and self.config.core.reply_errors and trigger.sender is not None:
self.msg(trigger.sender, signature)
except Exception as e:
if trigger and trigger.sender is not None:
if trigger and self.config.core.reply_errors and trigger.sender is not None:
self.msg(trigger.sender, "Got an error.")
LOGGER.error("Exception from %s: %s", trigger.sender, str(e))

Expand Down

0 comments on commit 4813cc1

Please sign in to comment.