ZeNyfh / gigavibe-java-edition

Music + Media bot made in java using JDA and Lavaplayer.
GNU General Public License v3.0
8 stars 3 forks source link

PlayerManager's logic for which message to reply to when sending an embed is very flawed #145

Closed 9382 closed 4 months ago

9382 commented 4 months ago

https://github.com/ZeNyfh/gigavibe-java-edition/assets/49820045/8b3ab452-2b72-4ca1-920c-e27243bae67d

9382 commented 4 months ago

Turns out the bug is something related to specifically play, and how PlayerManager decides which message object it's meant to reply to. Ran into it yesterday when doing testing with insert. Currently, only the play command declares which message is replied to (PlayerManager.message = event;, who thought this was a good idea to store the message??). This means anything else that triggers a sendembed track loading (or just 2 very closely timed play commands (this means this is a potential cross-server issue!)) would load correctly but reply to the wrong message. See image attached below, where insert at an index more than queue size causes a standard load. image Solution: Either pass the event to loadAndPlay (probably worth doing this as a replacement for the guild channel variable, since then we don't add even more args) or not use 1 variable for every single reply we ever intend to do