Skip to content

Commit

Permalink
Merge pull request #2510 from sopel-irc/core.modes=None
Browse files Browse the repository at this point in the history
coretasks, test: handle `core.modes` setting being `None`
  • Loading branch information
dgw authored Sep 26, 2023
2 parents 274470e + 314197e commit 953f2eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion sopel/coretasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,15 +463,19 @@ def handle_isupport(bot, trigger):
if not botmode_support and 'BOT' in bot.isupport:
# yes it was! set our mode unless the config overrides it
botmode = bot.isupport['BOT']
if botmode not in bot.config.core.modes:
modes_setting = bot.config.core.modes

if not modes_setting or botmode not in bot.config.core.modes:
bot.write(('MODE', bot.nick, '+' + botmode))

# was NAMESX support status updated?
if not namesx_support and 'NAMESX' in bot.isupport:
# yes it was!
if not bot.capabilities.is_enabled('multi-prefix'):
# and the multi-prefix capability is not enabled
# so we can ask the server to use the NAMESX feature
bot.write(('PROTOCTL', 'NAMESX'))

# was UHNAMES support status updated?
if not uhnames_support and 'UHNAMES' in bot.isupport:
# yes it was!
Expand Down
2 changes: 1 addition & 1 deletion test/test_coretasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def test_handle_isupport_chantypes(mockbot):
assert mockbot.make_identifier('!channel').is_nick()


@pytest.mark.parametrize('modes', ['', 'Rw'])
@pytest.mark.parametrize('modes', [None, '', 'Rw'])
def test_handle_isupport_bot_mode(mockbot, modes):
mockbot.config.core.modes = modes

Expand Down

0 comments on commit 953f2eb

Please sign in to comment.