Hoshimi
Getting Started

Events and Gateway

Ready/raw integration and lavalink event handlers for stable runtime behavior.

This page focuses on event wiring and cleanup behavior. It is useful as a checklist to avoid stale voice state and dangling listeners.

Type reference: Core API (TypeDoc)

Quick links:

Ready + Raw Events

gateway-events.ts
import type {
  ChannelDeletePacket,
  ,
  VoicePacket,
  VoiceServer,
  VoiceState,
} from 'hoshimi';

type  = VoicePacket | VoiceServer | VoiceState | ChannelDeletePacket;

declare const : ;
declare const : { : string; : string; : string | null };
declare const : ;

.();

await .();

Event Hooks

manager-events.ts

import {  } from 'hoshimi';

.(., (, ) => {
  .('Node ready:', ., `(retries: ${})`);
});

.(., () => {
  .('Player created:', .);
});

.(., () => {
  .('Queue ended:', .);
});

Production Checklist

  • Call init() once after client ready.
  • Forward all raw voice packets to updateVoiceState().
  • Persist key session/player fields in PlayerUpdate.
  • Clear message/lyrics/session state on QueueEnd and PlayerDestroy.

On this page