我正在用 C# 开发一个电报机器人。使用类TelegramBotClient在Telegram.Bot库中。
我想SendTextMessageAsync使用 HTML 选项发送消息。在官方文档(https://core.telegram.org/bots/api#markdown-style)中,我可以看到:
string texto = @"<b>bold</b>, <strong> bold </strong>" +
@"<i> italic </i>, <em> italic </em>" +
@"<a href = 'http://www.example.com/'> inline URL </a>" +
@"<a href = 'tg://user?id=123456789'> inline mention of a user</a>" +
@"<code> inline fixed-width code </code>" +
@"<pre> pre - formatted fixed-width code block</pre>";
Bot.SendTextMessageAsync(chatId: id_chat,
text: texto,
parseMode: ParseMode.HTML);
Run Code Online (Sandbox Code Playgroud)
它正常工作,但我想使用“新行”和“列表”。我在电报官方通知上看到过它们,就像这张照片一样:
我试过<br>, </br>, <br/>……等等。
但我已经得到
Telegram.Bot.Exceptions.ApiRequestException:'错误请求:无法解析实体:字节偏移量为 36 的意外结束标记
有谁知道是否可以做到?
另外如果可以的话联系一个电话号码?
当我尝试使用以下代码片段将有效的json 文件转换为 powershell 内部表示时遇到问题:
[string]$changes = Get-Content -Path "C:\some\directory\with\file.json"
[PSCustomObject]$changes = ConvertFrom-Json -InputObject $Changes
Run Code Online (Sandbox Code Playgroud)
这会触发警告Cannot process argument because the value of argument "name" is not valid. Change the value of the "name" argument and run the operation again.
使用的Powershell版本是v5.1,它甚至不支持Name标志,所以我有点困惑,似乎找不到解决方案。
任何帮助表示赞赏...