Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appSettings.json");

            Configuration = builder.Build();

            TwitterBotCredentials credentials = TwitterBotCredentials.Create(Configuration);

            credentials.Authenticate();

            var liste = TwitterList.Create(Configuration);

            Console.WriteLine("Nouveau membre ?");
            string member = Console.ReadLine();

            if (!string.IsNullOrEmpty(member))
            {
                liste.AddMember(member);
            }



            Console.WriteLine("Mots clés ?");
            string searchQuery = Console.ReadLine();

            TwitterBot bot = new TwitterBot(credentials, liste, searchQuery, 150, 9000);

            bot.Run();
        }
Ejemplo n.º 2
0
        public TwitterBot(TwitterBotCredentials credentials, TwitterList twitterList, string searchQuery, int maxTweetNumber, int sleepDuration)
        {
            Credentials = credentials;
            TwitterList = twitterList;
            SearchQuery = searchQuery;

            MaxTweetNumber = maxTweetNumber;
            SleepDuration  = sleepDuration;
        }
        public static TwitterBotCredentials Create(IConfiguration configuration)
        {
            TwitterBotCredentials item = new TwitterBotCredentials();

            item.ConsumerKey       = configuration["credentials:consumerKey"];
            item.ConsumerKeySecret = configuration["credentials:consumerKeySecret"];
            item.AccessToken       = configuration["credentials:accessToken"];
            item.AccessTokenSecret = configuration["credentials:accessTokenSecret"];
            return(item);
        }