Skip to content

Commit 3d32d8b

Browse files
authored
Merge pull request #851 from Shirowwww/main
Update Utils.ts to fix voice status not clearing
2 parents 29d42dc + e1ec30f commit 3d32d8b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/utils/Utils.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,17 @@ export function formatTime(ms: number): string {
5858
export async function setVoiceStatus(
5959
client: Lavamusic,
6060
channelId: string,
61-
message: string,
61+
message: string | null,
6262
): Promise<void> {
63-
if (!channelId || !message) return;
63+
if (!channelId) return;
64+
65+
// string => set | null / "" => clear
66+
const status = message && message.trim().length > 0 ? message : null;
6467

6568
try {
66-
await client.rest.put(`/channels/${channelId}/voice-status`, { body: { status: message } });
69+
await client.rest.put(`/channels/${channelId}/voice-status`, {
70+
body: { status },
71+
});
6772
} catch (error) {
6873
logger.error(`[Voice Status] Failed for channel ${channelId}: ${error}`);
6974
}

0 commit comments

Comments
 (0)