Upgrading
0.3.3 β 0.4.0
Section titled β0.3.3 β 0.4.0βStart with the migration tool:
bunx @lunibee/cli migrate # lists what needs changingbunx @lunibee/cli migrate --fix # renames the removed aliases, then lists the restIt renames the removed compatibility names (Events β ClientEvent, ShardingManager β ShardManager, DiscordAPIError β RESTError, β¦) in files that import them from Lunibee. It lists, with file and line, what needs a hand change:
IntentsBitField: use an array ofGatewayIntentBits.- REST calls in the removed
rest.post(path, { body })/rest.request({ method, path })forms: userest.post(path, body, options)andrest.request(method, path, body, options). - WebhookClient
avatarURL/threadId/allowedMentions: useavatar_url/thread_id/allowed_mentions. toRequest()results.- The 0.3 voice API, below.
It exits 1 while anything is left. The full list is in the changelog.
- Projects made with
@lunibee/createor the generated binders (src/handlers/event.ts,src/commands/index.ts): those commands are gone. Generate a new project withbunx @lunibee/cli init my-botand move your command and event files into itssrc/commandsandsrc/events; they are found at runtime.
The voice package changed the most. The 0.3 API carried no audio, so most code built on it is replaced rather than ported.
-
Install the voice peers:
bun add @snazzah/davey opusscript;ffmpegon thePATH, for anything that is not Ogg/Opus.
Discord requires DAVE outside stage channels.
-
Join through the client:
await client.voice.join({ guildId, channelId })replacesjoinVoiceChannel()+attachTransports(). To usejoinVoiceChannel()without a LunibeeClient, pass anadapterCreator. -
Statuses:
VoiceConnectionStateβVoiceConnectionStatus.Connectedbecomes"ready", a join in progress is"signalling"/"connecting", anddisconnectedcarries adisconnectReason. -
Resources:
createAudioResource(stream, metadata)βcreateAudioResource(input, { inputType, metadata, inlineVolume });inputmay be a path, URL, bytes or stream;AudioStreamis gone.
-
Player:
stoppedis gone (stop()goesidle);bufferingandautopausedare added.play()no longer returns a promise; listen forfinish.
-
Receiver:
subscribe(userId)returns aReadableStream<Uint8Array>of Opus packets instead of anAudioStream. -
Interactions:
- Call
followUp()only afterreply()ordefer(). - Use
update()/deferUpdate()only on component interactions, or modals opened from a component. - Do not call
editReply()aftershowModal().
- Call
-
Sharding restart limits:
maxRestartsnow trips for a cluster that keeps crashing with backoff in between. If you raisedwindowto work around that, you can lower it again. -
Gateway: if you reconnect yourself from a
closehandler,connect()now waits for the scheduled backoff. -
Clusters: shards are split in contiguous blocks (
[0,1] [2,3], not[0,2] [1,3]). Look up a shardβs cluster withclusterForShard(id)instead of computingid % clusterCount. AClientin a worker needsgateway: { shardId, shardCount }with one ofClusterWorker.current()!.context.shardIds, or useShardManager.