Ejemplo n.º 1
0
    async def on_prompt(self, turn_context: TurnContext, state: Dict[str,
                                                                     object],
                        options: PromptOptions, is_retry: bool):
        if not turn_context:
            raise TypeError(
                'ConfirmPrompt.on_prompt(): turn_context cannot be None.')
        if not options:
            raise TypeError(
                'ConfirmPrompt.on_prompt(): options cannot be None.')

        # Format prompt to send
        channel_id = turn_context.activity.channel_id
        culture = self.determine_culture(turn_context.activity)
        defaults = self.choice_defaults[culture]
        choice_opts = self.choice_options if self.choice_options != None else defaults[
            2]
        confirms = self.confirm_choices if self.confirm_choices != None else (
            defaults[0], defaults[1])
        choices = {confirms[0], confirms[1]}
        if is_retry == True and options.retry_prompt != None:
            prompt = self.append_choices(options.retry_prompt)
        else:
            prompt = self.append_choices(options.prompt, channel_id, choices,
                                         self.style, choice_opts)
        turn_context.send_activity(prompt)
Ejemplo n.º 2
0
 async def on_prompt(self, turn_context: TurnContext, state: Dict[str, object], options: PromptOptions, is_retry: bool):
     if not turn_context:
         raise TypeError('NumberPrompt.on_prompt(): turn_context cannot be None.')
     if not options:
         raise TypeError('NumberPrompt.on_prompt(): options cannot be None.')
     
     if is_retry == True and options.retry_prompt != None:
         prompt = turn_context.send_activity(options.retry_prompt)  
     else:
         if options.prompt != None:
             turn_context.send_activity(options.prompt)
Ejemplo n.º 3
0
    async def on_prompt(
        self,
        turn_context: TurnContext,
        state: Dict[str, object],
        options: PromptOptions,
        is_retry: bool,
    ):
        if not turn_context:
            raise TypeError(
                "NumberPrompt.on_prompt(): turn_context cannot be None.")
        if not options:
            raise TypeError(
                "NumberPrompt.on_prompt(): options cannot be None.")

        if is_retry and options.retry_prompt is not None:
            turn_context.send_activity(options.retry_prompt)
        elif options.prompt is not None:
            await turn_context.send_activity(options.prompt)