implemented trigger in main flow
This commit is contained in:
parent
f4759545ad
commit
9f675683b5
1
last_mention
Normal file
1
last_mention
Normal file
|
@ -0,0 +1 @@
|
|||
876122799538147328
|
|
@ -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()
|
||||
|
|
|
@ -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 = []
|
||||
|
|
Loading…
Reference in a new issue