示例#1
0
 protected override async Task OnMembersAddedAsync(
     IList <ChannelAccount> membersAdded,
     ITurnContext <IConversationUpdateActivity> turnContext,
     CancellationToken cancellationToken
     )
 {
     await turnContext.SendActivityAsync(
         activity : JPSBotUtility.GetDefaultMessageActivity(),
         cancellationToken : cancellationToken
         );
 }
示例#2
0
        /// <summary>
        /// Validates if the Lottery Number is a positive integer
        /// </summary>
        /// <param name="promptValidatorContext"></param>
        /// <param name="cancellationToken"></param>
        /// <returns>If it is valid or not</returns>
        private async Task <bool> LotteryNumberValidation(
            PromptValidatorContext <int> promptValidatorContext, CancellationToken cancellationToken)
        {
            var lotteryNumberEntered = promptValidatorContext.Recognized.Value;

            if (!promptValidatorContext.Recognized.Succeeded || lotteryNumberEntered < 0)
            {
                await promptValidatorContext.Context.SendActivityAsync(
                    activity : JPSBotUtility.GetEnterAValidLotteryNumberMsgActivity(),
                    cancellationToken : cancellationToken
                    );

                return(false);
            }

            return(true);
        }
示例#3
0
        /// <summary>
        /// Validates if the Fraction Serie is a number between 0 and 999.
        /// </summary>
        /// <param name="promptValidatorContext"></param>
        /// <param name="cancellationToken"></param>
        /// <returns>If it is valid or not</returns>
        private async Task <bool> FractionSerieValidation(
            PromptValidatorContext <int> promptValidatorContext, CancellationToken cancellationToken)
        {
            var serieEntered = promptValidatorContext.Recognized.Value;

            if (!promptValidatorContext.Recognized.Succeeded || serieEntered < 0 || serieEntered > 999)
            {
                await promptValidatorContext.Context.SendActivityAsync(
                    activity : JPSBotUtility.GetEnterAValidFractionSerieMsgActivity(),
                    cancellationToken : cancellationToken
                    );

                return(false);
            }

            return(true);
        }
示例#4
0
        private async Task <DialogTurnResult> CheckIfTheUserWantsToConsult(
            WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var userMessage = stepContext.Context.Activity.Text.ToLower();

            if (!string.IsNullOrEmpty(userMessage) &&
                (userMessage.Contains("consultar") || userMessage.Contains("sorteo")))
            {
                return(await stepContext.NextAsync());
            }

            await stepContext.Context.SendActivityAsync(
                activity : JPSBotUtility.GetDefaultMessageActivity(),
                cancellationToken : cancellationToken
                );

            return(await stepContext.EndDialogAsync());
        }