{
using (var twitter = new Twitter())
{
- Assert.Equal(140, twitter.GetTextLengthRemain("D twitter "));
- Assert.Equal(132, twitter.GetTextLengthRemain("D twitter hogehoge"));
+ // 2015年8月から DM の文字数上限が 10,000 文字に変更された
+ // https://twittercommunity.com/t/41348
+ twitter.Configuration.DmTextCharacterLimit = 10000;
+
+ Assert.Equal(10000, twitter.GetTextLengthRemain("D twitter "));
+ Assert.Equal(9992, twitter.GetTextLengthRemain("D twitter hogehoge"));
}
}
[DataMember(Name = "max_media_per_upload")]
public int MaxMediaPerUpload { get; set; }
+ [DataMember(Name = "dm_text_character_limit")]
+ public int DmTextCharacterLimit { get; set; }
+
/// <exception cref="SerializationException"/>
public static TwitterConfiguration ParseJson(string json)
{
ShortUrlLength = 19,
ShortUrlLengthHttps = 20,
PhotoSizeLimit = 3145728L,
+ DmTextCharacterLimit = 10000,
};
}
}
更新履歴
==== Ver 1.2.8-dev(2015/xx/xx)
+ * NEW: DMの文字数制限の緩和(上限10,000文字)に対応しました
* FIX: 上下キーなどで選択ツイートを移動した直後に左右キーなどによる関連ツイートの移動が正しく動作しない不具合を修正
* FIX: DM投稿時の「D (スクリーン名)」が文字数のカウントに余分に含まれていた不具合を修正
{
var matchDm = Twitter.DMSendTextRegex.Match(postText);
if (matchDm.Success)
- return this.GetTextLengthRemainInternal(matchDm.Groups["body"].Value);
+ return this.GetTextLengthRemainInternal(matchDm.Groups["body"].Value, isDm: true);
- return this.GetTextLengthRemainInternal(postText);
+ return this.GetTextLengthRemainInternal(postText, isDm: false);
}
- private int GetTextLengthRemainInternal(string postText)
+ private int GetTextLengthRemainInternal(string postText, bool isDm)
{
var textLength = postText.Length;
}
}
- return 140 - textLength;
+ if (isDm)
+ return this.Configuration.DmTextCharacterLimit - textLength;
+ else
+ return 140 - textLength;
}
#region "UserStream"