Hoshimi
Guides

Source Registry

Register and resolve custom search sources with SourceRegistry.

This page explains how to register custom source aliases and build valid lavalink identifiers. Use it when your project needs provider-specific search prefixes or custom source names.

Type reference: Core API (TypeDoc)

Quick links:

Register Sources

source-registry-register.ts
import {  } from 'hoshimi';

.({
  : 'mysearch',
  : 'my-provider',
  : 'colon',
});

.(
  { : 'mytts', : 'double-slash' },
  { : 'rawquery', : 'raw' },
);

declare module 'hoshimi' {
  interface CustomizableSources {
    : 'my-provider';
    : 'mytts';
  }
}

Resolve and Validate

source-registry-resolve.ts
import {  } from 'hoshimi';

const  = .('my-provider');
const  = .('mysearch');
const  = .();

.(, , );

Build Identifiers

source-registry-identifiers.ts
import {  } from 'hoshimi';

const  = .('mysearch', 'Daft Punk');
const  = .('mytts', 'hello world');
const  = .('rawquery', 'ytsearch:already-prefixed');

.(, , );

Notes

  • Use register() during app bootstrap.
  • Prefer resolve() before search if source can be user-provided.
  • Keep protocol choice consistent per source to avoid query format drift.

On this page