SpotifyShareCommands: correctly handle local tracks (#3592)

This commit is contained in:
sadan4 2025-08-07 15:04:59 -04:00 committed by GitHub
parent c7e799e935
commit 7e028267f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -46,7 +46,7 @@ interface Artist {
} }
interface Track { interface Track {
id: string; id: string | null;
album: Album; album: Album;
artists: Artist[]; artists: Artist[];
duration: number; duration: number;
@ -71,6 +71,13 @@ function makeCommand(name: string, formatUrl: (track: Track) => string): Command
}); });
} }
// local tracks have an id of null
if (track.id == null) {
return sendBotMessage(channel.id, {
content: "Failed to find the track on spotify."
});
}
const data = formatUrl(track); const data = formatUrl(track);
const message = findOption(options, "message"); const message = findOption(options, "message");