Skip to content
/ tweebot Public

A Python library to build twitter bots. Create your bot like playing with constructor.

License

Notifications You must be signed in to change notification settings

caxap/tweebot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TweeBot v1.0

A Python library to build twitter bots over tweepy library. It's a very simple and flexible way to create your own bot.

Example

# Next code demonstrates how to create simple twitter bot that select all friends'
# tweets with your mentiones and retweet they. (See comments in code for more 
# details about how filters work.)

import tweebot as twb

def main():
    # Step 1. setup context configuration
    repeater = twb.Context({
		'app_name'        : 'repeater',
		'username'        : '<YOUR ACCOUNT NAME>',
		'consumer_key'    : '<YOUR CONSUMER KEY>',
		'consumer_secret' : '<YOUR CONSUMER SECRET>',
		'access_key'      : '<YOUR ACCESS KEY>',
		'access_secret'   : '<YOUR ACCESS SECRET>',
		'timeout'         : 1 * 60, # 1 min, ensure twitter api limits
		'history_file'    : 'history.json',
	})

	# Step 2. enable pretty logging
	twb.enable_logging(repeater)

	# Step 3. setup chain Selector->Filters->Action
	chain = (
		twb.SearchMentions(),
		twb.MultiPart.And(
			twb.BaseFilter,
			twb.UsersFilter.Friends(),
			twb.BadTweetFilter),
		twb.ReplyRetweet)

	# Step 4. start processing 
	repeater.start_forever(*chain)

if __name__ == '__main__':
	main()

Other

About

A Python library to build twitter bots. Create your bot like playing with constructor.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages