fix choice command

This commit is contained in:
iou1name 2022-10-29 19:25:12 -04:00
parent 54011632fc
commit dc797fdaab
2 changed files with 4 additions and 1 deletions

View File

@ -40,7 +40,7 @@ def choose(bot, trigger):
""" """
if len(trigger.args) < 2: if len(trigger.args) < 2:
return bot.reply("Choose what?") return bot.reply("Choose what?")
choices = trigger.args[1].split('|') choices = trigger.msg.partition(' ')[2].split('|')
pick = random.choice(choices) pick = random.choice(choices)
msg = f"Your options: {'|'.join(choices)}. My choice: {pick}" msg = f"Your options: {'|'.join(choices)}. My choice: {pick}"
bot.reply(msg) bot.reply(msg)

View File

@ -47,6 +47,9 @@ class Trigger():
self.args = message.strip().split(' ') self.args = message.strip().split(' ')
"""Pseudo-ARGV for a bot command.""" """Pseudo-ARGV for a bot command."""
self.msg = message
"""Retain the original message."""
admins = config.admins + [config.owner] admins = config.admins + [config.owner]
self.admin = any([user == admin for admin in admins]) self.admin = any([user == admin for admin in admins])
""" """