diff --git a/README.md b/README.md index dbbdd77..91b1e3e 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,14 @@ Install dependencies $ pip3 install Mastodon.py pytoml pickle $ pip install python-twitter pytoml requests ``` +Configure +```shell +$ cp ticketfrei.cfg.example ticketfrei.cfg +$ vim ticketfrei.cfg +``` +Edit the account credentials, so your bot can use your accounts. + +Also ## ideas diff --git a/badlist b/badlist index 164c0cd..f732a93 100644 --- a/badlist +++ b/badlist @@ -6,5 +6,4 @@ jude schwuchtel fag faggot -arbeitsplätze diff --git a/retootbot.py b/retootbot.py index 9a11e59..ca0a110 100644 --- a/retootbot.py +++ b/retootbot.py @@ -45,7 +45,7 @@ class RetootBot(object): self.config['muser']['password'] ) - def retoot(self, toots=[]): + def retoot(self, toots=()): # toot external provided messages for toot in toots: self.m.toot(toot) diff --git a/retweetbot.py b/retweetbot.py index c13dabc..6ce1b17 100644 --- a/retweetbot.py +++ b/retweetbot.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +__encoding__ = "utf-8" import twitter import requests @@ -105,6 +106,9 @@ class RetweetBot(object): try: mentions = self.api.GetMentions(since_id=self.last_mention) return mentions + except twitter.TwitterError: + print("[ERROR] Rate Limit exceeded, trying again once a minute") + sleep(60) except requests.exceptions.ConnectionError: print("[ERROR] Bad Connection.") sleep(10) @@ -118,7 +122,7 @@ class RetweetBot(object): """ while 1: try: - self.api.PostRetweet(status.id) + print self.api.PostRetweet(status.id) return self.format_mastodon(status) # Hopefully we got rid of this error. If not, try to uncomment these lines. # except twitter.error.TwitterError: @@ -181,7 +185,7 @@ if __name__ == "__main__": # create an Api object bot = RetweetBot() while True: - sleep(1) + sleep(10) bot.flow() #except: # bot.shutdown() diff --git a/ticketfrei.cfg.example b/ticketfrei.cfg.example index 094f789..0fa4f05 100644 --- a/ticketfrei.cfg.example +++ b/ticketfrei.cfg.example @@ -15,3 +15,11 @@ app_name = 'yourcity_ticketfrei' email = 'youremail@server.tld' password = 'yourpassword' server = 'yourmastodoninstance' + +[tuser] +consumer_key = "70982398n4cnc098rnnsc98nec" +consumer_secret = "09muvs098u08m9vsum098mu" +access_token_key = "u098umgfres09ug-f7n60cwhxm12" +access_token_secret = "8708mj9ßc298m343333333tex" + + diff --git a/trigger.py b/trigger.py index 78e6969..9f1f50a 100644 --- a/trigger.py +++ b/trigger.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +__encoding__ = "utf-8" class Trigger(object): @@ -21,10 +22,11 @@ class Trigger(object): :param string: A given string. Tweet or Toot, cleaned from html. :return: If the string passes the test """ + string = unicode.decode(string) for triggerword in self.goodlist: - if string.lower().find(triggerword): + if string.lower().find(triggerword) != -1: for triggerword in self.badlist: - if string.lower().find(triggerword): + if string.lower().find(triggerword) != -1: return False return True return False diff --git a/trigger.pyc b/trigger.pyc index 881b29b..3a79646 100644 Binary files a/trigger.pyc and b/trigger.pyc differ