Skip to content

Dialog #92

Description

@PenguinBoi12

There is no built-in way to hold a multi-step conversation. Developers who need to collect several pieces of information from a user in sequence have to manage state and event listeners by hand.

The idea is to introduce a @bot.dialog() decorator that provides a structured async API for step-by-step interactions. A dialog would expose ctx.ask() to send a prompt and ctx.next_message() to await the user's next reply in the same room, keeping the conversational state encapsulated in a single coroutine.

Proposed API

@bot.dialog("setup")
async def setup_dialog(ctx):
    name = await ctx.ask("What's your name?")
    await ctx.reply(f"Nice to meet you, {name}!")

The main design challenges are timeout handling (what happens if the user never replies), cancellation (the user starts a second dialog mid-way), and isolation (messages from other users in the same room should not be captured as answers). A timeout parameter on the decorator and a room+sender keyed wait queue on the bot are the most likely implementation paths. Also worth considering: whether dialogs should be re-entrant or exclusive per user per room.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions