aurival 0.2.0 → 0.3.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.
package/README.md CHANGED
@@ -74,14 +74,22 @@ machine you revoke; a leaked token would be the bot.
74
74
  bot.command('say', async (ctx) => {
75
75
  ctx.command; // "say"
76
76
  ctx.arguments; // the raw rest of the line, unparsed, possibly ""
77
- ctx.chat; // { id, type, name }
78
- ctx.sender; // { id, handle, name }
77
+ ctx.chat; // { id, type, name, member_count }
78
+ ctx.sender; // { id, handle, name } — always set
79
79
  ctx.message.text; // "/say hi" — the invoking message, verbatim
80
80
  await ctx.reply('…');
81
81
  });
82
82
  ```
83
83
 
84
- `ctx.message` is now the invoking message itself: `ctx.message.id`, `.text`, `.sent_at`, `.sender`, and `.reply_to` (the id of the message it quoted, or `null`) — or, for an event that carries none, `ctx.message` itself is `null` and none of those fields are reachable. `ctx.reply()` still quotes it by id, so an answer never floats free in a busy chat. There is no flag: on the rare event that carries no message id it sends a plain message instead.
84
+ `ctx.message` is the invoking message itself: `ctx.message.id`, `.text`, `.sent_at`, `.sender`,
85
+ and `.reply_to` (the id of the message it quoted, or `null`). `ctx.reply()` quotes it by id, so
86
+ an answer never floats free in a busy chat. On an event that is about no message — someone
87
+ joining, someone adding the bot — there is nothing to quote and the reply is sent plain. There
88
+ is no flag for it: the context knows which message its event is about, or knows there is none.
89
+
90
+ `ctx.chat.member_count` is the chat's live participant count, bots included. It is a number on
91
+ every event the server sends today, and `null` only on a frame that omitted it — never
92
+ defaulted to 0, because a genuinely empty chat is still a number.
85
93
 
86
94
  Handlers run concurrently, and an event is acked only after its handler settles — so a
87
95
  crash mid-handler redelivers rather than loses. **Do not block inside a handler.** A
@@ -110,70 +118,88 @@ goes through `bot.on(type, fn)`:
110
118
 
111
119
  ```ts
112
120
  bot.on('member.joined', async (ctx) => {
113
- await ctx.send(ctx.chat.id, `welcome, ${ctx.user?.handle}`);
121
+ await ctx.send(ctx.chat, `welcome, ${ctx.user.handle}`);
114
122
  });
115
123
 
116
124
  bot.on('member.left', async (ctx) => {
117
- console.log(ctx.user?.handle, 'left', ctx.chat.id);
125
+ console.log(ctx.user.handle, 'left', ctx.chat.id);
118
126
  });
119
127
 
120
128
  bot.on('bot.added', async (ctx) => {
121
- await ctx.send(ctx.chat.id, `thanks for adding me, ${ctx.actor?.handle}`);
129
+ await ctx.send(ctx.chat, `thanks for adding me, ${ctx.actor.handle}`);
122
130
  });
123
131
 
124
132
  bot.on('bot.removed', async (ctx) => {
125
- console.log(ctx.actor?.handle, 'removed me from', ctx.chat.id);
133
+ console.log(ctx.actor.handle, 'removed me from', ctx.chat.id);
126
134
  });
127
135
 
128
136
  bot.on('reaction.added', async (ctx) => {
129
- console.log(ctx.sender?.handle, 'reacted', ctx.emoji, 'on', ctx.message?.id);
137
+ console.log(ctx.sender.handle, 'reacted', ctx.emoji, 'on', ctx.message.id);
130
138
  });
