嗨,我正在与我的应用程序同步电报机器人并发送带有标题的图像。我在电报机器人上发送图像成功。但是当我发送带有一半图像的长标题时,它没有通过。我不知道在电报上发送的标题或文本是否有任何限制,我不知道它。请任何人知道然后请告诉我。我想发送带有图像的完整标题。我的标题很长,然后我想制作标题的 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 个字符。
有一种方法可以脏传递它,使用sendMessage
而不是sendPhoto
,并使用HTML
或Markdown
将照片文件链接放在第一个字符中(可以是表情符号)。
您的照片将显示为预览,您最多可以添加 4096 个字符作为标题。
顺便说一句,您不能在照片标题中使用粗体/斜体,但您现在可以使用它。:)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句