Skip to content

Commit

Permalink
fix: .set command now handles spaces properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanicef committed Sep 24, 2018
1 parent 0a69d29 commit a9b6acd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sopel/modules/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit a9b6acd

Please sign in to comment.