removed outdated trigger functions, corrected bot init call

This commit is contained in:
b3yond 2017-06-25 18:31:16 +02:00
parent 0c64536417
commit 16c44b88ef
2 changed files with 4 additions and 13 deletions

View file

@ -22,14 +22,12 @@ class RetweetBot(object):
def __init__(self, trigger, config, def __init__(self, trigger, config,
historypath="last_mention", historypath="last_mention",
triggerpath="goodlist",
user_id="801098086005243904", user_id="801098086005243904",
screen_name="links_tech"): screen_name="links_tech"):
""" """
Initializes the bot and loads all the necessary data. Initializes the bot and loads all the necessary data.
:param historypath: Path to the file with ID of the last retweeted Tweet :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 self.config = config
keys = self.get_api_keys() keys = self.get_api_keys()
@ -38,11 +36,9 @@ class RetweetBot(object):
access_token_key=keys[2], access_token_key=keys[2],
access_token_secret=keys[3]) access_token_secret=keys[3])
self.historypath = historypath self.historypath = historypath
self.triggerpath = triggerpath
self.user_id = user_id self.user_id = user_id
self.screen_name = screen_name self.screen_name = screen_name
self.last_mention = self.get_history(self.historypath) self.last_mention = self.get_history(self.historypath)
self.triggers = self.get_trigger(self.triggerpath)
self.trigger = trigger self.trigger = trigger
def get_api_keys(self): def get_api_keys(self):
@ -81,12 +77,6 @@ class RetweetBot(object):
last_mention = "" last_mention = ""
return 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): def format_mastodon(self, status):
""" """
Bridge your Retweets to mastodon. Bridge your Retweets to mastodon.
@ -189,10 +179,11 @@ if __name__ == "__main__":
trigger = trigger.Trigger(config) trigger = trigger.Trigger(config)
bot = RetweetBot(trigger=trigger) bot = RetweetBot(trigger, config)
while True: while True:
try:
bot.flow() bot.flow()
try:
pass
except: except:
bot.shutdown() bot.shutdown()
sleep(1) sleep(1)

View file

@ -14,7 +14,7 @@ if __name__ == '__main__':
trigger = Trigger(config) trigger = Trigger(config)
mbot = RetootBot(config, trigger) mbot = RetootBot(config, trigger)
tbot = RetweetBot(trigger) tbot = RetweetBot(trigger, config)
try: try:
statuses = [] statuses = []