Socket
Book a DemoInstallSign in
Socket

@towns-protocol/bot

Package Overview
Dependencies
Maintainers
4
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@towns-protocol/bot

A bot framework for Towns.

npmnpm
Version
0.0.332
Version published
Weekly downloads
568
-4.22%
Maintainers
4
Weekly downloads
 
Created
Source

@towns-protocol/bot

A bot framework for Towns.

Usage

import { makeTownsBot } from "@towns-protocol/bot";
import { serve } from "@hono/node-server";

const bot = await makeTownsBot("<app-private-data-base64>", "<env>");

bot.onMentioned((client, { channelId }) =>
  client.sendMessage(channelId, "Hello, world!"),
);

const { fetch } = await bot.start();
serve({ fetch });

Running Bots

The @towns-protocol/bot package is compatible with the following approaches:

  • Bun ESM - Bun runtime with ES modules
  • esbuild + Node CJS - Bundled CommonJS for Node.js
  • tsx ESM - TypeScript execution with ES modules

For working examples and configurations, see the examples directory.

tsx with ESM

Install tsx, then run your bot with:

tsx src/index.ts

Bundled with esbuild as CommonJS

Install esbuild, then bundle your bot to a single CJS file and run with Node.js:

You can take a look at the bot-quickstart example for a working esbuild configuration.

# Build the bundle
yarn build

# Run with Node.js
node dist/bot.cjs

Bun with ESM

bun run src/index.ts

FAQs

Package last updated on 06 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts