The bot framework for MeshCore.
Write what your bot does. The radio does the rest.
pnpm add @meshcorejs/client
- Companion Radio firmware
- TCP, serial, BLE
- Node.js 20+
import { CommandBuilder, MessageBuilder } from '@meshcorejs/client';
export default new CommandBuilder()
.setName('heard')
.setDescription('Nodes heard in the last hour')
.setHandler((ctx) => {
const since = Date.now() - 3_600_000;
const heard = ctx.client.contacts.cache.filter((contact) => contact.lastSeen.getTime() > since);
return ctx.reply(
new MessageBuilder()
.setTitle(`📡 ${heard.size} heard`)
.addLines(heard.toArray().map((contact) => contact.name))
.setOverflow('truncate'),
);
});What your bot does
Commands
Someone sends /weather in a DM, your bot answers. Wrong input gets a clear reply, not a crash.
Channels and DMs
Answers where it was asked. /weather in a DM, @Bot weather on a channel.
Jobs
Every hour, every night at 8: a report on the channel, an advert flooded, on its own.
Events
A new node heard, a contact added, a message delivered: your bot reacts.
Roles
Owners, moderators, your own: decide who can do what. Sensitive commands only work in a DM.
Plugins
Features that go together, installed in one line, reloaded from your phone.
Plugins
Add a feature to your bot in one line. Reload it from your phone.
weather
OfficialTwo-day forecast for the club location or any city, and a morning bulletin on the channel.