带有电报频道按钮的缩略图卡会产生 InternalServerError
Thumbnail card with buttons to Telegram channel produces InternalServerError
将缩略图卡发送到电报频道会产生以下异常。这在模拟器中运行良好。
操作返回无效状态代码'InternalServerError'
这是卡的代码:
var Card = new ThumbnailCard(cardHeading, BotName)
{
Buttons = new List<CardAction>
{
new CardAction(ActionTypes.ImBack, "MyProfile", text:"MyProfile", displayText: "MyProfile", value: "MyProfile"),
new CardAction(ActionTypes.ImBack, "MyBadges", text:"MyBadges", displayText: "MyBadges", value: "MyBadges"),
new CardAction(ActionTypes.ImBack, "MyActivity", text:"MyActivity", displayText: "MyActivity", value: "MyActivity"),
new CardAction(ActionTypes.ImBack, "LogOut", text: "LogOut", displayText: "LogOut", value: "LogOut")
},
Images = new List<CardImage>()
{
new CardImage()
{
Url = string.Format("data:image/png;base64,{0}", strBase64Image)
}
}
};
// Using a base64 string to send an attachment will not work on all channels.
// Additionally, some channels will only allow certain file types to be sent this way.
// For example a .png file may work but a .pdf file may not on some channels.
// Please consult the channel documentation for specifics.
从这些信息中我们可以推测 Telegram 不支持嵌入图像。
我怀疑你的 CardImage Url 格式是否正确。你能试试下面的代码片段吗
Images = new List<CardImage> { new CardImage("https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg") }
要记住的要点:
模拟器本身可以解决许多频道总是无法解决的问题。
让我知道它是否有效
将缩略图卡发送到电报频道会产生以下异常。这在模拟器中运行良好。
操作返回无效状态代码'InternalServerError'
这是卡的代码:
var Card = new ThumbnailCard(cardHeading, BotName)
{
Buttons = new List<CardAction>
{
new CardAction(ActionTypes.ImBack, "MyProfile", text:"MyProfile", displayText: "MyProfile", value: "MyProfile"),
new CardAction(ActionTypes.ImBack, "MyBadges", text:"MyBadges", displayText: "MyBadges", value: "MyBadges"),
new CardAction(ActionTypes.ImBack, "MyActivity", text:"MyActivity", displayText: "MyActivity", value: "MyActivity"),
new CardAction(ActionTypes.ImBack, "LogOut", text: "LogOut", displayText: "LogOut", value: "LogOut")
},
Images = new List<CardImage>()
{
new CardImage()
{
Url = string.Format("data:image/png;base64,{0}", strBase64Image)
}
}
};
// Using a base64 string to send an attachment will not work on all channels.
// Additionally, some channels will only allow certain file types to be sent this way.
// For example a .png file may work but a .pdf file may not on some channels.
// Please consult the channel documentation for specifics.
从这些信息中我们可以推测 Telegram 不支持嵌入图像。
我怀疑你的 CardImage Url 格式是否正确。你能试试下面的代码片段吗
Images = new List<CardImage> { new CardImage("https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg") }
要记住的要点:
模拟器本身可以解决许多频道总是无法解决的问题。
让我知道它是否有效