mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-12-02 19:02:50 +08:00
fix(profile): move the now-playing channel description with the bot (#159)
When the bot was moved to another channel, the channel it left kept the now-playing description forever: updateChannelDescription always targeted getChannelId(), which by then already reported the new channel. Remember which channel we last wrote to. On a self clientMoved event, clear that channel and, if a song is playing, write the description to the new one. Stop now clears the channel we actually wrote to, so a missed move event can't leave a stale description behind either. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
8ff51ea6e0
commit
faf6ac09ec
3 files changed
+115
-6
No files matched your search
+6
-1
@@ -456,11 +456,16 @@ export class BotInstance extends EventEmitter {
|
||||
this.voiceDucking.removeSpeaker(event.id);
|
||||
void this.refreshOccupancy();
|
||||
});
|
||||
this.tsClient.on("clientMoved", (event: { id: number }) => {
|
||||
this.tsClient.on("clientMoved", (event: { id: number; targetChannelID: bigint }) => {
|
||||
if (event.id === this.tsClient.getClientId()) {
|
||||
// Moving the bot invalidates every activity deadline from its old
|
||||
// channel even if no individual leave events arrive.
|
||||
this.voiceDucking.reset(false);
|
||||
// Carry the now-playing channel description over to the new
|
||||
// channel instead of leaving it stale in the old one (#159).
|
||||
this.profileManager.onChannelMoved(event.targetChannelID).catch((err) => {
|
||||
this.logger.warn({ err }, "Channel description move update failed");
|
||||
});
|
||||
} else {
|
||||
this.voiceDucking.removeSpeaker(event.id);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user