add repall command
authorOrakaro <nhatminh_179@hotmail.com>
Tue, 11 Nov 2014 14:21:56 +0000 (23:21 +0900)
committerOrakaro <nhatminh_179@hotmail.com>
Tue, 11 Nov 2014 14:21:56 +0000 (23:21 +0900)
.DS_Store [new file with mode: 0644]
docs/conf.py
docs/index.rst
rainbowstream/rainbow.py
setup.py

diff --git a/.DS_Store b/.DS_Store
new file mode 100644 (file)
index 0000000..d97965c
Binary files /dev/null and b/.DS_Store differ
index 303e3f472ce6dca729aa188df5f352513594cd92..e2bf8126fb65a2b437185c026bbc0f9b52cf2300 100644 (file)
@@ -48,9 +48,9 @@ copyright = u'2014, Vu Nhat Minh'
 # built documents.
 #
 # The short X.Y version.
 # built documents.
 #
 # The short X.Y version.
-version = '1.2.2'
+version = '1.2.3'
 # The full version, including alpha/beta/rc tags.
 # The full version, including alpha/beta/rc tags.
-release = '1.2.2'
+release = '1.2.3'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
index 5ba27014a8e8829ac9fcb74658d58108b243ae1a..5152f4fd22065d7b220873b58494c60b47f59f73 100644 (file)
@@ -154,7 +154,9 @@ Here is full list of supported command:
 \r
 -  ``conversation 12`` will show the chain of replies prior to the tweet with *[id=12]*.\r
 \r
 \r
 -  ``conversation 12`` will show the chain of replies prior to the tweet with *[id=12]*.\r
 \r
--  ``rep 12 Really`` will reply *‘Really’* to the tweet with *[id=12]*.\r
+-  ``rep 12 Really`` will reply *‘Really’* to the owner of the tweet with *[id=12]*.\r
+\r
+-  ``repall 12 Really`` will reply *‘Really’* to all people in the tweet with *[id=12]*.\r
 \r
 -  ``fav 12`` will favorite the tweet with *[id=12]*.\r
 \r
 \r
 -  ``fav 12`` will favorite the tweet with *[id=12]*.\r
 \r
index b859bab832bbe13276a794c321470b416957756d..a5824a6382650984abeb11fc8baf0ed269b8bba3 100644 (file)
@@ -501,6 +501,27 @@ def reply():
     t.statuses.update(status=status, in_reply_to_status_id=tid)
 
 
     t.statuses.update(status=status, in_reply_to_status_id=tid)
 
 
+def reply_all():
+    """
+    Reply to all
+    """
+    t = Twitter(auth=authen())
+    try:
+        id = int(g['stuff'].split()[0])
+    except:
+        printNicely(red('Sorry I can\'t understand.'))
+        return
+    tid = c['tweet_dict'][id]
+    original_tweet = t.statuses.show(id=tid)
+    text = original_tweet['text']
+    owner = '@' + original_tweet['user']['screen_name']
+    nick_ary = ['@' + re.sub('[\W_]', '', w)
+                for w in text.split() if w.startswith('@')] + [owner]
+    status = ' '.join(g['stuff'].split()[1:])
+    status = ' '.join(nick_ary) + ' ' + str2u(status)
+    t.statuses.update(status=status, in_reply_to_status_id=tid)
+
+
 def favorite():
     """
     Favorite
 def favorite():
     """
     Favorite
@@ -1483,7 +1504,10 @@ def help_tweets():
     usage += s * 2 + light_green('conversation 12') + ' will show the chain of ' + \
         'replies prior to the tweet with ' + light_yellow('[id=12]') + '.\n'
     usage += s * 2 + light_green('rep 12 oops') + ' will reply "' + \
     usage += s * 2 + light_green('conversation 12') + ' will show the chain of ' + \
         'replies prior to the tweet with ' + light_yellow('[id=12]') + '.\n'
     usage += s * 2 + light_green('rep 12 oops') + ' will reply "' + \
-        light_yellow('oops') + '" to tweet with ' + \
+        light_yellow('oops') + '" to the owner of the tweet with ' + \
+        light_yellow('[id=12]') + '.\n'
+    usage += s * 2 + light_green('repall 12 oops') + ' will reply "' + \
+        light_yellow('oops') + '" to all people in the tweet with ' + \
         light_yellow('[id=12]') + '.\n'
     usage += s * 2 + \
         light_green('fav 12 ') + ' will favorite the tweet with ' + \
         light_yellow('[id=12]') + '.\n'
     usage += s * 2 + \
         light_green('fav 12 ') + ' will favorite the tweet with ' + \
@@ -1771,6 +1795,7 @@ cmdset = [
     'conversation',
     'fav',
     'rep',
     'conversation',
     'fav',
     'rep',
+    'repall',
     'del',
     'ufav',
     'share',
     'del',
     'ufav',
     'share',
@@ -1818,6 +1843,7 @@ funcset = [
     conversation,
     favorite,
     reply,
     conversation,
     favorite,
     reply,
+    reply_all,
     delete,
     unfavorite,
     share,
     delete,
     unfavorite,
     share,
@@ -1878,6 +1904,7 @@ def listen():
             [],  # conversation
             [],  # favorite
             [],  # reply
             [],  # conversation
             [],  # favorite
             [],  # reply
+            [],  # reply_all
             [],  # delete
             [],  # unfavorite
             [],  # url
             [],  # delete
             [],  # unfavorite
             [],  # url
@@ -2089,6 +2116,11 @@ def stream(domain, args, name='Rainbow Stream'):
         detail_twitter_error(e)
         sys.stdout.write(g['decorated_name'](g['PREFIX']))
         sys.stdout.flush()
         detail_twitter_error(e)
         sys.stdout.write(g['decorated_name'](g['PREFIX']))
         sys.stdout.flush()
+    except (URLError, ConnectionResetError):
+        printNicely(
+            magenta('There seems to be a connection problem.'))
+        save_history()
+        sys.exit()
 
 
 def fly():
 
 
 def fly():
index f58a8165a74c190fd0494cd794d52492d83d261b..fc7a1afc58ea426ca0b23b6d7fc1df75e4931531 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@ import os
 import os.path
 
 # Bumped version
 import os.path
 
 # Bumped version
-version = '1.2.2'
+version = '1.2.3'
 
 # Require
 install_requires = [
 
 # Require
 install_requires = [