@yaebal/prompt 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import type { Context, FormatResult, Message, Plugin } from "@yaebal/core";
2
- /** handles the message that answers a prompt. may call `ctx.prompt` again to chain. */
3
- export type PromptHandler = (ctx: Context) => unknown | Promise<unknown>;
4
2
  export interface PromptControl {
5
3
  /** send `question`, then run `handler` on the next message in this chat. */
6
4
  prompt(question: string | FormatResult, handler: PromptHandler, extra?: Record<string, unknown>): Promise<Message>;
7
5
  }
6
+ /** handles the message that answers a prompt. may call `ctx.prompt` again to chain. */
7
+ export type PromptHandler = (ctx: Context & PromptControl) => unknown | Promise<unknown>;
8
8
  export interface PromptOptions {
9
9
  /** prompt key for an update. defaults to per-chat (`ctx.chat.id`). */
10
10
  getKey?: (ctx: Context) => string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3E,uFAAuF;AACvF,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEzE,MAAM,WAAW,aAAa;IAC7B,4EAA4E;IAC5E,MAAM,CACL,QAAQ,EAAE,MAAM,GAAG,YAAY,EAC/B,OAAO,EAAE,aAAa,EACtB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAAC,OAAO,CAAC,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC7B,sEAAsE;IACtE,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAC;CAC9C;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,OAAO,GAAE,aAAkB,GAAG,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,CAmClF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3E,MAAM,WAAW,aAAa;IAC7B,4EAA4E;IAC5E,MAAM,CACL,QAAQ,EAAE,MAAM,GAAG,YAAY,EAC/B,OAAO,EAAE,aAAa,EACtB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAAC,OAAO,CAAC,CAAC;CACpB;AAED,uFAAuF;AACvF,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEzF,MAAM,WAAW,aAAa;IAC7B,sEAAsE;IACtE,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAC;CAC9C;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,OAAO,GAAE,aAAkB,GAAG,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,CAmClF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaebal/prompt",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "yaebal prompt plugin — ask a question and handle the next message.",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -16,7 +16,7 @@
16
16
  "src"
17
17
  ],
18
18
  "dependencies": {
19
- "@yaebal/core": "0.0.1"
19
+ "@yaebal/core": "0.0.2"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/node": "latest"
package/src/index.ts CHANGED
@@ -1,8 +1,5 @@
1
1
  import type { Context, FormatResult, Message, Plugin } from "@yaebal/core";
2
2
 
3
- /** handles the message that answers a prompt. may call `ctx.prompt` again to chain. */
4
- export type PromptHandler = (ctx: Context) => unknown | Promise<unknown>;
5
-
6
3
  export interface PromptControl {
7
4
  /** send `question`, then run `handler` on the next message in this chat. */
8
5
  prompt(
@@ -12,6 +9,9 @@ export interface PromptControl {
12
9
  ): Promise<Message>;
13
10
  }
14
11
 
12
+ /** handles the message that answers a prompt. may call `ctx.prompt` again to chain. */
13
+ export type PromptHandler = (ctx: Context & PromptControl) => unknown | Promise<unknown>;
14
+
15
15
  export interface PromptOptions {
16
16
  /** prompt key for an update. defaults to per-chat (`ctx.chat.id`). */
17
17
  getKey?: (ctx: Context) => string | undefined;