Git Product home page Git Product logo

twitter-bot's Introduction

Twitter-Bot

Author: Wilson Giese - [email protected]

About

A Twitter bot that will query for specified terms and respond the the tweets using the Twitter REST API.

Config

To run this application several things need to be defined in a config file. Example config.json:

{
	"min_time_between_cycles":180000,
	"max_time_between_cycles":3000000,
	"max_tweets_per_cycle":1,

	"consumer_key":"YOUR CONSUMER KEY",
	"consumer_secret":"YOUR CONSUMER SECRET",
	"access_token":"YOUR ACCESS TOKEN",
	"access_token_secret":"YOUR ACCESS TOKEN SECRET",

	"queries":   ["I like rain", "I like thunder"], 
	"responses": ["You're welcome.", "I'm glad you like it.",  
					      "Just doing my job, no need to thank me."]
}

The above example is a config file for my test bot; The Zeus Bot(OAuth keys excluded).

  • min/max_min_time_between_cycles: This variable is the time in milliseconds that the bot will wait to run another cycle. The time is chosen randomly for each cycle.
  • max_tweets_per_cycle: This variable is the maximum number of tweets posted per cycle.
  • consumer_key, consumer_secret, access_token, & access_token_secret: These are the OAuth keys used to post to twitter using the REST API. These keys are given by Twitter and should remain a secret. Consumer keys are for the application itself, and access keys are for the twitter account that will post the "tweets".
  • queries: An array of strings that will be used to query Twitter.
  • responses: An array of string that will be used to respond to matching queries.

Run

java -cp TwitterBot.jar Bot

You can run the program with the normal class files, but you'll need to link all the libraries.

Required Libraries

json-simple-1.1.1, signpost-core-1.2.1.2, commons-codec-1.7

Notes

This bot was not created as a spam or advertisement bot, just as a way to explore the Twitter, OAuth, and JSON API's. That said, you can use or modify the code as you see fit.

twitter-bot's People

Contributors

wilsongiese avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.