[英]python send pdf file with Microsoft teams bot
我需要創建發送 pdf 文件的選項。 現在我會在聊天中發送@bot 發送 pdf,然后發送下面的基本測試卡代碼。
async def on_message_activity(self, turn_context: TurnContext):
self._add_conversation_reference(turn_context.activity)
if " send pdf" in turn_context.activity.text:
cardAtt = self.thumbnail_card()
msg_activity = MessageFactory.attachment(cardAtt)
await turn_context.send_activity(msg_activity)
else:
return await turn_context.send_activity(
f"You sent : {turn_context.activity.text}"
)
def thumbnail_card(self) -> Attachment:
card = ThumbnailCard()
card.images = [ThumbnailUrl(url="https://pypi.org/static/images/logo-large.72ad8bf1.svg")]
card.title = "Bot builder sample card"
card.subtitle = "SDK Version 4.9"
card.text = "Thumbnail card is the one of the card type in Bot Framework"
return CardFactory.thumbnail_card(card)
也許可以更改縮略圖卡以在聊天中發送 pdf 文件並允許用戶下載? 在manifest.json
文件中我允許"supportsFiles": true,
那么知道該怎么做嗎? 關於如何使用 Microsoft bot 發送 pdf 文件的信息不多。 所以也許你能幫助我。
我認為一般指導不是實際發送文件,而是文件的鏈接- 它支持更好的組織文檔/記錄管理,例如,文檔保留在 SharePoint 中,例如,您只需發送縮略圖卡(或其他)中的文檔鏈接。 當然,該文件可以托管在其他地方(例如 Azure Blob)。
這是發送 pdf 的樣品,你能試試這個。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.