diff --git a/bottools/methods.py b/bottools/methods.py index bd9cc7a..e641ddc 100644 --- a/bottools/methods.py +++ b/bottools/methods.py @@ -345,7 +345,14 @@ def search(bot, update, args): try: two = bottools.methods.getTwo(update.message) + lt = [] + for tweet in two.api.search(q=query, rpp=count, result_type="recent")[:count]: + lt += [tweet] + + lt.reverse() + + for tweet in lt: tweetMessage(tweet, update.message.chat_id, bot) except tweepy.error.TweepError as e: @@ -360,7 +367,14 @@ def user(bot, update, args): try: two = bottools.methods.getTwo(update.message) + lt = [] + for status in two.api.user_timeline(args[0], count = count): + lt += [status] + + lt.reverse() + + for status in lt: tweetMessage(status, update.message.chat_id, bot) except tweepy.error.TweepError as e: @@ -386,8 +400,14 @@ def timeline(bot, update, args = [10]): try: two = bottools.methods.getTwo(update.message) + lt = [] for status in two.api.home_timeline(count=count): + lt += [status] + + lt.reverse() + + for status in lt: tweetMessage(status, update.message.chat_id, bot) except tweepy.error.TweepError as e: @@ -400,7 +420,7 @@ mentionstreams = {} def makeStream(bot, cid): two = twitools.twoBotHelper(cid) stream = tweepy.Stream(auth = two.auth, listener = twitools.streaming.BotStreamListener(bot, cid)) - stream.filter(track=[two.whoami()], async=True) + stream.filter(track=["@%s" % two.whoami().strip("@")], async=True) return stream try: