-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathProgram.cs
More file actions
45 lines (37 loc) · 1.39 KB
/
Program.cs
File metadata and controls
45 lines (37 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TweetSharp;
namespace Twitterbot
{
class Program
{
static void Main(string[] args)
{
// Pass your credentials to the service
TwitterService service = new TwitterService("App_ConsumerKey", "App_ConsumerSecret");
service.AuthenticateWith("accessToken", "tokenSecret");
SearchOptions options = new SearchOptions { Q = "indie pop", Resulttype = TwitterSearchResultType.Recent };
var searchedTweets = service.Search(options);
if (searchedTweets != null)
{
foreach (var tweet in searchedTweets.Statuses )
{
if (!tweet.Text.Contains("RT"))
{
TwitterStatus s = service.SendTweet(new SendTweetOptions { Status = "RT: " + tweet.User.ScreenName + " " + tweet.Text });
}
}
}
//shows most recent tweets in console
var tweets = service.ListTweetsOnHomeTimeline(new ListTweetsOnHomeTimelineOptions());
foreach (var tweeti in tweets)
{
Console.WriteLine("{0} says '{1}'", tweeti.User.ScreenName, tweeti.Text);
}
Console.WriteLine("Press Enter to exit");
Console.Read();
}
}
}