Menu

#360 How to create a Bot

open
nobody
None
2021-01-27
2020-09-11
Anonymous
No

Originally created by: Phill030

Hello, i wanted to create a TwitterBot but i dont know how do i set everything up. since more than 3 months i cant use "ConfigurationBuilder cb = new ConfigurationBuilder()" and almost everything is not working for me.
Can someone tell me how i create a bot?
thx

Discussion

  • Anonymous

    Anonymous - 2020-09-21

    Originally posted by: eos1d3

    This repo is dead. I think ConfigurationBuildercan still work. Many other API endpoints are obsoleted.

    Twitter has updated its API for years while this repo never changes since 3 years ago.

     
  • Anonymous

    Anonymous - 2020-10-03

    Originally posted by: Philipinho

    The library still works great. I use it for my projects.

    You can try the below code.
    Make sure you install the library properly.

    import twitter4j.*;
    
    public class TwitterTest {
    
       private static  TwitterFactory tf = new TwitterFactory(conf());
       private static Twitter twitter = tf.getInstance();
    
       private static Configuration conf() {
            ConfigurationBuilder cb = new ConfigurationBuilder();
            cb.setDebugEnabled(true)
                    .setOAuthConsumerKey("xxxxxxxxxxx")
                    .setOAuthConsumerSecret("xxxxxxxxxxx")
                    .setOAuthAccessToken("xxxxxx)
                    .setOAuthAccessTokenSecret("xxxxx");
            return cb.build();
        }
    
       public static void main (String[] args){
          twitter.verifyCredentials();
       }
    }
    
     

Log in to post a comment.