From dc797fdaab50602fa83f95c7fc881e22ec641293 Mon Sep 17 00:00:00 2001 From: iou1name Date: Sat, 29 Oct 2022 19:25:12 -0400 Subject: [PATCH] fix choice command --- modules/rand.py | 2 +- trigger.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/rand.py b/modules/rand.py index c8e3dce..32acb62 100755 --- a/modules/rand.py +++ b/modules/rand.py @@ -40,7 +40,7 @@ def choose(bot, trigger): """ if len(trigger.args) < 2: return bot.reply("Choose what?") - choices = trigger.args[1].split('|') + choices = trigger.msg.partition(' ')[2].split('|') pick = random.choice(choices) msg = f"Your options: {'|'.join(choices)}. My choice: {pick}" bot.reply(msg) diff --git a/trigger.py b/trigger.py index 0b6d6de..dde9d09 100755 --- a/trigger.py +++ b/trigger.py @@ -47,6 +47,9 @@ class Trigger(): self.args = message.strip().split(' ') """Pseudo-ARGV for a bot command.""" + self.msg = message + """Retain the original message.""" + admins = config.admins + [config.owner] self.admin = any([user == admin for admin in admins]) """