Skip to content

Commit

Permalink
Backport pull request #2264
Browse files Browse the repository at this point in the history
tell: catch missing message before it causes an exception
  • Loading branch information
dgw committed Apr 22, 2022
1 parent 3d33ceb commit 0a536c3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion sopel/modules/tell.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ def _format_safe_lstrip(text):

@plugin.command('tell', 'ask')
@plugin.nickname_command('tell', 'ask')
@plugin.example('$nickname, tell dgw he broke something again.')
@plugin.example('$nickname, tell dgw he broke it again.', user_help=True)
@plugin.example('.tell ', 'tell whom?')
@plugin.example('.ask Exirel ', 'ask Exirel what?')
def f_remind(bot, trigger):
"""Give someone a message the next time they're seen"""
teller = trigger.nick
Expand All @@ -186,6 +188,13 @@ def f_remind(bot, trigger):
return

tellee = trigger.group(3).rstrip('.,:;')

# all we care about is having at least one non-whitespace
# character after the name
if not trigger.group(4):
bot.reply("%s %s what?" % (verb, tellee))
return

msg = _format_safe_lstrip(trigger.group(2).split(' ', 1)[1])

if not msg:
Expand Down

0 comments on commit 0a536c3

Please sign in to comment.