小编Dan*_*iel的帖子

哪些 HTML 标签可用于在 Telegram Bot 上发送消息?

我正在用 C# 开发一个电报机器人。使用类TelegramBotClientTelegram.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 的意外结束标记

有谁知道是否可以做到?

另外如果可以的话联系一个电话号码?

html c# markdown telegram-bot

6
推荐指数
1
解决办法
1万
查看次数

ConvertFrom-Json 返回“无法处理参数,因为参数“name”的值无效。”

当我尝试使用以下代码片段将有效的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标志,所以我有点困惑,似乎找不到解决方案。

任何帮助表示赞赏...

powershell json convertfrom-json

4
推荐指数
1
解决办法
2978
查看次数

标签 统计

c# ×1

convertfrom-json ×1

html ×1

json ×1

markdown ×1

powershell ×1

telegram-bot ×1