diff --git a/src/plugins/spotifyShareCommands/index.ts b/src/plugins/spotifyShareCommands/index.ts index e11864ae..d00d4a2c 100644 --- a/src/plugins/spotifyShareCommands/index.ts +++ b/src/plugins/spotifyShareCommands/index.ts @@ -46,7 +46,7 @@ interface Artist { } interface Track { - id: string; + id: string | null; album: Album; artists: Artist[]; 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 message = findOption(options, "message");