User events as it happen

Sep 8, 2014 at 8:34 AM
Hi .

Can you help me with code example to achieve this

I want stream user events as it happen with userstream api and i mean by user events that the following action user does

when user retweet to someone
when user favorite to someone
when user reply to someone

as you can see I'm not looking for events done to user id , I'm looking for events the user itself does to others

Thanks a lot
Coordinator
Sep 8, 2014 at 11:10 PM
There are various events that you can use with the UserStream of Tweetinvi.
Please have a look here to learn how to use the UserStream.
var userStream = Stream.CreateUserStream();
            
userStream.TweetFavouritedByAnyoneButMe += (sender, args) =>
{
    Console.WriteLine("A tweet has been favourited by one of the person you follow!");
};

userStream.TweetCreatedByAnyoneButMe += (sender, args) =>
{
    var tweet = args.Tweet;
    var personYouFollow = tweet.Creator;

    if (tweet.IsRetweet)
    {
        Console.WriteLine(personYouFollow.Name + " you follow has retweeted the tweet : " + tweet.Text);
    }

    if (tweet.InReplyToUserId != null)
    {
        Console.WriteLine(personYouFollow.Name + " you follow has posted a tweet in reply to the person with the id : " + tweet.InReplyToUserId);
    }
};

userStream.StartStream();
Linvi
Marked as answer by linvi on 9/11/2014 at 5:04 AM