项目作者: michidk

项目描述 :
A very simple API/Twitter4J wrapper for Twitter bots.
高级语言: Java
项目地址: git://github.com/michidk/SimpleTwitterBotAPI.git
创建时间: 2017-06-15T08:42:24Z
项目社区:https://github.com/michidk/SimpleTwitterBotAPI

开源协议:MIT License

下载


SimpleTwitterBotAPI

A very simple API/Twitter4J wrapper for Twitter bots.

Example

  1. TwitterBot bot = new TwitterBot(); // create a new Twitter bot instance
  2. Behaviour behaviour = BehaviourBuilder.create()
  3. .listen(
  4. new KeywordEvent("lookingForThisKeyword"), // looking for "lookingForThisKeyword" and "#mySuperCoolHashtag" on Twitter
  5. new HashtagEvent("mySuperCoolHashtag") // can also be achieved by calling listen() on the builder multiple times
  6. ).filter(
  7. new RTFilter() // exclude tweets that starts with "RT, a lot of bots do this
  8. ).react(
  9. new QueuedReplyReaction("Test!", "Test 123")
  10. ).build();
  11. bot.addBehaviour(behaviour); // add the behaviour to the bot instance
  12. // or do everything in one statement
  13. bot.addBehaviour(
  14. BehaviourBuilder.create().listen(
  15. new MentionEvent("miichidk")
  16. ).react(
  17. new LikeReaction()
  18. ).build()
  19. );
  20. // ... add as many behaviours as you want
  21. bot.start();

Setup

To create a new bot/bot behaviour just orientate on the example code.
Authentication works via Twitter4j. Follow the instructions here. To authenticate via ConfigurationBuilder, just pass the built configuration object to the constructor of TwitterBot().

Dependencies