Skip to content

GramIO API Reference / @gramio/prompt/dist / PromptPluginTypes

Interface: PromptPluginTypes<GlobalData>

Defined in: prompt/index.d.ts:28

Type Parameters

Type ParameterDefault type
GlobalDatanever

Properties

PropertyTypeDescriptionDefined in
promptPromptFunction<GlobalData>Example import { Bot, format, bold } from "gramio"; import { prompt } from "@gramio/prompt"; const bot = new Bot(process.env.token!) .extend(prompt()) .command("start", async (context) => { const answer = await context.prompt( "message", formatWhat's your ${boldname}? ); return context.send(✨ Your name is ${answer.text}); }) .onStart(console.log); bot.start();prompt/index.d.ts:50
waitWaitFunction<GlobalData>Wait for the next event from the user Example .command("start", async (context) => { const answer = await context.wait(); return context.send(✨ Next message after /start command is ${answer.text}); })prompt/index.d.ts:63
waitWithActionWaitWithActionFunction<GlobalData>Wait for the next event from the user Example .command("start", async (context) => { const [answer, message] = await context.waitWithAction("message", () => context.send("ok")); return context.send(✨ Next message after /start command is ${answer.text}); })prompt/index.d.ts:76