diff --git a/local b/local new file mode 160000 index 0000000..c8e9d7f --- /dev/null +++ b/local @@ -0,0 +1 @@ +Subproject commit c8e9d7fd7ae0fe04921fdcf85e11fc9c0c324958 diff --git a/retootbot.py b/retootbot.py index 69cee89..c4a9917 100644 --- a/retootbot.py +++ b/retootbot.py @@ -82,28 +82,23 @@ class RetootBot(object): # boost mentions retoots = [] - try: - for notification in self.m.notifications(): - if (notification['type'] == 'mention' - and notification['status']['id'] not in self.seen_toots): - self.seen_toots.add(notification['status']['id']) - text_content = re.sub(r'<[^>]*>', '', - notification['status']['content']) - if not self.filter.is_ok(text_content): - continue - self.log('Boosting toot %d from %s: %s' % ( - notification['status']['id'], - notification['status']['account']['acct'], - notification['status']['content'])) - self.m.status_reblog(notification['status']['id']) - retoots.append('%s: %s' % ( - notification['status']['account']['acct'], - re.sub(r'@\S*', '', text_content))) + for notification in self.m.notifications(): + if (notification['type'] == 'mention' + and notification['status']['id'] not in self.seen_toots): + self.seen_toots.add(notification['status']['id']) + text_content = re.sub(r'<[^>]*>', '', + notification['status']['content']) + if not self.filter.is_ok(text_content): + continue + self.log('Boosting toot from %s: %s' % ( + #notification['status']['id'], + notification['status']['account']['acct'], + notification['status']['content'])) + self.m.status_reblog(notification['status']['id']) + retoots.append('%s: %s' % ( + notification['status']['account']['acct'], + re.sub(r'@\S*', '', text_content))) # If the Mastodon instance returns interesting Errors, add them here: - except mastodon.MastodonAPIError: - self.log("There was a Mastodon API Error, probably the API is not available.") - except mastodon.MastodonNetworkError: - self.log("There was a Mastodon Network Error, could not reach the server.") # save state with os.fdopen(os.open('seen_toots.pickle.part', os.O_WRONLY | os.O_EXCL | os.O_CREAT), 'w') as f: diff --git a/retweetbot.py b/retweetbot.py index bc74066..9f9824e 100644 --- a/retweetbot.py +++ b/retweetbot.py @@ -154,7 +154,7 @@ class RetweetBot(object): return mentions except twitter.TwitterError: self.log("Twitter API Error: Rate Limit Exceeded.") - self.waitcounter += 60*15 + self.waitcounter += 60*15 + 1 except requests.exceptions.ConnectionError: self.log("Twitter API Error: Bad Connection.") self.waitcounter += 10 @@ -191,8 +191,8 @@ class RetweetBot(object): :param post: String with the text to tweet. """ - if len(post) > 140: - post = post[:140 - 4] + u' ...' + if len(post) > 280: + post = post[:280 - 4] + u' ...' while 1: try: self.api.PostUpdate(status=post) @@ -261,7 +261,9 @@ if __name__ == "__main__": try: while True: bot.flow() - sleep(10) + sleep(60) + except KeyboardInterrupt: + print "Good bye! Remember to restart the bot." except: traceback.print_exc() print diff --git a/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl b/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl new file mode 100644 index 0000000..fd27a40 Binary files /dev/null and b/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl differ diff --git a/share/python-wheels/appdirs-1.4.0-py2.py3-none-any.whl b/share/python-wheels/appdirs-1.4.0-py2.py3-none-any.whl new file mode 100644 index 0000000..03b2449 Binary files /dev/null and b/share/python-wheels/appdirs-1.4.0-py2.py3-none-any.whl differ diff --git a/share/python-wheels/chardet-2.3.0-py2.py3-none-any.whl b/share/python-wheels/chardet-2.3.0-py2.py3-none-any.whl new file mode 100644 index 0000000..68846ad Binary files /dev/null and b/share/python-wheels/chardet-2.3.0-py2.py3-none-any.whl differ diff --git a/share/python-wheels/colorama-0.3.7-py2.py3-none-any.whl b/share/python-wheels/colorama-0.3.7-py2.py3-none-any.whl new file mode 100644 index 0000000..cc8fa18 Binary files /dev/null and b/share/python-wheels/colorama-0.3.7-py2.py3-none-any.whl differ diff --git a/share/python-wheels/distlib-0.2.4-py2.py3-none-any.whl b/share/python-wheels/distlib-0.2.4-py2.py3-none-any.whl new file mode 100644 index 0000000..78e8ecd Binary files /dev/null and b/share/python-wheels/distlib-0.2.4-py2.py3-none-any.whl differ diff --git a/share/python-wheels/distro-1.0.1-py2.py3-none-any.whl b/share/python-wheels/distro-1.0.1-py2.py3-none-any.whl new file mode 100644 index 0000000..6e78917 Binary files /dev/null and b/share/python-wheels/distro-1.0.1-py2.py3-none-any.whl differ diff --git a/share/python-wheels/html5lib-0.999999999-py2.py3-none-any.whl b/share/python-wheels/html5lib-0.999999999-py2.py3-none-any.whl new file mode 100644 index 0000000..51141ae Binary files /dev/null and b/share/python-wheels/html5lib-0.999999999-py2.py3-none-any.whl differ diff --git a/share/python-wheels/ipaddress-0.0.0-py2.py3-none-any.whl b/share/python-wheels/ipaddress-0.0.0-py2.py3-none-any.whl new file mode 100644 index 0000000..263627c Binary files /dev/null and b/share/python-wheels/ipaddress-0.0.0-py2.py3-none-any.whl differ diff --git a/share/python-wheels/lockfile-0.12.2-py2.py3-none-any.whl b/share/python-wheels/lockfile-0.12.2-py2.py3-none-any.whl new file mode 100644 index 0000000..7b97b3f Binary files /dev/null and b/share/python-wheels/lockfile-0.12.2-py2.py3-none-any.whl differ diff --git a/share/python-wheels/packaging-16.8-py2.py3-none-any.whl b/share/python-wheels/packaging-16.8-py2.py3-none-any.whl new file mode 100644 index 0000000..472e010 Binary files /dev/null and b/share/python-wheels/packaging-16.8-py2.py3-none-any.whl differ diff --git a/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl b/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl new file mode 100644 index 0000000..2fe12a0 Binary files /dev/null and b/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl differ diff --git a/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl b/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl new file mode 100644 index 0000000..9e60760 Binary files /dev/null and b/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl differ diff --git a/share/python-wheels/progress-1.2-py2.py3-none-any.whl b/share/python-wheels/progress-1.2-py2.py3-none-any.whl new file mode 100644 index 0000000..c729a89 Binary files /dev/null and b/share/python-wheels/progress-1.2-py2.py3-none-any.whl differ diff --git a/share/python-wheels/pyparsing-2.1.10-py2.py3-none-any.whl b/share/python-wheels/pyparsing-2.1.10-py2.py3-none-any.whl new file mode 100644 index 0000000..2e9098a Binary files /dev/null and b/share/python-wheels/pyparsing-2.1.10-py2.py3-none-any.whl differ diff --git a/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl b/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl new file mode 100644 index 0000000..63c942c Binary files /dev/null and b/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl differ diff --git a/share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl b/share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl new file mode 100644 index 0000000..f6a26bd Binary files /dev/null and b/share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl differ diff --git a/share/python-wheels/setuptools-32.3.1-py2.py3-none-any.whl b/share/python-wheels/setuptools-32.3.1-py2.py3-none-any.whl new file mode 100644 index 0000000..97c2f15 Binary files /dev/null and b/share/python-wheels/setuptools-32.3.1-py2.py3-none-any.whl differ diff --git a/share/python-wheels/six-1.10.0-py2.py3-none-any.whl b/share/python-wheels/six-1.10.0-py2.py3-none-any.whl new file mode 100644 index 0000000..d4c72e2 Binary files /dev/null and b/share/python-wheels/six-1.10.0-py2.py3-none-any.whl differ diff --git a/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl b/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl new file mode 100644 index 0000000..8b90675 Binary files /dev/null and b/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl differ diff --git a/share/python-wheels/webencodings-0.5-py2.py3-none-any.whl b/share/python-wheels/webencodings-0.5-py2.py3-none-any.whl new file mode 100644 index 0000000..bcd1264 Binary files /dev/null and b/share/python-wheels/webencodings-0.5-py2.py3-none-any.whl differ diff --git a/share/python-wheels/wheel-0.29.0-py2.py3-none-any.whl b/share/python-wheels/wheel-0.29.0-py2.py3-none-any.whl new file mode 100644 index 0000000..db5d261 Binary files /dev/null and b/share/python-wheels/wheel-0.29.0-py2.py3-none-any.whl differ diff --git a/ticketfrei.py b/ticketfrei.py index 266ef33..17461b6 100644 --- a/ticketfrei.py +++ b/ticketfrei.py @@ -28,7 +28,9 @@ if __name__ == '__main__': while True: statuses = mbot.retoot(statuses) statuses = tbot.flow(statuses) - time.sleep(10) + time.sleep(60) + except KeyboardInterrupt: + print "Good bye. Remember to restart the bot!" except: traceback.print_exc() tbot.shutdown()