Beispiel #1
0
# at a certain user. You don't want to keep replying in the same conversation,
# because that would be very annoying. Be responsible, and allow your bot only
# a shallow conversation depth. For example, a value of 2 will allow the bot
# to only reply in conversations where there are two or less replies to the
# original tweet.
maxconvdepth = None

# Start auto-responding to tweets by calling twitter_autoreply_start
# This function operates in a Thread in the background, so your code will not
# block by calling it.
tweetbot.twitter_autoreply_start(targetstring, keywords=keywords, prefix=prefix, suffix=suffix, maxconvdepth=maxconvdepth)
 
# Start periodically tweeting. This will post a tweet every X days, hours, and
# minutes. (You're free to choose your own interval, but please don't use it to
# spam other people. Nobody likes spammers and trolls.)
# This function operates in a Thread in the background, so your code will not
# block by calling it.
tweetbot.twitter_tweeting_start(days=0, hours=19, minutes=30, keywords=None, prefix=None, suffix='#BleepBloop')

# DO SOMETHING HERE TO ALLOW YOUR BOT TO BE ACTIVE IN THE BACKGROUND
# You could, for example, wait for a week:
secsinweek = 7 * 24 * 60 * 60
time.sleep(secsinweek)
 
# Use the following to stop auto-responding
# (Don't do this directly after starting it, or your bot will do nothing!)
tweetbot.twitter_autoreply_stop()

# Use the following to stop periodically tweeting
# (Don't do this directly after starting it, or your bot will do nothing!)
tweetbot.twitter_tweeting_stop()
# This function operates in a Thread in the background, so your code will not
# block by calling it.
tweetbot.twitter_autoreply_start(targetstring,
                                 keywords=keywords,
                                 prefix=prefix,
                                 suffix=suffix,
                                 maxconvdepth=maxconvdepth)

# Start periodically tweeting. This will post a tweet every X days, hours, and
# minutes. (You're free to choose your own interval, but please don't use it to
# spam other people. Nobody likes spammers and trolls.)
# This function operates in a Thread in the background, so your code will not
# block by calling it.
tweetbot.twitter_tweeting_start(days=0,
                                hours=19,
                                minutes=30,
                                keywords=None,
                                prefix=None,
                                suffix='#BleepBloop')

# DO SOMETHING HERE TO ALLOW YOUR BOT TO BE ACTIVE IN THE BACKGROUND
# You could, for example, wait for a week:
secsinweek = 7 * 24 * 60 * 60
'time'.sleep(secsinweek)

# Use the following to stop auto-responding
# (Don't do this directly after starting it, or your bot will do nothing!)
tweetbot.twitter_autoreply_stop()

# Use the following to stop periodically tweeting
# (Don't do this directly after starting it, or your bot will do nothing!)
tweetbot.twitter_tweeting_stop()
Beispiel #3
0
# ALL YOUR SECRET STUFF!
# Consumer Key (API Key)
cons_key = 'AqYyIzu5jXXYhubZI83WtfmnV'
# Consumer Secret (API Secret)
cons_secret = 'QyqofLZtVJSjgS4L7EltzaxPJrcz23vgyN8zMNZ4dm88HdM1c6'
# Access Token
access_token = '751058612051648514-FGw6PEjNmkIdbWqrC3MfhVYEe8KJyCF'
# Access Token Secret
access_token_secret = 'PFKpoM7ra8rziOc0gs9ci4pT2TGRvn0fRXw5gw8PzYFnp'

# Log in to Twitter
tweetbot.twitter_login(cons_key, cons_secret, access_token, access_token_secret)

# Start periodically tweeting
tweetbot.twitter_tweeting_start(days=0, hours=0, minutes=1, keywords=None, prefix=None, suffix='#PyGaze')

# Use the following to stop periodically tweeting
# (Don't do this directly after starting it, or your bot will do nothing!)
#tweetbot.twitter_tweeting_stop()

# Set some parameters for your bot
targetstring = 'MarryMeSherlock'
keywords = ['marriage', 'ring', 'flowers', 'children', 'religion']
prefix = None
suffix = '#SherlockSaysIDo'
maxconvdepth = None


# Start auto-responding to tweets
# tweetbot.twitter_autoreply_start(targetstring, keywords=keywords, prefix=prefix, suffix=suffix, maxconvdepth=maxconvdepth)
Beispiel #4
0
# Start auto-responding to tweets
tweetbot.twitter_autoreply_start(targetstring,
                                 keywords=None,
                                 prefix=prefix,
                                 suffix=suffix,
                                 maxconvdepth=maxconvdepth)

# Use the following to stop auto-responding
# (Don't do this directly after starting it, or your bot will do nothing!)
# tweetbot.twitter_autoreply_stop()

