diff --git a/last_mention b/last_mention new file mode 100644 index 0000000..35d3afd --- /dev/null +++ b/last_mention @@ -0,0 +1 @@ +876122799538147328 \ No newline at end of file diff --git a/retweetbot.py b/retweetbot.py index e78b6f3..03fc4f0 100644 --- a/retweetbot.py +++ b/retweetbot.py @@ -6,7 +6,7 @@ import trigger from time import sleep -class Retweetbot(object): +class RetweetBot(object): """ This bot retweets all tweets which 1) mention him, @@ -155,15 +155,14 @@ class Retweetbot(object): for status in mentions: # Is the Text of the Tweet in the triggerlist? - should_retweet = self.trigger.check_string(status.text) - - # Retweet status - if should_retweet: + if self.trigger.check_string(status.text): + # Retweet status mastodon.append(self.retweet(status)) # save the id so it doesn't get crawled again self.last_mention = status.id print self.last_mention + # Return Retweets for tooting on mastodon return mastodon def shutdown(self): @@ -176,7 +175,7 @@ class Retweetbot(object): if __name__ == "main": # create an Api object - bot = Retweetbot() + bot = RetweetBot() try: while True: bot.flow() diff --git a/ticketfrei.py b/ticketfrei.py index f62c6e4..cbdab0a 100644 --- a/ticketfrei.py +++ b/ticketfrei.py @@ -3,6 +3,7 @@ import time from retootbot import RetootBot from retweetbot import RetweetBot +from trigger import Trigger if __name__ == '__main__': @@ -10,8 +11,10 @@ if __name__ == '__main__': with open('ticketfrei.cfg') as configfile: config = toml.load(configfile) + trigger = Trigger() + mbot = RetootBot(config) - tbot = RetweetBot() + tbot = RetweetBot(config, trigger=trigger) try: statuses = []