Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coretasks, test: handle core.modes setting being None #2510

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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