如何使用 C# 在电报机器人上发送大尺寸的标题?

How to send large size of the caption on telegram bot using c#?

您好,我正在与我的应用程序同步电报机器人并发送带标题的图像。我在电报上发送图像成功 bot.but 当我发送带有图像的长标题时,一半没有收到 passed.i 不知道在电报上发送的标题或文本是否有任何限制我对此一无所知。请知道的人告诉 me.i 想要发送带图片的完整标题。我的标题很长,所以我想制作标题的 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));
                    }
                    sb.Append(Environment.NewLine);
                    sb.Append("join our team...");

                    Bot.SendPhotoAsync("@abc", new FileToSend(ds.Tables[0].Rows[0]["Url"].ToString(), ms), sb.ToString());                      
                }
            }
        }
        catch (Exception ex)
        {                
        }
    }

这是我的标题=>

**it is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).**

任何人都请帮助我,我不知道该怎么做。

正如@tashakori 所说,您只能在标题中发送 1024 个字符。

有一种方法可以dirty pass,用sendMessage代替sendPhoto,用HTMLMarkdown把照片文件link在第一个字符中(可以是表情符号)。
您的照片将显示为预览,您最多可以输入 4096 个字符作为标题。

顺便说一句,您不能在照片说明中使用 bold/italic,但您现在可以使用它。 :)