From a9b6acd83015d3366395ea16b66cf8962ee5a1cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Mon, 24 Sep 2018 18:40:51 +0200 Subject: [PATCH] fix: .set command now handles spaces properly --- sopel/modules/admin.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sopel/modules/admin.py b/sopel/modules/admin.py index 20adc3cd3d..b0ad1030a4 100644 --- a/sopel/modules/admin.py +++ b/sopel/modules/admin.py @@ -191,9 +191,13 @@ def set_config(bot, trigger): bot.say('[{}] section has no option {}.'.format(section_name, option)) return + delim = trigger.group(2).find(' ') + # Skip preceeding whitespaces, if any. + while delim > 0 and delim < len(trigger.group(2)) and trigger.group(2)[delim] == ' ': + delim = delim + 1 + # Display current value if no value is given. - value = trigger.group(4) - if not value: + if delim == -1 or delim == len(trigger.group(2)): if not static_sec and bot.config.parser.has_option(section, option): bot.reply("Option %s.%s does not exist." % (section_name, option)) return @@ -207,6 +211,7 @@ def set_config(bot, trigger): return # Otherwise, set the value to one given as argument 2. + value = trigger.group(2)[delim:] if static_sec: descriptor = getattr(section.__class__, option) try: