public static bool setFavoritState(AccountTwitter account, TwitterItem item, bool newState) { try { TwitterStatus status; if (newState) { FavoriteTweetOptions options = new FavoriteTweetOptions(); options.Id = Convert.ToInt64(item.Id); status = account.twitterService.FavoriteTweet(options); } else { UnfavoriteTweetOptions options = new TweetSharp.UnfavoriteTweetOptions(); options.Id = Convert.ToInt64(item.Id); status = account.twitterService.UnfavoriteTweet(options); } if (status != null) { return(true); } else { return(false); } } catch (Exception exp) { System.Windows.MessageBox.Show(exp.Message, "Sending of dm failed"); return(false); } }
public virtual void UnfavoriteTweet(UnfavoriteTweetOptions options, Action<TwitterStatus, TwitterResponse> action) { var id = options.Id; WithHammock(WebMethod.Post, action, "favorites/destroy", FormatAsString, "?id=", id); }
public virtual IAsyncResult BeginUnfavoriteTweet(UnfavoriteTweetOptions options) { var id = options.Id; return BeginWithHammock<TwitterStatus>(WebMethod.Post, "favorites/destroy", FormatAsString, "?id=", id); }
public virtual Task<TwitterResponse<TwitterStatus>> UnfavoriteTweetAsync(UnfavoriteTweetOptions options) { var id = options.Id; return ExecuteRequest<TwitterStatus>(HttpMethod.Post, "favorites/destroy", FormatAsString, "?id=", id); }
public virtual Task<TwitterAsyncResult<TwitterStatus>> UnfavoriteTweetAsync(UnfavoriteTweetOptions options) { var id = options.Id; return WithHammockTask<TwitterStatus>(_client, WebMethod.Post, "favorites/destroy", FormatAsString, "?id=", id); }
public virtual IAsyncResult UnfavoriteTweet(UnfavoriteTweetOptions options, Action<TwitterStatus, TwitterResponse> action) { var id = options.Id; return WithHammock(_client, WebMethod.Post, action, "favorites/destroy", FormatAsString, "?id=", id); }
/// <summary> /// Favorites or unfavorites a tweet /// </summary> /// <param name="command">The entire command string</param> /// <returns></returns> private void FavoriteTweet(string command) { if (User.IsMissingArgs(command) == false) /* It's just an exception catching method, don't mind it */ { if (command.Split(' ')[1].Length != 2) { ScreenDraw.ShowMessage("Wrong syntax. Use /fav [id]"); } else { SendTweetOptions replyOpts = TweetIdentification.GetTweetID(command.Split(' ')[1]); FavoriteTweetOptions favOpts = new FavoriteTweetOptions(); GetUpdates favoriteInvert = new GetUpdates(); long tweetID = Convert.ToInt64(replyOpts.InReplyToStatusId); favOpts.Id = tweetID; InteractiveTweet tweet = null; try { tweet = TweetIdentification.FindTweet(tweetID); } catch (KeyNotFoundException exIn) { ScreenDraw.ShowMessage(exIn.Message); return; } if (tweet.IsDirectMessage == false) { if (tweet.IsFavorited) { ScreenDraw.ShowMessage("Unfavoriting"); UnfavoriteTweetOptions unfavOpts = new UnfavoriteTweetOptions(); unfavOpts.Id = favOpts.Id; User.Account.BeginUnfavoriteTweet(unfavOpts); favoriteInvert.InvertFavoriteStatus(tweetID); /* Changes whether the tweet is counted as favorited */ } else { User.Account.BeginFavoriteTweet(favOpts); ScreenDraw.ShowMessage("Favoriting"); favoriteInvert.InvertFavoriteStatus(tweetID); /* Changes whether the tweet is counted as favorited */ } } else { ScreenDraw.ShowMessage("You can't favorite DMs, silly"); } } } }