Пример #1
0
 // 當Bot已經加入對話、成員加入和離開對話、對話資料更改時
 private async Task <Activity> HandleConversationUpdateMessage(Activity activity)
 {
     if (activity.MembersAdded.Any(o => o.Id == activity.From.Id))
     {
         var context = BotDialogContext.Create(activity);
         await context.ReplyMessageAsync("哈囉!");
     }
     return(activity);
 }
Пример #2
0
        // 回覆語音
        public static ResourceResponse ReplySpeakAsync(this IDialogContext context, string speakText, string inputHint = null, int waitTime = 0, bool isSendTyping = false)
        {
            var botContext = BotDialogContext.Create(context).EnableShowTyping(isSendTyping, waitTime);

            return(botContext.ReplySpeak(speakText: speakText, inputHint: inputHint));
        }
Пример #3
0
        public static ResourceResponse ReplyMedia(this IDialogContext context, string contentUrl, string contentType, string fileName, List <CardAction> suggestedActions = null, int waitTime = 0, bool isSendTyping = false)
        {
            var botContext = BotDialogContext.Create(context).EnableShowTyping(isSendTyping, waitTime);

            return(botContext.ReplyMedia(contentUrl: contentUrl, contentType: contentType, fileName: fileName, suggestedActions: suggestedActions));
        }
Пример #4
0
        public static ResourceResponse ReplyAttachment(this IDialogContext context, IEnumerable <Attachment> attachments, string text = null, string layout = AttachmentLayoutTypes.Carousel, List <CardAction> suggestedActions = null, int waitTime = 0, bool isSendTyping = false)
        {
            var botContext = BotDialogContext.Create(context).EnableShowTyping(isSendTyping, waitTime);

            return(botContext.ReplyAttachment(attachments: attachments, text: text, layout: layout, suggestedActions: suggestedActions));
        }
Пример #5
0
        // 回覆附件訊息
        public static ResourceResponse ReplyAttachment(this IDialogContext context, Attachment attachment, string text = null, List <CardAction> suggestedActions = null, int waitTime = 0, bool isSendTyping = false)
        {
            var botContext = BotDialogContext.Create(context).EnableShowTyping(isSendTyping, waitTime);

            return(botContext.ReplyAttachment(attachment: attachment, text: text, suggestedActions: suggestedActions));
        }
Пример #6
0
        public static ResourceResponse ReplyMessage(this IDialogContext context, string message, string action, string actionName = null, int waitTime = 0, bool isSendTyping = false)
        {
            var botContext = BotDialogContext.Create(context).EnableShowTyping(isSendTyping, waitTime);

            return(botContext.ReplyMessage(message: message, action: action, actionName: actionName));
        }
Пример #7
0
        public static ResourceResponse ReplyMessage(this IDialogContext context, IMessageActivity message, int waitTime = 0, bool isSendTyping = false)
        {
            var botContext = BotDialogContext.Create(context).EnableShowTyping(isSendTyping, waitTime);

            return(botContext.ReplyMessage(message: message));
        }
Пример #8
0
        public static async Task <ResourceResponse> ReplyAttachmentAsync(this IDialogContext context, IEnumerable <Attachment> attachments, string text = null, string layout = AttachmentLayoutTypes.Carousel, List <CardAction> suggestedActions = null, int waitTime = 0, bool isSendTyping = false, CancellationToken cancellationToken = default(CancellationToken))
        {
            var botContext = BotDialogContext.Create(context).EnableShowTyping(isSendTyping, waitTime);

            return(await botContext.ReplyAttachmentAsync(attachments : attachments, text : text, layout : layout, suggestedActions : suggestedActions, cancellationToken : cancellationToken));
        }
Пример #9
0
 public static async Task DeleteMessageAsync(this IDialogContext context, string activityId)
 {
     var botContext = BotDialogContext.Create(context);
     await botContext.DeleteMessageAsync(activityId);
 }
Пример #10
0
        // 刪除訊息
        public static void DeleteMessage(this IDialogContext context, string activityId)
        {
            var botContext = BotDialogContext.Create(context);

            botContext.DeleteMessage(activityId);
        }
Пример #11
0
        public static async Task <ResourceResponse> UpdateMessageAsync(this IDialogContext context, string activityId, string message)
        {
            var botContext = BotDialogContext.Create(context);

            return(await botContext.UpdateMessageAsync(activityId, message));
        }
Пример #12
0
        // 修改訊息
        public static ResourceResponse UpdateMessage(this IDialogContext context, string activityId, string message)
        {
            var botContext = BotDialogContext.Create(context);

            return(botContext.UpdateMessage(activityId, message));
        }
Пример #13
0
        // 回覆正在打字狀態
        public static async Task <ResourceResponse> ReplyTypingAsync(this IDialogContext context, int waitTime = 0, bool isSendTyping = false, CancellationToken cancellationToken = default(CancellationToken))
        {
            var botContext = BotDialogContext.Create(context).EnableShowTyping(isSendTyping, waitTime);

            return(await botContext.ReplyTypingAsync(cancellationToken : cancellationToken));
        }
Пример #14
0
        public static async Task <ResourceResponse> ReplyMediaAsync(this IDialogContext context, string contentUrl, string contentType, string fileName, List <CardAction> suggestedActions = null, int waitTime = 0, bool isSendTyping = false, CancellationToken cancellationToken = default(CancellationToken))
        {
            var botContext = BotDialogContext.Create(context).EnableShowTyping(isSendTyping, waitTime);

            return(await botContext.ReplyMediaAsync(contentUrl : contentUrl, contentType : contentType, fileName : fileName, suggestedActions : suggestedActions, cancellationToken : cancellationToken));
        }
Пример #15
0
        // 回覆正在打字狀態
        public static ResourceResponse ReplyTyping(this IDialogContext context, int waitTime = 0, bool isSendTyping = false)
        {
            var botContext = BotDialogContext.Create(context).EnableShowTyping(isSendTyping, waitTime);

            return(botContext.ReplyTyping());
        }
Пример #16
0
        public static async Task <ResourceResponse> ReplyMessageAsync(this IDialogContext context, string message, string action, string actionName = null, int waitTime = 0, bool isSendTyping = false, CancellationToken cancellationToken = default(CancellationToken))
        {
            var botContext = BotDialogContext.Create(context).EnableShowTyping(isSendTyping, waitTime);

            return(await botContext.ReplyMessageAsync(message : message, action : action, actionName : actionName, cancellationToken : cancellationToken));
        }
Пример #17
0
        // 回覆訊息
        public static ResourceResponse ReplyMessage(this IDialogContext context, string message, List <CardAction> suggestedActions = null, int waitTime = 0, bool isSendTyping = false)
        {
            var botContext = BotDialogContext.Create(context).EnableShowTyping(isSendTyping, waitTime);

            return(botContext.ReplyMessage(message: message, suggestedActions: suggestedActions));
        }