import io
import random
import shlex
import unittest


class Plugin:
    def on_command(self, bot, msg, stdin, stdout, reply):
        args = msg["args"][1:]
        if not args:
            args = shlex.split(stdin.read().strip())
        if args:
            print(random.choice(args), file=stdout)
        else:
            print(self.on_help(), file=stdout)

    def on_help(self):
        return "Usage: decide <a> <b> …"


class Test(unittest.TestCase):
    def setUp(self):
        self.plugin = Plugin()

    def test_decisions(self):
        decisions = []
        for i in range(1, 10):
            decisions.append("decision {0}".format(i))
            stdout = io.StringIO()
            self.plugin.on_command(None, {"args": [None] + decisions}, None, stdout, None)
            self.assertTrue(stdout.getvalue().strip() in decisions)

    def test_help(self):
        self.assertTrue(self.plugin.on_help())

    def test_no_args(self):
        stdout = io.StringIO()
        self.plugin.on_command(None, {"args": [None]}, stdout, stdout, None)
        self.assertEqual(self.plugin.on_help(), stdout.getvalue().strip())

@@ -1,14 +1,4 @@
-import io%0A
 impo
@@ -24,39 +24,212 @@
 lex%0A
-import unittest%0A%0A%0Aclass Plugin:
+%0Afrom smartbot.exceptions import *%0Afrom smartbot.formatting import *%0A%0A%0Aclass Plugin:%0A    %22%22%22%0A    Save your brain for more important things by letting SmartBot make%0A    important decisions for you.%0A    %22%22%22
 %0A   
@@ -388,16 +388,17 @@
 trip())%0A
+%0A
         
@@ -400,16 +400,20 @@
      if 
+not 
 args:%0A  
@@ -426,874 +426,257 @@
     
-print(random.choice(args), file=stdout)%0A        else:%0A            print(self.on_help(), file=stdout)%0A%0A    def on_help(self):%0A        return %22Usage: decide %3Ca%3E %3Cb%3E %E2%80%A6%22%0A%0A%0Aclass Test(unittest.TestCase):%0A    def setUp(self):%0A        self.plugin = Plugin()%0A%0A    def test_decisions(self):%0A        decisions = %5B%5D%0A        for i in range(1, 10):%0A            decisions.append(%22decision %7B0%7D%22.format(i))%0A            stdout = io.StringIO()%0A            self.plugin.on_command(None, %7B%22args%22: %5BNone%5D + decisions%7D, None, stdout, None)%0A            self.assertTrue(stdout.getvalue().strip() in decisions)%0A%0A    def test_help(self):%0A        self.assertTrue(self.plugin.on_help())%0A%0A    def test_no_args(self):%0A        stdout = io.StringIO()%0A        self.plugin.on_command(None, %7B%22args%22: %5BNone%5D%7D, stdout, stdout, None)%0A        self.assertEqual(self.plugin.on_help(), stdout.getvalue().strip()
+raise StopCommandWithHelp(self)%0A%0A        print(random.choice(args), file=stdout)%0A%0A    def on_help(self):%0A        return %22%7B%7D %7B%7D%E2%80%A6%22.format(%0A            self.bot.format(%22decide%22, Style.bold),%0A            self.bot.format(%22option%22, Style.underline)%0A        
 )%0A

Improve help for decide plugin