# Start periodically tweeting
tweetbot.twitter_tweeting_start(days=0,
                                hours=0,
                                minutes=5,
                                keywords=None,
                                prefix=None,
                                suffix=suffix)

# Use the following to stop periodically tweeting
# (Don't do this directly after starting it, or your bot will do nothing!)
# tweetbot.twitter_tweeting_stop()

# DO SOMETHING HERE TO ALLOW YOUR BOT TO BE ACTIVE IN THE BACKGROUND
# You could, for example, wait for a week:
secsinday = 24 * 60 * 60
time.sleep(secsinday)

# Use the following to stop auto-responding
# (Don't do this directly after starting it, or your bot will do nothing!)
tweetbot.twitter_autoreply_stop()
Beispiel #5
0
kanyebot.read(tweets)

kanyebot.twitter_login(consumer_key, consumer_secret, access_key,
                       access_secret)

# Set some parameters for your bot
targetstring = 'KanyeToTheBot'
keywords = ['kim', 'pablo', 'wavy', 'bill', 'cosby']
prefix = None
suffix = '#KanyeToTheBot'
maxconvdepth = None

# Start periodically tweeting
kanyebot.twitter_tweeting_start(days=0,
                                hours=0,
                                minutes=15,
                                keywords=None,
                                prefix=None,
                                suffix='#KanyeToTheBot')

s = sched.scheduler(time.time, time.sleep)


def do_something(sc):
    # do your stuff
    s.enter(3600, 1, get_all_tweets("kanyewest"), (sc, ))
    print("gathering more tweets...")


s.enter(3600, 1, do_something, (s, ))
s.run()
Beispiel #6
0
'''
Keys/Tokens: 
'''

cons_key = 'TRXh3CDSFBnPuZziANbqssl1l'
cons_secret = 'sIfuEEp6T8qluDkU3S9PLcINoIIqcp0SUTrnwVfvdWhNRlIS6G'
access_token = '863265431691436032-PH9ASi1r3tfXJY90i4HuCVVpcLhUJ6D'
access_token_secret = 'POslJ4RgWsgL7BzUV1WY7xZaI9YXGMmSIFPwA2vcZt1Uf'

# Login, tweet-period

bot.twitter_login(cons_key, cons_secret, access_token, access_token_secret)
bot.twitter_tweeting_start(days=0,
                           hours=5,
                           minutes=0,
                           keywords=None,
                           prefix=None,
                           suffix="#Freud")
bot2.twitter_login(cons_key, cons_secret, access_token, access_token_secret)
bot2.twitter_tweeting_start(days=0,
                            hours=5,
                            minutes=0,
                            keywords=None,
                            prefix=None,
                            suffix="#Shakespeare")
