forked from ticketfrei/ticketfrei
small fixes, 280 limit, wait 60 seconds
This commit is contained in:
parent
c8e9d7fd7a
commit
1cab8dffb6
1
local
Submodule
1
local
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit c8e9d7fd7ae0fe04921fdcf85e11fc9c0c324958
|
|
@ -82,7 +82,6 @@ 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):
|
||||
|
@ -91,8 +90,8 @@ class RetootBot(object):
|
|||
notification['status']['content'])
|
||||
if not self.filter.is_ok(text_content):
|
||||
continue
|
||||
self.log('Boosting toot %d from %s: %s' % (
|
||||
notification['status']['id'],
|
||||
self.log('Boosting toot from %s: %s' % (
|
||||
#notification['status']['id'],
|
||||
notification['status']['account']['acct'],
|
||||
notification['status']['content']))
|
||||
self.m.status_reblog(notification['status']['id'])
|
||||
|
@ -100,10 +99,6 @@ class RetootBot(object):
|
|||
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:
|
||||
|
|
|
@ -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
|
||||
|
|
BIN
share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/appdirs-1.4.0-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/appdirs-1.4.0-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/chardet-2.3.0-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/chardet-2.3.0-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/colorama-0.3.7-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/colorama-0.3.7-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/distlib-0.2.4-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/distlib-0.2.4-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/distro-1.0.1-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/distro-1.0.1-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/html5lib-0.999999999-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/html5lib-0.999999999-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/ipaddress-0.0.0-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/ipaddress-0.0.0-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/lockfile-0.12.2-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/lockfile-0.12.2-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/packaging-16.8-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/packaging-16.8-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/pip-9.0.1-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/pip-9.0.1-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/progress-1.2-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/progress-1.2-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/pyparsing-2.1.10-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/pyparsing-2.1.10-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/requests-2.12.4-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/requests-2.12.4-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/setuptools-32.3.1-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/setuptools-32.3.1-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/six-1.10.0-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/six-1.10.0-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/webencodings-0.5-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/webencodings-0.5-py2.py3-none-any.whl
Normal file
Binary file not shown.
BIN
share/python-wheels/wheel-0.29.0-py2.py3-none-any.whl
Normal file
BIN
share/python-wheels/wheel-0.29.0-py2.py3-none-any.whl
Normal file
Binary file not shown.
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue