嗨,我正在与我的应用程序同步电报机器人并发送带有标题的图像。我在电报机器人上发送图像成功。但是当我发送带有图像一半的长标题时,它没有通过。我不知道在电报上发送的标题或文本是否有任何限制,我不知道它。请任何人知道然后请告诉我。我想发送带有图像的完整标题。我的标题很长,然后我想制作标题的 2 部分并发送。下面我尝试过这样的代码。
这是我的 api =>
[System.Web.Http.AcceptVerbs("POST")]
public void SendCasesOnTelegramBot()
{
try
{
DataSet ds = DataAccess.ExecuteDataset(Setting.ConnectionString(), "GetPostForTelegramBot");
if (ds != null && ds.Tables.Count > 0)
{
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
{
var Image = ds.Tables[0].Rows[0]["Url"].ToString();
byte[] imageData = null;
WebClient webClient = new WebClient();
imageData = webClient.DownloadData(Image);
MemoryStream ms = new MemoryStream(imageData);
var sb = new StringBuilder();
sb.Append(Environment.NewLine);
sb.Append(".");
sb.Append(Environment.NewLine);
sb.Append(".");
sb.Append(Environment.NewLine);
if (ds.Tables[0].Rows[0]["Description"].ToString().Length <= 133)
{
sb.AppendLine(ds.Tables[0].Rows[0]["Description"].ToString());
}
else
{
sb.AppendLine(ds.Tables[0].Rows[0]["Description"].ToString().Substring(0, 133));
sb.AppendLine(ds.Tables[0].Rows[0]["Description"].ToString().Substring(134, 0)); …Run Code Online (Sandbox Code Playgroud)