Skip to content

Commit

Permalink
Merge pull request #2584 from SnoopJ/bugfix/fix-empty-tellee
Browse files Browse the repository at this point in the history
tell: avoid errors produced by empty tellee
  • Loading branch information
dgw authored Dec 18, 2023
2 parents 6fc9eee + 4edc352 commit 973a489
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions sopel/builtins/tell.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,28 @@ def _format_safe_lstrip(text):
@plugin.command('tell', 'ask')
@plugin.nickname_command('tell', 'ask')
@plugin.example('$nickname, tell dgw he broke it again.', user_help=True)
@plugin.example('.ask ', 'ask whom?')
@plugin.example('.tell ', 'tell whom?')
@plugin.example('.ask @', 'ask whom?')
@plugin.example('.tell @', 'tell whom?')
@plugin.example('.ask Exirel ', 'ask Exirel what?')
@plugin.example('.tell Exirel ', 'tell Exirel what?')
@plugin.example('.ask @Exirel ', 'ask Exirel what?')
@plugin.example('.tell @Exirel ', 'tell Exirel what?')
def f_remind(bot, trigger):
"""Give someone a message the next time they're seen"""
teller = trigger.nick
verb = trigger.group(1)

if not trigger.group(3):
tellee = ""
else:
tellee = trigger.group(3).rstrip('.,:;').lstrip('@')

if not tellee:
bot.reply("%s whom?" % verb)
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):
Expand All @@ -204,9 +213,6 @@ def f_remind(bot, trigger):
bot.reply('That nickname is too long.')
return

if tellee[0] == '@':
tellee = tellee[1:]

if tellee == bot.nick:
bot.reply("I'm here now; you can %s me whatever you want!" % verb)
return
Expand Down

0 comments on commit 973a489

Please sign in to comment.