riolubruh / YABDP4Nitro

Yet Another BetterDiscord Plugin for Nitro features. Unlock screensharing modes, use cross-server and gif emotes and much more!
Other
732 stars 141 forks source link

[BUG REPORT] Doesn't send Spotify listen along invite #193

Closed ThEGuYwItHSuP closed 2 months ago

ThEGuYwItHSuP commented 2 months ago

If you try to invite someone using the "Invite @username to Listen to Spotify" whilst the plugin is activated it wont send the invite.

riolubruh commented 2 months ago

You just mentioned the GitHub user with the username "user". Also I'll look into it soon.

ThEGuYwItHSuP commented 2 months ago

i meant as in the promt. it can be any username. "Invite @(enter username here) to Listen To Spotify"

riolubruh commented 2 months ago

I know, but you can also mention GitHub users by name like that, and I'm pretty sure it notifies them when someone @'s them. Was just letting you know.

ThEGuYwItHSuP commented 2 months ago

Wanted to ask how is the search going?

riolubruh commented 2 months ago

The problem is with the following code:

if((msg[1].content !== undefined && msg[1].content != "") && runs == 0)

Basically, it sees that the message content is empty, and cancels the message. Spotify invites and other activityActions are an exception where a message with no content is allowed on the API, so I forgot to add a case for it. The fix is simply to add a special case where if an activityAction is included in the message parameters, the empty content of the message is ignored, or add a comment to the Spotify invite which will allow it to send correctly. The corrected code will look something like this:

if((msg[1].content !== undefined && (msg[1].content != "" || msg[2].activityAction != undefined)) && runs == 0)