fbradyirl / webex_bot

Python package for a Webex Bot based on websockets.
MIT License
68 stars 44 forks source link

How to do multi-post responses #47

Closed jbjornson closed 8 months ago

jbjornson commented 8 months ago

Description

You mention in the documentation, that Webex BOT "allows for single or multi-post responses". How can you make multi-post responses?

What I Did

from webex_bot.webex_bot import WebexBot
from webex_bot.models.command import Command

class MyBot(Command):
    def __init__(self, important_parameter):
        super().__init__(
            command_keyword="my-command-name",
            help_message="my command description",
            card=None,
        )
        self.important_parameter = important_parameter

    def pre_execute(self, message, attachment_actions, activity):
        return "This could take a minute..."

    def execute(self, message: str, attachment_actions: list, activity):    
        for long_message in self.important_parameter.do_something(message.strip()):
            # How can I respond multiple times here????
        return ???
jbjornson commented 8 months ago

Ok, I figured it out after looking at the source code and it's simple - just return a list from command. execute. It would be very helpful if you specifically mention this in the README.