Getting Started
Bot Integration
Wire Hoshimi into your bot lifecycle with ready and raw gateway events.
This guide mirrors the real integration used in the example bot. Follow it to wire startup, gateway forwarding and player creation in one flow.
Type reference: Core API (TypeDoc)
Quick links:
1) Create the Manager
Use createHoshimi (or new Hoshimi) and pass your gateway sender.
import { , } from 'hoshimi';
const = async (: string, : unknown): <void> => {};
const = ({
,
: .,
: [
{
: 'localhost',
: 2333,
: 'youshallnotpass',
},
],
: {
: true,
: true,
: 300_000,
},
: {
: {
: true,
},
},
});2) Init on Ready
Call manager.init() once your bot client is ready.
import type { } from 'hoshimi';
declare const : ;
declare const : {
: string;
: string;
: string | null;
};
.();3) Forward Voice Packets
Forward raw gateway packets to updateVoiceState.
import type {
,
VoicePacket,
VoiceServer,
VoiceState,
ChannelDeletePacket,
} from 'hoshimi';
type = VoicePacket | VoiceServer | VoiceState | ChannelDeletePacket;
declare const : ;
declare const : ;
await .();4) Use in Commands
Create or reuse player instances per guild with createPlayer.
import type { } from 'hoshimi';
declare const : ;
declare const : string;
declare const : string;
declare const : string;
const = .({
,
,
,
: 100,
: true,
});
if (!.) await .();Notes
createPlayer()is idempotent by guild: if a player exists, it returns the existing instance.manager.isUseable()is a quick health check before command execution.- Prefer handling reconnect/session options in
nodeOptionsfrom day one.