131
139
  ```
132
140
 
133
- One `Context` for every event type. Only the fields that event actually carries are
134
- populated — everything else is `null`:
141
+ None of those handlers annotates `ctx`. The event name is what picks the class, so the editor
142
+ offers the five names as you type `bot.on('`, and then knows what `ctx` holds. A handler
143
+ defined somewhere else names its class itself:
144
+
145
+ ```ts
146
+ import type { MemberContext } from 'aurival';
147
+
148
+ async function onLeft(ctx: MemberContext): Promise<void> {
149
+ console.log(ctx.user.handle, 'left', ctx.chat.id);
150
+ }
135
151
 
136
- | event | `ctx.chat` | `ctx.sender` | `ctx.user` | `ctx.actor` | `ctx.message` | `ctx.emoji` |
137
- | ----------------- | ---------- | ------------ | ---------- | ----------- | ------------- | ----------- |
138
- | `command.invoked` | ✓ | ✓ | | | ✓ | |
139
- | `member.joined` | ✓ | | ✓ | | | |
140
- | `member.left` | ✓ | | ✓ | | | |
141
- | `bot.added` | ✓ | | | ✓ | | |
142
- | `bot.removed` | ✓ | | | ✓ | | |
143
- | `reaction.added` | ✓ | ✓ | | | ✓ | ✓ |
152
+ bot.on('member.left', onLeft);
153
+ ```
144
154
 
145
- An event type this SDK does not know about yet is never fatal — `bot.on()` a type the
146
- server hasn't invented yet and, if it starts sending it, the handler runs with whatever
147
- fields it happens to carry. There is no `reaction.removed` event: un-reacting is silent.
155
+ | event | `ctx` | beside `ctx.chat` and `ctx.event` |
156
+ | ------------------------------- | ----------------- | ----------------------------------------------------------------- |
157
+ | `command.invoked` | `Context` | `command`, `arguments`, `sender`, `message` |
158
+ | `member.joined` / `member.left` | `MemberContext` | `user` |
159
+ | `bot.added` / `bot.removed` | `BotContext` | `actor` |
160
+ | `reaction.added` | `ReactionContext` | `sender`, `message` (id only, the text is not re-sent), `emoji` |
161
+ | anything else | `EventContext` | `sender`, `user`, `actor`, `message`, `emoji` — each one nullable |
162
+
163
+ Each class carries only its own family's fields, and every one of them is set. That is the
164
+ whole point: your editor tells you what `ctx` has, so you never read a doc to find out, and
165
+ you never guard a field that is always there. `ctx.emoji` in a member handler is a compile
166
+ error rather than a runtime `undefined`, and so is a `bot.added` handler registered for
167
+ `member.joined`.
168
+
169
+ An event type this SDK does not know about yet is never fatal — `bot.on()` a type the server
170
+ hasn't invented yet and, if it starts sending it, the handler runs with an `EventContext`
171
+ holding whatever fields the frame happened to carry. Nothing is pinned there, so everything is
172
+ nullable and you narrow before you read. There is no `reaction.removed` event: un-reacting is
173
+ silent.
148
174
 
149
175
  ## Actions
150
176
 
151
- Every action is available on a handler's `ctx`. `ctx.chat.member_count` carries the chat's
152
- live participant count, so you don't need a separate call to know how many people are in it:
177
+ Every action is available on a handler's `ctx`, whichever class it is — they live on the shared
178
+ base, so `ctx.reply()` reads the same in a command as in a `member.joined`.
153
179
 
154
180
  ```ts
155
- bot.command('busy', async (ctx) => {
156
- await ctx.withTyping(async () => {
157
- // ... slow work, e.g. calling out to another service ...
158
- await ctx.reply(`done, and there are ${ctx.chat.member_count} of us in here`);
159
- });
160
- });
161
-
162
181
  bot.command('fix', async (ctx) => {
163
- const sent = await ctx.reply('working on it...');
164
- await ctx.edit(String(sent['id']), 'done!');
182
+ const sent = await ctx.reply('working on it…');
183
+ await ctx.edit(sent, 'done!');
165
184
  });
166
185
 
167
186
  bot.command('oops', async (ctx) => {
168
- if (ctx.message) await ctx.delete(ctx.message);
187
+ await ctx.delete(ctx.message);
169
188
  });
170
189
 
171
190
  bot.command('upvote', async (ctx) => {
172
- if (ctx.message) await ctx.react(ctx.message, '\u{1F44D}');
191
+ await ctx.react(ctx.message, '\u{1F44D}');
173
192
  });
174
193
 
175
194
  bot.command('downvote', async (ctx) => {
176
- if (ctx.message) await ctx.unreact(ctx.message, '\u{1F44D}');
195
+ await ctx.unreact(ctx.message, '\u{1F44D}');
196
+ });
197
+
198
+ bot.command('busy', async (ctx) => {
199
+ await ctx.withTyping(async () => {
200
+ // ... slow work, e.g. calling out to another service ...
201
+ await ctx.reply(`done, and there are ${ctx.chat.member_count} of us in here`);
202
+ });
177
203
  });
178
204
 
179
205
  bot.command('roster', async (ctx) => {
@@ -182,18 +208,29 @@ bot.command('roster', async (ctx) => {
182
208
  // (CONTRACT-V1 §4), and inferring "more pages" from the cursor is exactly
183
209
  // the off-by-one every other SDK ships.
184
210
  const handles: string[] = [];
185
- let cursor: string | undefined;
211
+ let cursor: string | null = null;
186
212
  for (;;) {
187
- const page = await ctx.members(undefined, { cursor });
213
+ const page = await ctx.members(undefined, cursor === null ? {} : { cursor });
188
214
  handles.push(...page.users.map((u) => u.handle));
189
215
  if (!page.hasMore) break;
190
- cursor = page.nextCursor ?? undefined;
216
+ cursor = page.nextCursor;
191
217
  }
192
218
  await ctx.reply(handles.join(', '));
193
219
  });
194
220
  ```
195
221
 
196
- `ctx.typing(true | false)` and `ctx.withTyping(fn)` toggle the typing indicator — `withTyping`
222
+ `reply()`, `send()` and `edit()` return the message they stored, so `sent` is what you hand
223
+ straight back to `edit()`, `delete()` and `react()` — no id juggling. The `sender` on one of
224
+ those, when it is set at all, is known by id alone — `handle` and `name` are empty strings,
225
+ because the REST entity names the sender with a bare `usr_…`.
226
+
227
+ The typing indicator is automatic: a command handler still running 300 ms after it started
228
+ shows the chat "is thinking", and the indicator clears when the handler returns, including on a
229
+ throw. A handler that replies inside those 300 ms sends nothing, so a fast bot never flickers.
230
+ `new Bot({ autoTyping: false })` turns it off if you would rather drive `ctx.withTyping()`
231
+ yourself.
232
+
233
+ `ctx.typing(true | false)` and `ctx.withTyping(fn)` toggle the indicator by hand — `withTyping`
197
234
  sends `true` on entry and `false` on exit, always, even if `fn` throws.
198
235
 
199
236
  `@`-mention someone with `mention(user)` — it template-literals straight into `text` as
@@ -202,28 +239,46 @@ sends `true` on entry and `false` on exit, always, even if `fn` throws.
202
239
  ```ts
203
240
  import { mention } from 'aurival';
204
241
 
242
+ bot.on('member.joined', async (ctx) => {
243
+ const who = mention(ctx.user);
244
+ await ctx.send(ctx.chat, `welcome, ${who}!`, { mentions: [who] });
245
+ });
246
+ ```
247
+
248
+ ## Upgrading from 0.2.x
249
+
250
+ There is one `Context` per event family now, instead of one class for every event with most of
251
+ its fields `null`. Three things change in code you already wrote.
252
+
253
+ `ctx.sender` in a command handler is a `User` again, not `User | null`. The narrowing 0.2.0
254
+ asked for was an artefact of the shared class — the server never sends a command without a
255
+ sender, and now the type says so. Drop the guard:
256
+
257
+ ```ts
205
258
  bot.command('thanks', async (ctx) => {
206
- if (!ctx.sender) return; // no sender on this event type — nothing to thank
207
- await ctx.send(ctx.chat, `thanks, ${mention(ctx.sender)}!`, {
208
- mentions: [mention(ctx.sender)],
209
- });
259
+ // 0.2.x — if (!ctx.sender) return;
260
+ await ctx.reply(`thanks, ${ctx.sender.handle}!`);
210
261
  });
211
262
  ```
212
263
 
213
- > **0.2.0 breaking change:** `ctx.sender` is now `User | null` (was `User`). The single
214
- > `Context` class is shared across every event type, and `sender` is genuinely absent on
215
- > `member.joined`/`member.left`/`bot.added`/`bot.removed` (see the table above) — so it can
216
- > no longer be typed as always-present. Narrow it before use:
217
- >
218
- > ```ts
219
- > // 0.1.x — ctx.sender.handle compiled unconditionally.
220
- > console.log(ctx.sender.handle);
221
- >
222
- > // 0.2.0 — narrow first (an early return, as in the `thanks` example above,
223
- > // or an `if (ctx.sender)` guard around the rest of the handler).
224
- > if (!ctx.sender) return;
225
- > console.log(ctx.sender.handle);
226
- > ```
264
+ `ctx.user`, `ctx.actor` and `ctx.emoji` no longer exist on `Context`. They live on the class for
265
+ the family that actually delivers them, where they are never `null`, so an optional read becomes
266
+ a plain one:
267
+
268
+ ```ts
269
+ bot.on('member.joined', async (ctx) => {
270
+ // 0.2.x — ctx.user?.handle
271
+ console.log(ctx.user.handle, 'joined');
272
+ });
273
+ ```
274
+
275
+ `Context.fromGenericEvent()` is gone, and nothing replaces it. Choosing the class for an event
276
+ is the SDK's job, not yours — where 0.2.x called `Context.fromGenericEvent(event, http)`, 0.3.0
277
+ calls nothing, because `bot.on()` hands your handler the right context already built.
278
+
279
+ One thing that is not a break, but is worth knowing if you pinned to it: `version` reports
280
+ `'0.3.0'`. In 0.2.1 it still said `'0.2.0'`, which was simply wrong; a test pins it to
281
+ `package.json` now, so it cannot drift again.
227
282
 
228
283
  ## Shadowed commands
229
284
 
@@ -265,6 +320,11 @@ try {
265
320
  }
266
321
  ```
267
322
 
323
+ A `rate_limited` reply is retried for you, up to five attempts, as long as `retry_after` is
324
+ 15 seconds or less. Past that (0.2.1) the error is thrown at once instead of slept through:
325
+ a handler that sleeps for minutes holds its event unacknowledged for the whole wait, and the
326
+ server redelivers behind it.
327
+
268
328
  `KeyRevoked`, `SessionSuperseded` and `BotSuspended` end the process on purpose — each one
269
329
  means something a reconnect cannot fix. Everything else the SDK handles for you: token
270
330
  expiry, deploys, network faults, redelivery.
@@ -285,7 +345,7 @@ and "zero runtime dependencies" could not both be true.
285
345
 
286
346
  ```
287
347
  $ npm ls --omit=dev
288
- aurival@0.2.0
348
+ aurival@0.3.0
289
349
  └── (empty)
290
350
  ```
291
351
 
package/dist/bot.d.ts CHANGED
@@ -3,14 +3,24 @@ import { KeyFile } from './auth.js';
3
3
  import type { Machine, MachineKey } from './auth.js';
4
4
  import { Context, Event } from './events.js';
5
5
  import { HttpClient } from './http.js';
6
+ import type { AnyContext, BotContext, BotEventType, EventContext, MemberContext, MemberEventType, ReactionContext, ReactionEventType } from './events.js';
6
7
  import type { Logger } from './http.js';
8
+ /** A `bot.command()` handler. */
7
9
  export type Handler = (ctx: Context) => Promise<void> | void;
10
+ /** A `member.joined` / `member.left` handler. */
11
+ export type MemberHandler = (ctx: MemberContext) => Promise<void> | void;
12
+ /** A `bot.added` / `bot.removed` handler. */
13
+ export type BotHandler = (ctx: BotContext) => Promise<void> | void;
14
+ /** A `reaction.added` handler. */
15
+ export type ReactionHandler = (ctx: ReactionContext) => Promise<void> | void;
16
+ /** A handler for an event type this SDK does not name — every field optional. */
17
+ export type EventHandler = (ctx: EventContext) => Promise<void> | void;
8
18
  /**
9
19
  * The hook also receives a `backlog.overflowed` Event, which is operational
10
20
  * rather than an error — it never reaches a handler (SDK-28).
11
21
  */
12
22
  export type Reportable = unknown | Event;
13
- export type ErrorHook = (error: Reportable, ctx: Context | null) => Promise<void> | void;
23
+ export type ErrorHook = (error: Reportable, ctx: AnyContext | null) => Promise<void> | void;
14
24
  /** How long a clean shutdown waits for handlers that are still running (SDK-32). */
15
25
  export declare const SHUTDOWN_GRACE_MS = 10000;
16
26
  export declare const MAX_COMMANDS = 50;
@@ -20,7 +30,21 @@ export interface BotOptions {
20
30
  logger?: Logger | undefined;
21
31
  /** Silences the `aurival: …` status banners on stderr. `AURIVAL_QUIET=1` does the same. */
22
32
  quiet?: boolean | undefined;
33
+ /**
34
+ * Auto-typing (SDK-41). A command handler still running after
35
+ * {@link AUTO_TYPING_DELAY_MS} shows the chat "is thinking", and the
36
+ * indicator is cleared when the handler returns. A handler that replies
37
+ * inside the delay sends nothing, so a fast bot never flickers. `false`
38
+ * keeps typing entirely in your hands (`ctx.withTyping()`). Default `true`.
39
+ */
40
+ autoTyping?: boolean | undefined;
23
41
  }
42
+ /**
43
+ * How long a command handler runs before the chat is told the bot is thinking
44
+ * (SDK-41). Long enough that an ordinary reply never trips it, short enough
45
+ * that a slow one reads as work in progress rather than silence.
46
+ */
47
+ export declare const AUTO_TYPING_DELAY_MS = 300;
24
48
  /**
25
49
  * Load the key file, or pair this machine and save one.
26
50
  *
@@ -68,12 +92,17 @@ export declare class Bot {
68
92
  command(name: string, handler: Handler): void;
69
93
  command(name: string, description: string, handler: Handler): void;
70
94
  /**
71
- * Register a handler for any event type other than `command.invoked` (use
72
- * `command()` for that) — `member.joined`, `member.left`, `bot.added`,
73
- * `bot.removed`, `reaction.added`, or a future type this SDK does not yet
74
- * name. Many handlers may share one type; each runs in the order it was
75
- * registered (matches python), and the event is acked once, after every
76
- * handler for it has settled.
95
+ * Register a handler for an event. Which context the handler gets follows
96
+ * from the type, and your editor knows it (BA-R68):
97
+ *
98
+ * - `member.joined` / `member.left` → `MemberContext` (`ctx.user`)
99
+ * - `bot.added` / `bot.removed` → `BotContext` (`ctx.actor`)
100
+ * - `reaction.added` → `ReactionContext` (`ctx.sender`, `ctx.message`, `ctx.emoji`)
101
+ * - any other string → `EventContext` (everything optional)
102
+ *
103
+ * `command.invoked` goes through `command()`. Many handlers may share one
104
+ * type; each runs in the order it was registered (matches python), and
105
+ * the event is acked once, after every handler for it has settled.
77
106
  *
78
107
  * Throws immediately, before any registration, for the two types that are
79
108
  * STRUCTURALLY undispatchable through `on()`: `command.invoked` (never
@@ -86,7 +115,10 @@ export declare class Bot {
86
115
  * because the wire hasn't sent it yet would be a forward-compatibility
87
116
  * trap — the handler just never fires until/unless that changes.
88
117
  */
89
- on(type: string, handler: Handler): void;
118
+ on(type: MemberEventType, handler: MemberHandler): void;
119
+ on(type: BotEventType, handler: BotHandler): void;
120
+ on(type: ReactionEventType, handler: ReactionHandler): void;
121
+ on(type: string & {}, handler: EventHandler): void;
90
122
  /**
91
123
  * Called with (error, context | null) for anything the SDK caught for you: a
92
124
  * handler that threw, a `problem` frame, a backlog overflow.
package/dist/bot.d.ts.map CHANGED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EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAUnE;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IACxD,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IAClD,EAAE,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IAG5D,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,EAAE,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IAWnD;;;OAGG;IACH,OAAO,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,CAE3B;IAID,iFAAiF;IAC3E,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAuBzB;IAEK,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA6C/C;CAwMF"}
package/dist/bot.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /** The developer-facing surface: declare commands, call run(), we hold the socket. */
2
2
  import { Auth, KeyFile, machineLabel, pair, resolveHost } from './auth.js';
3
3
  import { AurivalError, BotSuspended, RateLimitError, SessionSuperseded } from './errors.js';
4
- import { Context, Event } from './events.js';
4
+ import { Context, Event, contextFor } from './events.js';
5
5
  import { DEFAULT_HOST, HttpClient, defaultLogger } from './http.js';
6
6
  import { EVENT_BACKLOG_OVERFLOWED, EVENT_COMMAND_INVOKED, Socket } from './socket.js';
7
7
  import * as status from './status.js';
@@ -24,6 +24,13 @@ export const SHUTDOWN_GRACE_MS = 10_000;
24
24
  // but catching it here means a bot author sees this line instead of a 400
25
25
  // deep inside a sync call, and before we have made any network call at all.
26
26
  export const MAX_COMMANDS = 50;
27
+ /**
28
+ * How long a command handler runs before the chat is told the bot is thinking
29
+ * (SDK-41). Long enough that an ordinary reply never trips it, short enough
30
+ * that a slow one reads as work in progress rather than silence.
31
+ */
32
+ export const AUTO_TYPING_DELAY_MS = 300;
33
+ const noAutoTyping = { stop: async () => undefined };
27
34
  // Mirrors the server's own normalisation (commands.go) so `Ping` finds the
28
35
  // handler for the `ping` that comes back on the wire. Not validation.
29
36
  function lookupKey(name) {
@@ -110,11 +117,13 @@ export class Bot {
110
117
  #errorHook = null;
111
118
  #http = null;
112
119
  #quiet;
120
+ #autoTyping;
113
121
  constructor(options = {}) {
114
122
  this.#log = options.logger ?? defaultLogger();
115
123
  this.#host = options.host;
116
124
  this.#keyPath = options.keyPath;
117
125
  this.#quiet = status.isQuiet(options.quiet);
126
+ this.#autoTyping = options.autoTyping ?? true;
118
127
  }
119
128
  command(name, second, third) {
120
129
  const description = typeof second === 'string' ? second : '';
@@ -126,25 +135,6 @@ export class Bot {
126
135
  status.duplicateCommand(name, this.#quiet);
127
136
  this.#registered.set(key, { command: { name, description }, handler });
128
137
  }
129
- /**
130
- * Register a handler for any event type other than `command.invoked` (use
131
- * `command()` for that) — `member.joined`, `member.left`, `bot.added`,
132
- * `bot.removed`, `reaction.added`, or a future type this SDK does not yet
133
- * name. Many handlers may share one type; each runs in the order it was
134
- * registered (matches python), and the event is acked once, after every
135
- * handler for it has settled.
136
- *
137
- * Throws immediately, before any registration, for the two types that are
138
- * STRUCTURALLY undispatchable through `on()`: `command.invoked` (never
139
- * dispatched here — use `command()`) and `backlog.overflowed` (never
140
- * dispatched to any handler, by contract). A handler that truly can never
141
- * run is exactly the silent footgun this check exists to catch at
142
- * registration time. `reaction.removed` is NOT refused: it does not exist
143
- * on the wire today (AMENDMENT-04 A-2.1, un-reacting is silent), but that
144
- * is a today-fact, not a structural one, and refusing a type merely
145
- * because the wire hasn't sent it yet would be a forward-compatibility
146
- * trap — the handler just never fires until/unless that changes.
147
- */
148
138
  on(type, handler) {
149
139
  const reason = NEVER_DISPATCHED_TO_ON.get(type);
150
140
  if (reason !== undefined) {
@@ -327,6 +317,7 @@ export class Bot {
327
317
  if (this.#http === null)
328
318
  return;
329
319
  const ctx = Context.fromEvent(event, this.#http);
320
+ const typing = this.#startAutoTyping(ctx);
330
321
  try {
331
322
  await registered.handler(ctx);
332
323
  }
@@ -335,6 +326,37 @@ export class Bot {
335
326
  this.#log.error(`handler for ${JSON.stringify(name)} threw: ${exc instanceof Error ? (exc.stack ?? exc.message) : String(exc)}`);
336
327
  await this.#callErrorHook(exc, ctx);
337
328
  }
329
+ finally {
330
+ await typing.stop();
331
+ }
332
+ }
333
+ // -- auto-typing (SDK-41) ------------------------------------------------
334
+ #startAutoTyping(ctx) {
335
+ if (!this.#autoTyping || ctx.chat.id === '')
336
+ return noAutoTyping;
337
+ // Once the timer fires the start request is in flight and may already be
338
+ // applied server-side, so stop() awaits it and clears, rather than
339
+ // abandoning a request it cannot take back. Typing is best-effort: a
340
+ // failure is a debug line, never the reply's problem.
341
+ let sent = null;
342
+ const timer = setTimeout(() => {
343
+ sent = ctx.typing(true).then(() => true, (exc) => {
344
+ this.#log.debug(`auto typing start failed: ${exc instanceof Error ? exc.message : String(exc)}`);
345
+ return false;
346
+ });
347
+ }, AUTO_TYPING_DELAY_MS);
348
+ return {
349
+ stop: async () => {
350
+ clearTimeout(timer);
351
+ if (sent === null)
352
+ return;
353
+ if (!(await sent))
354
+ return;
355
+ await ctx.typing(false).catch((exc) => {
356
+ this.#log.debug(`auto typing stop failed: ${exc instanceof Error ? exc.message : String(exc)}`);
357
+ });
358
+ },
359
+ };
338
360
  }
339
361
  /**
340
362
  * `member.joined`/`left`, `bot.added`/`removed`, `reaction.added`, or any
@@ -356,7 +378,7 @@ export class Bot {
356
378
  }
357
379
  if (this.#http === null)
358
380
  return;
359
- const ctx = Context.fromGenericEvent(event, this.#http);
381
+ const ctx = contextFor(event, this.#http);
360
382
  for (const handler of handlers) {
361
383
  try {
362
384
  await handler(ctx);
package/dist/bot.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bot.js","sourceRoot":"","sources":["../src/bot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