From 16c44b88efb2bee0c1118269d394e7060d8add8c Mon Sep 17 00:00:00 2001 From: b3yond Date: Sun, 25 Jun 2017 18:31:16 +0200 Subject: [PATCH] removed outdated trigger functions, corrected bot init call --- retweetbot.py | 15 +++------------ ticketfrei.py | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/retweetbot.py b/retweetbot.py index 17b3f1a..eaed4db 100644 --- a/retweetbot.py +++ b/retweetbot.py @@ -22,14 +22,12 @@ class RetweetBot(object): def __init__(self, trigger, config, historypath="last_mention", - triggerpath="goodlist", user_id="801098086005243904", screen_name="links_tech"): """ Initializes the bot and loads all the necessary data. :param historypath: Path to the file with ID of the last retweeted Tweet - :param triggerpath: Path to the file of the triggerwords """ self.config = config keys = self.get_api_keys() @@ -38,11 +36,9 @@ class RetweetBot(object): access_token_key=keys[2], access_token_secret=keys[3]) self.historypath = historypath - self.triggerpath = triggerpath self.user_id = user_id self.screen_name = screen_name self.last_mention = self.get_history(self.historypath) - self.triggers = self.get_trigger(self.triggerpath) self.trigger = trigger def get_api_keys(self): @@ -81,12 +77,6 @@ class RetweetBot(object): last_mention = "" return last_mention - def get_trigger(self, path): - """ Words which have to be included into the tweets for the tweet to get retweeted """ - with open(path, "r") as f: - triggers = [s.strip() for s in f.readlines()] - return triggers - def format_mastodon(self, status): """ Bridge your Retweets to mastodon. @@ -189,10 +179,11 @@ if __name__ == "__main__": trigger = trigger.Trigger(config) - bot = RetweetBot(trigger=trigger) + bot = RetweetBot(trigger, config) while True: + bot.flow() try: - bot.flow() + pass except: bot.shutdown() sleep(1) diff --git a/ticketfrei.py b/ticketfrei.py index b0d7a8f..452eec4 100644 --- a/ticketfrei.py +++ b/ticketfrei.py @@ -14,7 +14,7 @@ if __name__ == '__main__': trigger = Trigger(config) mbot = RetootBot(config, trigger) - tbot = RetweetBot(trigger) + tbot = RetweetBot(trigger, config) try: statuses = []