From 2a0eb9e5e3e131443f8aa4bd3955352ba16edda4 Mon Sep 17 00:00:00 2001 From: James Gerity Date: Sun, 10 Dec 2023 23:12:40 -0500 Subject: [PATCH 1/2] tell: avoid errors produced by empty tellee Co-authored-by: bronzeguy <151421032+bronzeguy@users.noreply.github.com> Co-authored-by: dgw --- sopel/builtins/tell.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sopel/builtins/tell.py b/sopel/builtins/tell.py index 6bc427d69e..8365e01254 100644 --- a/sopel/builtins/tell.py +++ b/sopel/builtins/tell.py @@ -178,11 +178,14 @@ def f_remind(bot, trigger): 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): @@ -204,9 +207,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 From 4edc3529b62898284814fbffd761ebd9a298c7cb Mon Sep 17 00:00:00 2001 From: James Gerity Date: Tue, 12 Dec 2023 19:57:04 -0500 Subject: [PATCH 2/2] tell: add missing examples Co-authored-by: Florian Strzelecki --- sopel/builtins/tell.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sopel/builtins/tell.py b/sopel/builtins/tell.py index 8365e01254..436d9b3f29 100644 --- a/sopel/builtins/tell.py +++ b/sopel/builtins/tell.py @@ -170,8 +170,14 @@ 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