【问题标题】:Replying to a tweet using Twitterizer使用 Twitterizer 回复推文
【发布时间】:2012-06-11 12:48:15
【问题描述】:

我的问题是我正在尝试回复一条推文。我有推文的 tweetId。但无法回复。

OAuthTokens tokens = new OAuthTokens();
tokens.ConsumerKey = "xx";
tokens.ConsumerSecret = "xx";
tokens.AccessToken = "xx";
tokens.AccessTokenSecret = "xx";

StatusUpdateOptions options = new StatusUpdateOptions()
{
    InReplyToStatusId=21,
};

TwitterStatus.Update(tokens, " hi",options);

这是我的代码,但它不起作用...任何建议...我猜 Twitterizer 已更改

【问题讨论】:

    标签: c# twitter twitterizer


    【解决方案1】:

    您的代码似乎是正确的。 Update 方法返回一个对象,该对象将为您提供有关您向 Twitter 发出的请求的详细信息。查看错误消息的返回值中的值(如果有的话)。

    【讨论】:

      【解决方案2】:

      这是回复推文的代码

      SendTweetOptions options = new SendTweetOptions();
      
                  options.Status = "@twitterusername Reply to tweet ";
                  options.InReplyToStatusId = 123456789;
                  service.SendTweet(options);
      

      重要的是要记住 @twitterusername 是强制包含的,因为它是一个包装器。没有它,我认为它不会起作用。

      【讨论】:

        【解决方案3】:

        在调用 Update 方法之前尝试设置 TwitterStatus.InReplyToStatusId 属性。

        TwitterStatus.InReplyToStatusId = 21;
        

        【讨论】:

        • 这不正确有两个原因:InReplyToStatusId 是静态/密封的,您使用 Options 类将可选参数传递给方法。
        猜你喜欢
        • 2013-02-06
        • 1970-01-01
        • 2017-10-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多