Skip to content

Commit

Permalink
Merge pull request #2264 from sopel-irc/tell-argcheck
Browse files Browse the repository at this point in the history
tell: catch missing message before it causes an exception
  • Loading branch information
dgw authored Apr 22, 2022
2 parents 8b463a0 + 7ca858a commit 497f97e
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 @@ -169,7 +169,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 @@ -180,6 +182,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 497f97e

Please sign in to comment.