bot3.twitter_login(cons_key, cons_secret, access_token, access_token_secret)
bot3.twitter_tweeting_start(days=0,
                            hours=5,
                            minutes=0,
                            keywords=None,
                            prefix=None,
Beispiel #7
0
# Initialise a MarkovBot instance
tweetbot = MarkovBot()

# Get the current directory's path
dirname = os.path.dirname(os.path.abspath(__file__))
# Construct the path to the book
book = os.path.join(dirname, 'ElonMuskTxt.txt')
# Make your bot read the book!
tweetbot.read(book)

my_first_text = tweetbot.generate_text(25, seedword=['space', 'Tesla'])
print("tweetbot says:")
print(my_first_text)

tweetbot.twitter_login(cons_key, cons_secret, access_token,
                       access_token_secret)

from time import sleep
while True:
    tweetbot.twitter_tweeting_start(days=0,
                                    hours=0,
                                    minutes=30,
                                    keywords=[
                                        'SpaceX', 'Tesla', 'Mars', 'Solar',
                                        'Do more', '120 hour work week',
                                        'I am not an alien', 'launch'
                                    ],
                                    prefix=None,
                                    suffix="#ElonMusk")
    sleep(30)
# This function operates in a Thread in the background, so your code will not
# block by calling it.
tweetbot.twitter_autoreply_start(targetstring,
                                 keywords=keywords,
                                 prefix=prefix,
                                 suffix=suffix,
                                 maxconvdepth=maxconvdepth)

# Start periodically tweeting. This will post a tweet every X days, hours, and
# minutes. (You're free to choose your own interval, but please don't use it to
# spam other people. Nobody likes spammers and trolls.)
# This function operates in a Thread in the background, so your code will not
# block by calling it.
tweetbot.twitter_tweeting_start(days=0,
                                hours=3,
                                minutes=30,
                                keywords=None,
                                prefix=None,
                                suffix='#OneStarBot')

# DO SOMETHING HERE TO ALLOW YOUR BOT TO BE ACTIVE IN THE BACKGROUND
# You could, for example, wait for a week:
secsinweek = 7 * 24 * 60 * 60
time.sleep(secsinweek)

# Use the following to stop auto-responding
# (Don't do this directly after starting it, or your bot will do nothing!)
tweetbot.twitter_autoreply_stop()

# Use the following to stop periodically tweeting
# (Don't do this directly after starting it, or your bot will do nothing!)
tweetbot.twitter_tweeting_stop()
Beispiel #9
0
# Initialise the MarkovBot instance
tweetbot = MarkovBot()

# Get the seinfeld transcripts and read
dirname = os.path.dirname(os.path.abspath(__file__))
textFile = os.path.join(dirname, 'seinfelf.txt')
tweetbot.read(textFile)

# Text Generations

# Log in to Twitter
consumer_key = os.environ.get('cons_key')
consumer_key_secret = os.environ.get('cons_secret')
access_token = os.environ.get('access_token')
access_token_secret = os.environ.get('access_token_secret')
tweetbot.twitter_login(consumer_key, consumer_key_secret, access_token,
                       access_token_secret)

# Start periodically tweeting
while True:
    minutesToWait = 120
    secondsToWait = 60 * minutesToWait
    tweetbot.twitter_tweeting_start(days=0,
                                    hours=0,
                                    minutes=minutesToWait,
                                    keywords=None,
                                    prefix=None,
                                    suffix=None)
    time.sleep(secondsToWait)  # tweet every half hour
Beispiel #10
0
# Set some parameters for your bot
targetstring = '#GameofThrones'
keywords = ['GOT', 'thrones', 'war', 'winter', 'john snow', 'Bran']
prefix = None
suffix = '#GameofThronesfever'
maxconvdepth = None

tweetbot.twitter_autoreply_start(targetstring,
                                 keywords=keywords,
                                 prefix=prefix,
                                 suffix=suffix,
                                 maxconvdepth=maxconvdepth)
# Start periodically tweeting
tweetbot.twitter_tweeting_start(days=0,
                                hours=1,
                                minutes=0,
                                keywords=None,
                                prefix=None,
                                suffix='#GameofThronesfever')

# Use the following to stop periodically tweeting
# (Don't do this directly after starting it, or your bot will do nothing!)
# tweetbot.twitter_tweeting_stop()
secsinweek = 7 * 24 * 60 * 60
time.sleep(secsinweek)

# Use the following to stop auto-responding
# (Don't do this directly after starting it, or your bot will do nothing!)
tweetbot.twitter_autoreply_stop()

# Use the following to stop periodically tweeting
# (Don't do this directly after starting it, or your bot will do nothing!)
# # # # #
# TWUTT

# The MarkovBot uses @sixohsix' Python Twitter Tools, which is a Python wrapper
# for the Twitter API. Find it on GitHub: https://github.com/sixohsix/twitter
cons_key = os.environ['MY_CONSUMER_KEY']
cons_secret = os.environ['MY_CONSUMER_SECRET']
access_token = os.environ['MY_ACCESS_TOKEN_KEY']
access_token_secret = os.environ['MY_ACCESS_TOKEN_SECRET']

# Log in to Twitter
tweetbot.twitter_login(cons_key, cons_secret, access_token, access_token_secret)

# The target string is what the bot will reply to on Twitter. To learn more,
# read: https://dev.twitter.com/streaming/overview/request-parameters#track
targetstring = 'HeyTurnbot'
keywords = ['disruption', 'agility', 'innovation', 'jobs', 'growth']
prefix = None
suffix = '#ausvotes #TurnbotSpeaks'
maxconvdepth = 5 

tweetbot.twitter_autoreply_start(targetstring, keywords=keywords, prefix=prefix, suffix=suffix, maxconvdepth=maxconvdepth)
tweetbot.twitter_tweeting_start(days=0, hours=1, minutes=0, keywords=None, prefix=None, suffix='#auspol')

# Now we wait while the threads do their job
secsinyear = 1 * 365 * 24 * 60 * 60
time.sleep(secsinyear)
 
#tweetbot.twitter_autoreply_stop()
#tweetbot.twitter_tweeting_stop()
# Consumer Key (API Key)
cons_key = '1rVz2u5o37F6ycuQiXqYpmvz7'
# Consumer Secret (API Secret)
cons_secret = 'r1z2vJLwUExkWDm0vgVKgUYLT5cB5jRcUQDxizbBp6jIYGv4Op'
# Access Token
access_token = '772074137258954752-g9yoZSIRVmhA9EQmyAfDAx5Hfef1G7w'
# Access Token Secret
access_token_secret = 'sqkQRyOWKSXXSxZHqVWwKZZoJpXHnLar7nlT2z1O1ot8Z'

# Log in to Twitter
tweetbot.twitter_login(cons_key, cons_secret, access_token, access_token_secret)

targetstring = 'professorpolitica'

keywords = ['política', 'educação', 'saúde', 'pobreza', 'eleições']

prefix = None
suffix = None
maxconvdepth = None

tweetbot.twitter_autoreply_start(targetstring, keywords=keywords, prefix=prefix, suffix=suffix, maxconvdepth=maxconvdepth)
tweetbot.twitter_tweeting_start(days=0, hours=0, minutes=1, keywords=None, prefix=None, suffix='#hackathonSprinklr #politica #imparcialidade')

secsinweek = 7 * 24 * 60 * 60
time.sleep(secsinweek)

tweetbot.twitter_autoreply_stop()

tweetbot.twitter_tweeting_stop()
Beispiel #13
0
#log in to twitter
tweetbot.twitter_login(cons_key, cons_secret, access_token,
                       access_token_secret)
#set parameters for auto-replies
targetstring = "capitalism"
keywords = ['cultural', 'economics', 'proletariat', 'bourgeoisie']
prefix = None
suffix = None
maxconvdepth = 1
#start auto-replies
tweetbot.twitter_autoreply_start(targetstring,
                                 keywords=keywords,
                                 prefix=prefix,
                                 suffix=suffix,
                                 maxconvdepth=maxconvdepth)

# Start periodically tweeting
tweetbot.twitter_tweeting_start(days=0,
                                hours=0,
                                minutes=30,
                                keywords=None,
                                prefix=None,
                                suffix='#communism')
# something has to happen here to let my bot be active
# You could, for example, wait for a week:
secsinweek = 7 * 24 * 60 * 60
time.sleep(secsinweek)

tweetbot.twitter_autoreply_stop()
tweetbot.twitter_tweeting_stop()
Beispiel #14
0
# ALL YOUR SECRET STUFF!
# Consumer Key (API Key)
cons_key = 'K9YqNYb8j6HA0hgBKLZ1aQ918'
# Consumer Secret (API Secret)
cons_secret = 'BFCDji7mF7sfw2PpdQMEcZ90Poht5E6OMff1XEHb3UeLB8K1Fz'
# Access Token
access_token = '988043632828715008-U4kAofzutxFuPx6c3jCwnrRztm3y5lt'
# Access Token Secret
access_token_secret = 'zNxtfZQb9HU3nRN88uJzJ39H2Ttfk7Vno0Qc3WobX0U5J'

# Log in to Twitter
tweetbot.twitter_login(cons_key, cons_secret, access_token,
                       access_token_secret)

# Start periodically tweeting
tweetbot.twitter_tweeting_start(
    days=0,
    hours=0,
    minutes=10,
    keywords=['Greetings', 'pan-African', 'Kemet', 'King', 'My Negus'],
    prefix=None,
    suffix='#Ash_e_Hotep')

import time
time.sleep(86400)

# Use the following to stop periodically tweeting
# (Don't do this directly after starting it, or your bot will do nothing!)
# tweetbot.twitter_tweeting_stop()
# a shallow conversation depth. For example, a value of 2 will allow the bot
# to only reply in conversations where there are two or less replies to the
# original tweet.
maxconvdepth = None

# Start auto-responding to tweets by calling twitter_autoreply_start
# This function operates in a Thread in the background, so your code
# will not block by calling it.
tweetbot.twitter_autoreply_start(targetstring, keywords=None, prefix=None, suffix='Cada vez que se dice Orgullo Gay un Unicornio Marino muere... se dice Orgullo LGTBI ;-) #OrgulloLGTBI #OrgulloLGTBIQ', maxconvdepth=None)


# Start periodically tweeting. This will post a tweet every X days, hours, and
# minutes. (You're free to choose your own interval, but please don't use it to
# spam other people. Nobody likes spammers and trolls.)
# This function operates in a Thread in the background, so your code will not
# block by calling it.
tweetbot.twitter_tweeting_start(days=0, hours=2, minutes=0, keywords=None, prefix=None, suffix='#OrgulloLGTBI')

# DO SOMETHING HERE TO ALLOW YOUR BOT TO BE ACTIVE IN THE BACKGROUND
# You could, for example, wait for a week:
secsinweek = 7 * 24 * 60 * 60
time.sleep(secsinweek)
 
# Use the following to stop auto-responding
# (Don't do this directly after starting it, or your bot will do nothing!)
tweetbot.twitter_autoreply_stop()

# Use the following to stop periodically tweeting
# (Don't do this directly after starting it, or your bot will do nothing!)
tweetbot.twitter_tweeting_stop()