Try to put everething in queue

This commit is contained in:
sclement 2023-12-28 16:22:10 +01:00
parent db5ff0c3c4
commit 8bfb7de8a5

View File

@ -41,7 +41,7 @@ public class AutoVoiceChannel {
GuildPreferenceEntity pref = SettingsUtils.getInstance().getPreference(guild);
if (pref.isAutoVoice() && voiceChannel.getId().equals(pref.getAutoVoiceChannelID())) {
logger.info("Creating new voice channel for Guild : {}", guild.getName());
AudioChannel newChannel = (AudioChannel) voiceChannel.createCopy().complete();
voiceChannel.createCopy().queue(newChannel -> {
int next = getNextNumber();
String title = pref.getAutoVoiceChannelTitle();
if (title.isEmpty()) {
@ -49,12 +49,12 @@ public class AutoVoiceChannel {
}
title = title.replace("@count", Integer.toString(next));
newChannel.getManager().setName(title).setPosition(voiceChannel.getPosition()).complete();
moveMembers(voiceChannel.getMembers(), newChannel);
newChannel.getManager().setName(title).setPosition(voiceChannel.getPosition()).queue(t -> {
moveMembers(voiceChannel.getMembers(), (AudioChannel) newChannel);
createdChannels.put(next, newChannel.getId());
});
});
}
}
public void leave(AudioChannel voiceChannel) {
@ -89,7 +89,7 @@ public class AutoVoiceChannel {
restAction = restAction.and(destination.getGuild().moveVoiceMember(member, destination));
}
if (restAction != null) {
restAction.complete();
restAction.queue();
}
}