Skip to main content
ctx.database (PluginDatabaseAccessor) opens (or creates) an SQLite database file scoped to your plugin’s data directory at {userData}/plugins-data/{pluginId}/. It returns a better-sqlite3 Database instance.
The directory is created automatically on first use. Each plugin gets its own isolated directory — plugins cannot access each other’s databases. When to use it: for structured or larger datasets a plugin needs to persist locally — landing history, cached rosters, anything relational or queryable. For a handful of simple values, ctx.config is lighter.