MCPcopy Index your code
hub / github.com/Botloader/botloader

github.com/Botloader/botloader @v2026.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2026.1.0 ↗ · + Follow
2,819 symbols 5,870 edges 578 files 206 documented · 7%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Botloader

https://botloader.io | https://discord.gg/GhUeYeekdu

Botloader is a fully programmable discord bot where you can use plugins created by the author and community or create custom scripts for custom functionality.

Scripts are created in typescript using the online editor with full autocomplete support or using the vs code extension.

Project structure

This project is divided into several services and components:

Backend

The backend consists of several pieces:

  • webapi
  • The botloader HTTP API that the frontend uses
  • migrations
  • Subcommand of the backend binary that applies the database migrations found in components/stores (embedded in the binary)
  • DiscordBroker
  • Manages the gateway connection with discord, receives events and either queues them up or forwards them to the scheduler is connected
  • Also responsible for managing the state cache, exposing a API to query cached information
  • Scheduler
  • Manages a guild's js vm worker state, scheduling the vm workers between the guilds when needed
  • Takes in the events from the broker and forwards them to a vm worker
  • Handles all the timers and scheduled tasks and dispatches them to a vm worker
  • vmworker
  • A single instance of a js v8 VM,
  • Each vm runs in a dedicated process due to v8 being somewhat funky
  • Originally I kept all vms in the same process but multiple threads but there's several issues related to this such as v8 having hardcoded process exit calls in certain siutations
  • Takes in events from the scheduler to then run code in v8 on
  • jobs
  • Runs various background jobs at intervals
  • runtime-models
  • Contains models used primarily internally in the layer between the js SDK and the native op calls
  • We use rs-ts to auto-generate typescript typings for these models which reduces the possibility of bugs in this layer, leading to compile-time errors if we forget to change a field somewhere when we make changes.

Frontend

The frontend bits are located in the frontend folder together with the frontend-common folder which is also used with the vs code plugin.

Integration tests suite

In the integration-tests folder you will see a bunch of scripts.

In short, it runs a set of scripts, and the scripts test various functionality and report when complete.

In more detail: - It runs cmd/prepare-integration-tests to load them all into a test database as guild scripts - It runs the backend discordbroker and scheduler in integration test mode - The integration test mode attaches a log subscriber that listens for when scripts self-report that they finish and also exceptions and errors - Once all scripts have self-reported their finish or a certain amount of time has passed without anything happening, it stops the backend with either a failure or success depending on the former.

Extension points exported contracts — how you extend this code

Validator (Interface)
(no doc) [14 implementers]
components/validation/src/lib.rs
AsyncReader (Interface)
(no doc) [6 implementers]
components/runtime/src/ts/unstable/streams.ts
GuildLoggerBackend (Interface)
(no doc) [5 implementers]
components/guild-logger/src/lib.rs
GetClientResponse (Interface)
(no doc) [3 implementers]
components/service/src/lib.rs
Job (Interface)
(no doc) [2 implementers]
components/jobs/src/job.rs
ApiFetcher (Interface)
(no doc) [2 implementers]
frontend-common/src/api_client.ts
DiscordOauthClient (Interface)
(no doc) [1 implementers]
components/discordoauthwrapper/src/lib.rs
TestStorageType (Interface)
(no doc)
integration-tests/storagev2.ts

Core symbols most depended-on inside this repo

sendResponse
called by 160
components/runtime/src/ts/discord/interaction.ts
assertExpected
called by 129
integration-tests/lib.ts
get
called by 113
cmd/blcmd/src/api_client.rs
set
called by 107
components/stores/src/bucketstore.rs
build
called by 100
components/runtime/src/ts/commands.ts
log
called by 99
components/guild-logger/src/lib.rs
createCommand
called by 99
components/runtime/src/ts/script.ts
get_rt_ctx
called by 88
components/runtime/src/lib.rs

Shape

Method 1,007
Function 867
Class 647
Interface 187
Enum 111

Languages

TypeScript52%
Rust48%

Modules by API surface

components/runtime/src/ts/discord/dapi.ts124 symbols
components/runtime/src/ts/discord/components.ts115 symbols
components/runtime/src/ts/discord/interaction.ts110 symbols
components/runtime/src/extensions/discord.rs98 symbols
components/stores/src/config.rs86 symbols
components/runtime/src/ts/op_wrappers.ts72 symbols
components/runtime/src/ts/commands.ts68 symbols
frontend-common/src/api_client.ts62 symbols
components/runtime/src/ts/settings.ts54 symbols
components/runtime/src/ts/discord/channel.ts50 symbols
components/vm/src/vm.rs42 symbols
components/scheduler/src/guild_handler.rs38 symbols

Datastores touched

botloader-integration-testingDatabase · 1 repos
vmbench-unusedDatabase · 1 repos

For agents

$ claude mcp add botloader \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact