コード例 #1
0
        protected override void OnStart(string[] args)
        {
            timer1          = new Timer(60 * 1000); //7200000; // I think this is every two hours
            timer1.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
            timer1.Start();

            try
            {
                Random rnd       = new Random();
                int    rndMethod = rnd.Next(1, 2);

                //                rndMethod = 3;

                Image image;

                if (rndMethod == 1)
                {
                    image = PoetryBot.PoetryFoundationRndmToImage();
                    PoetryBot.PostToBot("", image.ToStream(ImageFormat.Png));
                }
                if (rndMethod == 2)
                {
                    image = PoetryBot.PublicDomainPoetryRndmToImage();
                    PoetryBot.PostToBot("", image.ToStream(ImageFormat.Png));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.ReadKey();
            }

            PoetryBot.FollowPoetryHashtaggers(1);
            PoetryBot.FollowBackNotFollowed();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            // add epigraphs for poetry foundation

            try
            {
                Random rnd       = new Random();
                int    rndMethod = rnd.Next(1, 4); // this is how you get 1-3 random

                Image image;

                if (rndMethod == 1) // poetry foundation
                {
                    image = PoetryBot.PoetryFoundationRndmToImage();
                    PoetryBot.PostToBot("", image.ToStream(ImageFormat.Png));
                }
                if (rndMethod == 2) // public domain poetry
                {
                    image = PoetryBot.PublicDomainPoetryRndmToImage();
                    PoetryBot.PostToBot("", image.ToStream(ImageFormat.Png));
                }
                if (rndMethod == 3) //poets.org
                {
                    image = PoetryBot.PoetsorgToImage();
                    PoetryBot.PostToBot("", image.ToStream(ImageFormat.Png));
                }

                //      PoetryBot.LogTweetInfo();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.ReadKey();
            }

            PoetryBot.FollowPoetryHashtaggers(1);
            PoetryBot.FollowBackNotFollowed();
        }