zaileys 4.11.2 → 4.13.0

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.
@@ -15,18 +15,21 @@ export interface PluginContext {
15
15
  }
16
16
  /** `'poll-vote'` reads as `pollVote()` on a plugin, so the method names stay idiomatic. */
17
17
  type Camel<S extends string> = S extends `${infer Head}-${infer Tail}` ? `${Head}${Capitalize<Camel<Tail>>}` : S;
18
- /** One optional method per inbound event, derived so a new event is available here automatically. */
18
+ /**
19
+ * One optional method per inbound event, derived so a new event is available here automatically.
20
+ * `message` is excluded — on a plugin that name belongs to the command handler.
21
+ */
19
22
  export type PluginEventHandlers = {
20
- [E in keyof InboundEventMap as Camel<E>]?: (payload: InboundEventMap[E], ctx: PluginContext) => void | Promise<void>;
23
+ [E in Exclude<keyof InboundEventMap, 'message'> as Camel<E>]?: (payload: InboundEventMap[E], ctx: PluginContext) => void | Promise<void>;
21
24
  };
22
25
  /** Every inbound event name, in the order their methods are wired up. */
23
- export declare const INBOUND_EVENTS: readonly ["message", "text", "image", "video", "audio", "document", "sticker", "reaction", "edit", "delete", "poll-vote", "button-click", "list-select", "mention", "mention-all", "group-update", "group-join", "group-leave", "member-tag", "call-incoming", "call-ended", "history-sync", "limited", "presence", "newsletter"];
26
+ export declare const INBOUND_EVENTS: readonly ["text", "image", "video", "audio", "document", "sticker", "reaction", "edit", "delete", "poll-vote", "button-click", "list-select", "mention", "mention-all", "group-update", "group-join", "group-leave", "member-tag", "call-incoming", "call-ended", "history-sync", "limited", "presence", "newsletter"];
24
27
  export type Plugin = CommandMeta & CommandGuards & PluginEventHandlers & {
25
28
  /** Identifies the plugin, and names the command that `command()` handles. */
26
29
  name: string;
27
30
  aliases?: string[];
28
31
  /** Handles the command named after this plugin. The metadata above describes it. */
29
- command?: (ctx: Parameters<CommandHandler>[0], plugin: PluginContext) => void | Promise<void>;
32
+ message?: (ctx: Parameters<CommandHandler>[0], plugin: PluginContext) => void | Promise<void>;
30
33
  /** Escape hatch for what the methods above cannot express: extra commands, middleware, cleanup. */
31
34
  setup?(ctx: PluginContext): void | (() => void) | Promise<void | (() => void)>;
32
35
  onUnload?(): void | Promise<void>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zaileys",
3
3
  "description": "Zaileys - Simplified WhatsApp Node.js TypeScript/JavaScript API",
4
- "version": "4.11.2",
4
+ "version": "4.13.0",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "./dist/index.cjs",