Coder Social home page Coder Social logo

michidk / simpletwitterbotapi Goto Github PK

View Code? Open in Web Editor NEW
5.0 4.0 0.0 31 KB

A very simple API/Twitter4J wrapper for Twitter bots.

Home Page: https://twitter.com/miichidk

License: MIT License

Java 100.00%
twitter twitter4j bot api twitterbot twitter-bot twitterbots twitter-api twitter-client

simpletwitterbotapi's Introduction

SimpleTwitterBotAPI

A very simple API/Twitter4J wrapper for Twitter bots.

Example

        TwitterBot bot = new TwitterBot();                          // create a new Twitter bot instance

        Behaviour behaviour = BehaviourBuilder.create()
            .listen(
                new KeywordEvent("lookingForThisKeyword"),          // looking for "lookingForThisKeyword" and "#mySuperCoolHashtag" on Twitter
                new HashtagEvent("mySuperCoolHashtag")              // can also be achieved by calling listen() on the builder multiple times
            ).filter(
                new RTFilter()                                      // exclude tweets that starts with "RT, a lot of bots do this
            ).react(
                new QueuedReplyReaction("Test!", "Test 123")
        ).build();

        bot.addBehaviour(behaviour);                                // add the behaviour to the bot instance

        // or do everything in one statement
        bot.addBehaviour(
            BehaviourBuilder.create().listen(
                new MentionEvent("miichidk")
            ).react(
                new LikeReaction()
            ).build()
        );

        // ... add as many behaviours as you want
        
        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

simpletwitterbotapi's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.