From b6f095b8b20fc1a50aaba27b961a2db48e1d332c Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Mon, 13 May 2019 16:28:45 -0400 Subject: [PATCH] better than endswith for a single char --- sopel_modules/SpiceBot_CommandsQuery/QueryCommand.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sopel_modules/SpiceBot_CommandsQuery/QueryCommand.py b/sopel_modules/SpiceBot_CommandsQuery/QueryCommand.py index 5846ba4..939d823 100644 --- a/sopel_modules/SpiceBot_CommandsQuery/QueryCommand.py +++ b/sopel_modules/SpiceBot_CommandsQuery/QueryCommand.py @@ -34,7 +34,7 @@ def query_detection(bot, trigger): if com not in commands_list.keys(): commands_list[com] = bot.memory['SpiceBot_CommandsQuery']['commands'][commandstype][com] - if triggercommand.endswith("+"): + if triggercommand[:-1] == "+": triggercommand = triggercommand[:-1] if not triggercommand or not len(triggercommand): @@ -55,7 +55,7 @@ def query_detection(bot, trigger): bot.notice("The following commands match " + str(triggercommand) + ": " + spicemanip.main(validcomlist, 'andlist') + ".", trigger.nick) return - if triggercommand.endswith("?"): + if triggercommand[:-1] == "?": triggercommand = triggercommand[:-1] if not triggercommand or not len(triggercommand):