# @oshun/telegram-bot

Telegram bot library over the V1 messaging-channel policy core.

**Not a deployed service.** There is no server entrypoint and nothing starts
this package — the live inbound Telegram path is the BFF webhook
(`apps/oshun/bff/src/routes/telegram.ts`). It is kept for the one thing a
webhook cannot do: **long polling**, which needs no public HTTPS address, so a
local loop against real Telegram (or a no-ingress deployment) is possible.

If it is ever stood up it must be a **thin client of the BFF**: the stores
behind the rooms/reminders/effects ports are in-memory singletons in the BFF
process, so a second process gets its own empty copies and would silently
disagree with the web app. See the header of `src/index.ts`.

## Scripts

| Command          | Definition                     |
| ---------------- | ------------------------------ |
| `pnpm build`     | tsc -p tsconfig.json           |
| `pnpm typecheck` | tsc -p tsconfig.json --noEmit  |
| `pnpm test`      | vitest run -c vitest.config.ts |

## Layout

- `src/`

## Working on this package

The fastest local loop is via Nx:

```bash
pnpm nx test oshun-telegram-bot
pnpm nx lint oshun-telegram-bot
pnpm nx build oshun-telegram-bot
```

When Nx is unhappy (usually because another worktree has duplicate project
names), bypass it with the underlying tools from this directory:

```bash
npx tsc --noEmit
npx vitest run
```

See the [root README](../../../README.md) for monorepo-wide conventions (catalog
deps, commit format, git workflow). See the
[Contributor Guide](../../../docs/CONTRIBUTING.md) for the full PR workflow.
