Skip to main content
Module

x/grammy_conversations/mod.ts>conversations

Conversational interfaces for grammY
Go to Latest
function conversations
import { conversations } from "https://deno.land/x/grammy_conversations@v1.1.0/mod.ts";

Main installer of the conversations plugin. Call this function and pass the result to bot.use:

bot.use(conversations());

This registers the control panel for conversations which is available through ctx.conversation. After installing this plugin, you are already able to exit conversations, even before registering them.

Moreover, this function is the prerequisite for being able to register the actual conversations which can in turn be entered.

function settings(conversation: MyConversation, ctx: MyContext) {
    // define your conversation here
}
bot.use(createConversation(settings));
bot.command("settings", async (ctx) => {
    await ctx.conversation.enter("settings");
});

Check out the documentation to learn more about how to create conversations.