Skip to content

Commit

Permalink
Merge pull request #2400 from sopel-irc/per-channel-disabled-coretasks
Browse files Browse the repository at this point in the history
bot: don't let per-channel config skip coretasks handlers
  • Loading branch information
dgw authored Feb 5, 2023
2 parents f527b13 + 06687ab commit 4c3e45e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions sopel/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,9 @@ def call_rule(
if 'disable_plugins' in channel_config:
disabled_plugins = channel_config.disable_plugins.split(',')

if '*' in disabled_plugins:
if plugin_name == 'coretasks':
LOGGER.debug("disable_plugins refuses to skip a coretasks handler")
elif '*' in disabled_plugins:
return
elif plugin_name in disabled_plugins:
return
Expand All @@ -642,7 +644,9 @@ def call_rule(
disabled_commands = literal_eval(channel_config.disable_commands)
disabled_commands = disabled_commands.get(plugin_name, [])
if rule.get_rule_label() in disabled_commands:
return
if plugin_name != 'coretasks':
return
LOGGER.debug("disable_commands refuses to skip a coretasks handler")

try:
rule.execute(sopel, trigger)
Expand Down Expand Up @@ -705,8 +709,10 @@ def call(
)
return

# if channel has its own config section, check for excluded plugins/plugin methods
if trigger.sender in self.config:
# if channel has its own config section, check for excluded plugins/plugin methods,
# but only if the source plugin is NOT coretasks, because we NEED those handlers.
# Normal, whole-bot configuration will not let you disable coretasks either.
if trigger.sender in self.config and func.plugin_name != 'coretasks':
channel_config = self.config[trigger.sender]
LOGGER.debug(
"Evaluating configuration for %s.%s in channel %s",
Expand Down

0 comments on commit 4c3e45e

Please sign in to comment.