Fix voice join against LiveKit 0.13+ and tidy up command messages

revoice.js reads `room.isConnected()`, but @livekit/rtc-node turned that
into a getter, so every join threw "this.room.isConnected is not a
function" before the bot ever reached the channel. The player no longer
touches that getter: readiness comes from the connection's own join /
roomfetched events and is cleared when it reports the offline state.

Also delete the invoking chat message once a command is recognised
(DELETE_COMMAND_MESSAGES, on by default) so channels stay readable;
failures are non-fatal since it needs ManageMessages.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Leonid Pershin
2026-09-08 23:34:39 +03:00
co-authored by Claude Opus 5
parent 2b999bf2a0
commit d4880e757e
6 changed files with 573 additions and 537 deletions
+7
View File
@@ -66,6 +66,13 @@ async function handleMessage(manager: MusicManager, message: Message): Promise<v
const command = findCommand(rawName);
if (!command) return;
if (config.DELETE_COMMAND_MESSAGES) {
// Fire-and-forget: a missing ManageMessages permission must not block playback.
void message.delete().catch((err) => {
log.debug({ err, command: command.name }, "could not delete command message");
});
}
const ctx: CommandContext = {
manager,
serverId,