发送附件给用户后,提示对话框不显示

时间:2019-01-08 06:30:04

标签: c# botframework

我正在尝试向用户发送关于bot connect的欢迎回复,所以我创建了一个IntroDialog并试图创建。

this

使用以下代码

  [Serializable]
public class IntroDialog : IDialog<object>
{
 public async Task StartAsync(IDialogContext context)
    {           
        context.Wait(MessageReceivedAsync);
    }

    public virtual async Task MessageReceivedAsync(IDialogContext context, 
     IAwaitable<IActivity> argument)
    {
        var activity = await argument;
        var replyMessage = context.MakeMessage();
        //Activity replyToConversation = message.CreateReply("Hello");
        replyMessage.Attachments = new List<Attachment>();

        var imagePath = HttpContext.Current.Server.MapPath("~/images/demov1.gif");

        var imageData = Convert.ToBase64String(File.ReadAllBytes(imagePath));
        var aa = new Attachment
        {
            Name = "demov1.gif",
            ContentType = "image/gif",
            ContentUrl = $"data:image/gif;base64,{imageData}"
        };
        replyMessage.Attachments.Add(aa);
        await context.PostAsync(replyMessage).ConfigureAwait(false);

        var flowChoices = (IEnumerable<UseSaveInfoResponse>)Enum.GetValues(typeof(UseSaveInfoResponse));
                PromptDialog.Choice(context, null, flowChoices,
                "Out of curiosity, can we ask you something?");


    }

    public async Task FlowChoiceResult(IDialogContext context, 
      IAwaitable<UseSaveInfoResponse> argument)
    {
        await context.PostAsync($"You selected {await argument}");
        context.Wait(MessageReceivedAsync);
    }

}

我无法同时获得仅发布附件或选择发布的所有内容。

请尽可能提供解决方案。谢谢

输出我得到this

1 个答案:

答案 0 :(得分:1)

known issues尝试在响应from pyspark.sql.functions import first df.groupBy("individual_id").agg( first("mail", ignorenulls=True).alias("mail"), first("phone", ignorenulls=True).alias("phone") ).show() #+-------------+-----------+-----+ #|individual_id| mail|phone| #+-------------+-----------+-----+ #| 1|a@gmail.com| 123| #| 2|b@gmail.com| 345| #+-------------+-----------+-----+ 事件的同时启动对话框:

  

最初发送 对话时,消息中没有足够的信息来构造对话框堆栈。

推荐的解决方案是在用户发送消息之前不要尝试启动对话框。如果您必须启动对话框以响应from pyspark.sql.functions import when, col df.groupBy("individual_id").agg( first("mail", ignorenulls=True).alias("mail"), first("phone", ignorenulls=True).alias("phone"), first(when(col("mail").isNotNull(), col("role")), ignorenulls=True).alias("mail_role"), first(when(col("phone").isNotNull(), col("role")), ignorenulls=True).alias("phone_role"), ).show() #+-------------+-----------+-----+---------+----------+ #|individual_id| mail|phone|mail_role|phone_role| #+-------------+-----------+-----+---------+----------+ #| 1|a@gmail.com| 123| seconary| primary| #| 2|b@gmail.com| 345| primary| secondary| #+-------------+-----------+-----+---------+----------+ ,则需要变通方法。尝试阅读我链接的文章以了解更多信息。