From 6bab4b267a0d5fdcc8008e66611c1baadc40bf53 Mon Sep 17 00:00:00 2001 From: dgw Date: Sun, 6 Mar 2022 12:26:08 -0600 Subject: [PATCH 1/2] tell: catch missing message before it causes an exception --- sopel/modules/tell.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sopel/modules/tell.py b/sopel/modules/tell.py index e4a48e99d2..d63f3e9c03 100644 --- a/sopel/modules/tell.py +++ b/sopel/modules/tell.py @@ -180,6 +180,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: From 7ca858a01a793e380a5380ce51cb303bb4e3e9ef Mon Sep 17 00:00:00 2001 From: dgw Date: Sun, 6 Mar 2022 12:58:33 -0600 Subject: [PATCH 2/2] tell: example tests for the error cases Can't put nickname commands here because the pytest plugin doesn't handle them. That'll be a future patch... --- sopel/modules/tell.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sopel/modules/tell.py b/sopel/modules/tell.py index d63f3e9c03..6bc427d69e 100644 --- a/sopel/modules/tell.py +++ b/sopel/modules/tell.py @@ -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