fix(profile): use clientedit for description, add sendCommandNoWait

Description via clientupdate is rejected (error 1538) on TS3 full-client
protocol. Switch to clientedit on the bot's own clid, which is how
TS3AudioBot handles it. Requires b_client_modify_description permission.

Also add sendCommandNoWait to TS3Client for fire-and-forget commands
(clientupdate, channeledit) that don't return timely responses.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
saopig1andClaude Opus 4.6 committed 2026-04-13 00:39:36 +08:00
1 parent da5b34f5f4
commit 30aced6d36
1 file changed
+13 -14
+13 -14
View File
@@ -149,24 +149,23 @@ export class BotProfileManager {
private async updateDescription(song: QueuedSong | null): Promise<void> { private async updateDescription(song: QueuedSong | null): Promise<void> {
if (!this.config.descriptionEnabled || this.permDenied.description) return; if (!this.config.descriptionEnabled || this.permDenied.description) return;
// TS3 full-client protocol rejects client_description in clientupdate
// (error 1538 "invalid parameter"). Only TS6 HTTP Query supports it.
// On TS3 we rely on nickname to display song info instead.
const httpQuery = this.tsClient.getHttpQuery();
if (!httpQuery) {
this.permDenied.description = true;
this.logger.info(
"Description not available on TS3 — using nickname to display song info",
);
return;
}
try { try {
const text = song const text = song
? `${song.name} - ${song.artist} [${song.album}]` ? `${song.name} - ${song.artist} [${song.album}]`
: ""; : "";
await httpQuery.clientUpdate({ client_description: text }); const httpQuery = this.tsClient.getHttpQuery();
if (httpQuery) {
await httpQuery.clientUpdate({ client_description: text });
} else {
// clientupdate rejects client_description (error 1538).
// Use clientedit on our own clid instead — this is what
// TS3AudioBot does via TSLib's ChangeDescription().
const clid = this.tsClient.getClientId();
if (clid <= 0) return;
await this.tsClient.execCommand(
`clientedit clid=${clid} client_description=${escapeTS3(text)}`,
);
}
this.logger.info("Description updated"); this.logger.info("Description updated");
} catch (err) { } catch (err) {
this.handleFeatureError("description", err); this.handleFeatureError("description", err);