Handle unavailable audio node in MusicManager
Added a check for null `getLink()` in `MusicManager` before attempting connection to the audio channel. This ensures users receive a clear error message if the audio node is unavailable, improving error handling and user feedback.
This commit is contained in:
1 parent
1dca5b898a
commit
cd83fcdae6
1 file changed
+5
@@ -42,6 +42,11 @@ public class MusicUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!checkOnly && manager.isNotConnectedTo(audioChannel)) {
|
if (!checkOnly && manager.isNotConnectedTo(audioChannel)) {
|
||||||
|
if (manager.getLink() == null) {
|
||||||
|
context.reply("The audio node is currently unavailable, please try again later");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
manager.connect(audioChannel);
|
manager.connect(audioChannel);
|
||||||
manager.getScheduler().attachContext(new MusicChannelContext((GuildMessageChannel) context.getChannel(), context.getGuildUser()));
|
manager.getScheduler().attachContext(new MusicChannelContext((GuildMessageChannel) context.getChannel(), context.getGuildUser()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user