static void Main(string[] args) { var tokens = new Twitterizer.OAuthTokens { ConsumerKey = @"", ConsumerSecret = @"", AccessToken = @"-", AccessTokenSecret = @"" }; var response = Twitterizer.TwitterSearch.Search(tokens, " ", new Twitterizer.SearchOptions { Count = 5, GeoCode = "39.920687,32.853970,50km" }); if (response.Result != Twitterizer.RequestResult.Success) { return; } var index = 0; foreach (var status in response.ResponseObject) { index++; Console.WriteLine(index); Console.WriteLine(status.Text); Console.WriteLine(status.CreatedDate); } Console.ReadLine(); }
static void Main(string[] args) { if (System.IO.File.Exists(conffile)) { string[] conflines = System.IO.File.ReadAllLines(conffile); foreach (string confline in conflines) { if (confline.Split('|')[0] == "minutesbetweenpost" && confline.Split('|')[0].Length > 1) int.TryParse(confline.Split('|')[1], out minutesbetweenpost); } } else System.IO.File.WriteAllText(conffile, "minutesbetweenpost|" + minutesbetweenpost.ToString()); //Below was for the first auth with twitter. /*Twitterizer.OAuthTokenResponse otokenresp = Twitterizer.OAuthUtility.GetRequestToken("s4NnGFjXHow8E4sAghj2cA", "J75EVo7fFnRIOyWvWAMv1cj2oIPEJq73CIsULO0k", "oob"); Console.WriteLine("http://twitter.com/oauth/authorize?oauth_token=" + otokenresp.Token); Console.WriteLine("Hit enter when done."); Console.Read(); Console.Write("Enter the pin: "); string pin = Console.ReadLine(); Twitterizer.OAuthTokenResponse otokenrespverified = Twitterizer.OAuthUtility.GetAccessToken("s4NnGFjXHow8E4sAghj2cA", "J75EVo7fFnRIOyWvWAMv1cj2oIPEJq73CIsULO0k", otokenresp.Token, pin); Console.WriteLine("Got the following data:\nScreenname: {0}\nToken: {1}\nToken secret: {2}", otokenrespverified.ScreenName, otokenrespverified.Token, otokenrespverified.TokenSecret); Console.ReadLine(); */ Twitterizer.OAuthTokens otokens = new Twitterizer.OAuthTokens(); otokens.ConsumerKey = "s4NnGFjXHow8E4sAghj2cA"; otokens.ConsumerSecret = "J75EVo7fFnRIOyWvWAMv1cj2oIPEJq73CIsULO0k"; otokens.AccessToken = "407275798-F3Jp52bV8YYnQdXkvt9CyfnbgSG5eqm3fWuvKPnV"; otokens.AccessTokenSecret = "WQcWvYms6QU4jwVOEwzJl0PDAoBxIZaYkL6q5c6Fxc"; //Twitterizer.TwitterResponse<Twitterizer.TwitterUser> showusreresp = Twitterizer.TwitterUser.Show(otokens, "Onymity"); //Console.WriteLine(showusreresp.Result); while (true) { System.Net.Sockets.Socket bacon = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp); bacon.Connect("localhost", 5000); CedLib.Networking.socketfunctions.sendstring(bacon, "talk"); CedLib.Networking.socketfunctions.waitfordata(bacon, 1000, false); string botsays = CedLib.Networking.socketfunctions.receivestring(bacon, false); logger.log("Posting: " + botsays, CedLib.Logging.Priority.Notice); Console.WriteLine(Twitterizer.TwitterStatus.Update(otokens, "Bot says: " + botsays).Result); System.Threading.Thread.Sleep(minutesbetweenpost * 60000); if (System.IO.File.Exists(conffile)) { string[] conflines = System.IO.File.ReadAllLines(conffile); foreach (string confline in conflines) { if (confline.Split('|')[0] == "minutesbetweenpost" && confline.Split('|')[0].Length > 1) int.TryParse(confline.Split('|')[1], out minutesbetweenpost); } } else System.IO.File.WriteAllText(conffile, "minutesbetweenpost|" + minutesbetweenpost.ToString()); } }
static void Main(string[] args) { if (System.IO.File.Exists(conffile)) { string[] conflines = System.IO.File.ReadAllLines(conffile); foreach (string confline in conflines) { if (confline.Split('|')[0] == "minutesbetweenpost" && confline.Split('|')[0].Length > 1) { int.TryParse(confline.Split('|')[1], out minutesbetweenpost); } } } else { System.IO.File.WriteAllText(conffile, "minutesbetweenpost|" + minutesbetweenpost.ToString()); } //Below was for the first auth with twitter. /*Twitterizer.OAuthTokenResponse otokenresp = Twitterizer.OAuthUtility.GetRequestToken("s4NnGFjXHow8E4sAghj2cA", "J75EVo7fFnRIOyWvWAMv1cj2oIPEJq73CIsULO0k", "oob"); * Console.WriteLine("http://twitter.com/oauth/authorize?oauth_token=" + otokenresp.Token); * Console.WriteLine("Hit enter when done."); * Console.Read(); * Console.Write("Enter the pin: "); * string pin = Console.ReadLine(); * Twitterizer.OAuthTokenResponse otokenrespverified = Twitterizer.OAuthUtility.GetAccessToken("s4NnGFjXHow8E4sAghj2cA", "J75EVo7fFnRIOyWvWAMv1cj2oIPEJq73CIsULO0k", otokenresp.Token, pin); * Console.WriteLine("Got the following data:\nScreenname: {0}\nToken: {1}\nToken secret: {2}", otokenrespverified.ScreenName, otokenrespverified.Token, otokenrespverified.TokenSecret); * Console.ReadLine(); */ Twitterizer.OAuthTokens otokens = new Twitterizer.OAuthTokens(); otokens.ConsumerKey = "s4NnGFjXHow8E4sAghj2cA"; otokens.ConsumerSecret = "J75EVo7fFnRIOyWvWAMv1cj2oIPEJq73CIsULO0k"; otokens.AccessToken = "407275798-F3Jp52bV8YYnQdXkvt9CyfnbgSG5eqm3fWuvKPnV"; otokens.AccessTokenSecret = "WQcWvYms6QU4jwVOEwzJl0PDAoBxIZaYkL6q5c6Fxc"; //Twitterizer.TwitterResponse<Twitterizer.TwitterUser> showusreresp = Twitterizer.TwitterUser.Show(otokens, "Onymity"); //Console.WriteLine(showusreresp.Result); while (true) { System.Net.Sockets.Socket bacon = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp); bacon.Connect("localhost", 5000); CedLib.Networking.socketfunctions.sendstring(bacon, "talk"); CedLib.Networking.socketfunctions.waitfordata(bacon, 1000, false); string botsays = CedLib.Networking.socketfunctions.receivestring(bacon, false); logger.log("Posting: " + botsays, CedLib.Logging.Priority.Notice); Console.WriteLine(Twitterizer.TwitterStatus.Update(otokens, "Bot says: " + botsays).Result); System.Threading.Thread.Sleep(minutesbetweenpost * 60000); if (System.IO.File.Exists(conffile)) { string[] conflines = System.IO.File.ReadAllLines(conffile); foreach (string confline in conflines) { if (confline.Split('|')[0] == "minutesbetweenpost" && confline.Split('|')[0].Length > 1) { int.TryParse(confline.Split('|')[1], out minutesbetweenpost); } } } else { System.IO.File.WriteAllText(conffile, "minutesbetweenpost|" + minutesbetweenpost.ToString()); } } }