本文介绍了稍后如何在bot框架中发送消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的机器人以后可以发送一些回复.就像在闹钟中一样,当用户说在凌晨5点ping我时,我想在凌晨5点向用户发送消息.如何在不收到消息的情况下发送消息?

I want my bot to be able to send some replies later. Like in alarm clock, when user says, ping me at 5 AM then I want to send message to the user at 5 AM. How can I send message without receiving one?

推荐答案

您将需要至少接收一条消息,以便您知道收件人的地址.您需要保存传入消息中的地址信息.我认为最简单的方法是保存整个邮件.

You'll need to receive at least one message so that you know the recipient's address. You'll need to save the addressing info from the incoming message. I think the easiest way is to save the whole message.

Nodejs:

var reply = session.message; // address: reply.address
// ...
reply.text = 'Wake up!';
bot.send(reply);

C#:

var reply = activity.CreateReply(""); // reply.Recipient, reply.Conversation, etc.
// ...
reply.Text = "Wake up!";
ConnectorClient connector = new ConnectorClient(new Uri(reply.ServiceUrl));
await connector.Conversations.ReplyToActivityAsync(reply);

这篇关于稍后如何在bot框架中发送消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 15:27