A template for creating bots with matrix-bot-sdk.
Want your project listed? Edit this doc.
After clicking the 'use this template' button and cloning the repo, you'll need to install the dependencies and open an editor to get started. This assumes you have at least NodeJS 14 or higher.
- Replace this README with something useful.
- Update your project's details in
package.json
. - Run
npm install
to get the dependencies.
To build it: npm run build
.
To run it: npm run start:dev
To check the lint: npm run lint
To build the Docker image: docker build -t your-bot:latest .
To run the Docker image (after building): docker run --rm -it -v $(pwd)/config:/bot/config your-bot:latest
Note that this will require a config/production.yaml
file to exist as the Docker container runs in production mode.
This template uses a package called config
to manage configuration. The default configuration is offered
as config/default.yaml
. Copy/paste this to config/development.yaml
and config/production.yaml
and edit
them accordingly for your environment.
This is a somewhat opinionated template that is runnable out of the box. The project is TypeScript with
a linter that matches the bot-sdk itself. All the good bits of the bot are under src/
.
This is where the bot's entry point is. Here you can see it reading the config, preparing the storage, and setting up other stuff that it'll use throughout its lifetime. Nothing in here should really require modification - most of the bot is elsewhere.
When the bot receives a command (see index.ts
for handoff) it gets processed here. The command structure
is fairly manual, but a basic help menu and processing for a single command is there.
This is the bot's !bot hello
command. It doesn't do much, but it is an example.
This is simply a typescript interface for your config so you can make use of types.
This is where the project's build files go. Not really much to see here.
This is the default storage location. Also not much to see here.
Come visit us in #matrix-bot-sdk:t2bot.io on Matrix if you're having trouble with this template.
Credit to anoa's matrix-nio template for the README format.