import twython

import smartbot


class Plugin(smartbot.Plugin):
    names = ["tweetie", "twitter"]

    def __init__(self, consumer_key, consumer_secret,
                 access_token_key, access_token_secret):
        self.twitter = twython.Twython(consumer_key, consumer_secret,
                                       access_token_key, access_token_secret)

    def on_command(self, msg, stdin, stdout, reply):
        person = None
        if len(msg["args"]) >= 2:
            person = msg["args"][1]
        else:
            person = stdin.read().strip()

        if person:
            tweets = self.twitter.get_user_timeline(screen_name=person)
            for i, tweet in enumerate(tweets[:3]):
                text = tweet["text"].replace("\n", " ").replace("\r", "").strip()
                print("[{0}]: {1}".format(i, text), file=stdout)
        else:
            print(self.on_help(), file=stdout)

    def on_help(self):
        return "Usage: twitter <person>"

@@ -25,16 +25,84 @@
 martbot%0A
+from smartbot.exceptions import *%0Afrom smartbot.formatting import *%0A
 %0A%0Aclass 
@@ -635,16 +635,20 @@
      if 
+not 
 person:%0A
@@ -647,24 +647,65 @@
 person:%0A    
+        raise StopCommandWithHelp(self)%0A%0A
         twee
@@ -768,20 +768,16 @@
         
-    
 for i, t
@@ -819,20 +819,16 @@
         
-   
- 
 text = t
@@ -893,28 +893,24 @@
             
-    
 print(%22%5B%7B0%7D%5D
@@ -950,86 +950,91 @@
 ut)%0A
-   
+%0A
     
- else:%0A            print(self.on_help(), file=stdout)%0A%0A    def 
+def on_help(self):%0A        return %22%7B%7D %7B%7D%22.format(%0A            super().
 on_help(
 self
@@ -1021,38 +1021,34 @@
 super().on_help(
-self):
+),
 %0A        return 
@@ -1044,37 +1044,61 @@
     
-return %22Usage: twitter %3Cperson%3E%22
+    self.bot.format(%22person%22, Style.underline)%0A        )
 %0A

Improve twitter help